Skip to content

Commit 6e50f8c

Browse files
author
colinlyguo
committed
add more retries
1 parent ec42bfd commit 6e50f8c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

eth/api.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,13 @@ func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateles
368368
if err := blockchain.Validator().ValidateState(block, statedb, receipts, usedGas); err != nil {
369369
return nil, fmt.Errorf("failed to validate block %d: %w", block.Number(), err)
370370
}
371+
372+
for retries := 0; retries <= 3; retries++ {
373+
err = testWitness(blockchain, block, witness)
374+
if err == nil {
375+
return witness, nil
376+
}
377+
}
371378
return witness, testWitness(blockchain, block, witness)
372379
}
373380

@@ -408,6 +415,7 @@ func testWitness(blockchain *core.BlockChain, block *types.Block, witness *state
408415
}
409416
retryLimit := 5
410417
for retries := 0; retries <= retryLimit; retries++ {
418+
statedb.Commit(blockchain.Config().IsEIP158(block.Number()))
411419
computedRoot := statedb.IntermediateRoot(blockchain.Config().IsEIP158(block.Number()))
412420
if computedRoot == postStateRoot {
413421
break

0 commit comments

Comments
 (0)