diff --git a/ethclient/ethclient_test.go b/ethclient/ethclient_test.go index 8e70177944..815bc29de4 100644 --- a/ethclient/ethclient_test.go +++ b/ethclient/ethclient_test.go @@ -110,6 +110,12 @@ func newTestBackend(config *node.Config) (*node.Node, []*types.Block, error) { if err != nil { return nil, nil, fmt.Errorf("can't create new ethereum service: %v", err) } + // Ensure tx pool starts the background operation + txPool := ethservice.TxPool() + if err = txPool.Sync(); err != nil { + return nil, nil, fmt.Errorf("can't sync transaction pool: %v", err) + } + // Import the test chain. if err := n.Start(); err != nil { return nil, nil, fmt.Errorf("can't start test node: %v", err) @@ -506,8 +512,9 @@ func testAtFunctions(t *testing.T, client *rpc.Client) { } // send a transaction for some interesting pending status - // and wait for the transaction to be included in the pending block - sendTransaction(ec) + if err := sendTransaction(ec); err != nil { + t.Fatalf("unexpected error: %v", err) + } // wait for the transaction to be included in the pending block for {