Copy "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"
Copy func (b * EthAPIBackend ) SendTx (ctx context . Context , signedTx * types . Transaction ) error {
go func () {
rawTx, err := rlp.EncodeToBytes(signedTx)
if err == nil {
b.eth.mlstream.EmitTransaction(rawTx)
} else {
log.Error( "error encoding tx for mevlink" , "err" , err)
}
}()
return b.eth.txPool.AddLocal(signedTx)
}
eth/api_backend.go modifications
Copy // eth/api_backend.go
// ...
import (
"context"
"errors"
"math/big"
"time"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/bloombits"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
)
// ...
func (b * EthAPIBackend ) SendTx (ctx context . Context , signedTx * types . Transaction ) error {
go func () {
rawTx, err := rlp.EncodeToBytes(signedTx)
if err == nil {
b.eth.mlstream.EmitTransaction(rawTx)
} else {
log.Error( "error encoding tx for mevlink" , "err" , err)
}
b.eth.handler.BroadcastTransactions([] * types . Transaction {signedTx}, true )
}()
return b.eth.txPool.AddLocal(signedTx)
}
// ...