ethclient: fix flaky test (#28864)
Fix flaky test due to incomplete transaction indexing
This commit is contained in:
parent
a8a87586c1
commit
765f2904d8
@ -689,6 +689,8 @@ type rpcProgress struct {
|
|||||||
HealedBytecodeBytes hexutil.Uint64
|
HealedBytecodeBytes hexutil.Uint64
|
||||||
HealingTrienodes hexutil.Uint64
|
HealingTrienodes hexutil.Uint64
|
||||||
HealingBytecode hexutil.Uint64
|
HealingBytecode hexutil.Uint64
|
||||||
|
TxIndexFinishedBlocks hexutil.Uint64
|
||||||
|
TxIndexRemainingBlocks hexutil.Uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *rpcProgress) toSyncProgress() *ethereum.SyncProgress {
|
func (p *rpcProgress) toSyncProgress() *ethereum.SyncProgress {
|
||||||
@ -713,5 +715,7 @@ func (p *rpcProgress) toSyncProgress() *ethereum.SyncProgress {
|
|||||||
HealedBytecodeBytes: uint64(p.HealedBytecodeBytes),
|
HealedBytecodeBytes: uint64(p.HealedBytecodeBytes),
|
||||||
HealingTrienodes: uint64(p.HealingTrienodes),
|
HealingTrienodes: uint64(p.HealingTrienodes),
|
||||||
HealingBytecode: uint64(p.HealingBytecode),
|
HealingBytecode: uint64(p.HealingBytecode),
|
||||||
|
TxIndexFinishedBlocks: uint64(p.TxIndexFinishedBlocks),
|
||||||
|
TxIndexRemainingBlocks: uint64(p.TxIndexRemainingBlocks),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,6 +231,13 @@ func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
|
|||||||
if _, err := ethservice.BlockChain().InsertChain(blocks[1:]); err != nil {
|
if _, err := ethservice.BlockChain().InsertChain(blocks[1:]); err != nil {
|
||||||
t.Fatalf("can't import test blocks: %v", err)
|
t.Fatalf("can't import test blocks: %v", err)
|
||||||
}
|
}
|
||||||
|
// Ensure the tx indexing is fully generated
|
||||||
|
for ; ; time.Sleep(time.Millisecond * 100) {
|
||||||
|
progress, err := ethservice.BlockChain().TxIndexProgress()
|
||||||
|
if err == nil && progress.Done() {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
return n, blocks
|
return n, blocks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user