mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
ethclient: fix flaky pending tx test
This commit is contained in:
parent
5572f2ed22
commit
2fcdffaef2
1 changed files with 15 additions and 2 deletions
|
|
@ -124,6 +124,18 @@ func newTestBackend(config *node.Config) (*node.Node, []*types.Block, error) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Wait until the pending nonce reflects all submitted transactions
|
||||||
|
numTxs := 0
|
||||||
|
for _, block := range blocks[1:] {
|
||||||
|
numTxs += len(block.Transactions())
|
||||||
|
}
|
||||||
|
for ; ; time.Sleep(time.Millisecond * 100) {
|
||||||
|
pendingNonceAt, err := ethservice.APIBackend.GetPoolNonce(context.Background(), testAddr)
|
||||||
|
if err == nil && pendingNonceAt == uint64(numTxs) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return n, blocks, nil
|
return n, blocks, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -506,8 +518,9 @@ func testAtFunctions(t *testing.T, client *rpc.Client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// send a transaction for some interesting pending status
|
// send a transaction for some interesting pending status
|
||||||
// and wait for the transaction to be included in the pending block
|
if err = sendTransaction(ec); err != nil {
|
||||||
sendTransaction(ec)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// wait for the transaction to be included in the pending block
|
// wait for the transaction to be included in the pending block
|
||||||
for {
|
for {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue