eth/catalyst: ensure TxPool is synced in Fork (#29876)
This should fix an occasional test failure in ethclient/simulated.TestForkResendTx. Inspection of logs revealed the cause of the failure to be that the txpool was not done reorganizing by the time Fork is called.
This commit is contained in:
parent
2f06c1e854
commit
6bb13e8e2b
|
@ -279,9 +279,12 @@ func (c *SimulatedBeacon) Rollback() {
|
||||||
|
|
||||||
// Fork sets the head to the provided hash.
|
// Fork sets the head to the provided hash.
|
||||||
func (c *SimulatedBeacon) Fork(parentHash common.Hash) error {
|
func (c *SimulatedBeacon) Fork(parentHash common.Hash) error {
|
||||||
|
// Ensure no pending transactions.
|
||||||
|
c.eth.TxPool().Sync()
|
||||||
if len(c.eth.TxPool().Pending(txpool.PendingFilter{})) != 0 {
|
if len(c.eth.TxPool().Pending(txpool.PendingFilter{})) != 0 {
|
||||||
return errors.New("pending block dirty")
|
return errors.New("pending block dirty")
|
||||||
}
|
}
|
||||||
|
|
||||||
parent := c.eth.BlockChain().GetBlockByHash(parentHash)
|
parent := c.eth.BlockChain().GetBlockByHash(parentHash)
|
||||||
if parent == nil {
|
if parent == nil {
|
||||||
return errors.New("parent not found")
|
return errors.New("parent not found")
|
||||||
|
|
Loading…
Reference in New Issue