diff --git a/blockchain/blockchain.go b/blockchain/blockchain.go index 46effbf07..27901e011 100644 --- a/blockchain/blockchain.go +++ b/blockchain/blockchain.go @@ -375,7 +375,6 @@ func (b *Blockchain) Store(block *core.Block, blockCommitments *core.BlockCommit return err } - // Todo: also handle deletion / reverts etc if err := storeL1HandlerMsgHashes(txn, block); err != nil { return err } @@ -919,7 +918,6 @@ func (b *Blockchain) revertHead(txn db.Transaction) error { } // Revert chain height and pending. - if genesisBlock { if err = txn.Delete(db.Pending.Key()); err != nil { return err @@ -962,6 +960,11 @@ func removeTxsAndReceipts(txn db.Transaction, blockNumber, numTxs uint64) error if err = txn.Delete(db.TransactionBlockNumbersAndIndicesByHash.Key(reorgedTxn.Hash().Marshal())); err != nil { return err } + if l1handler, ok := reorgedTxn.(*core.L1HandlerTransaction); ok { + if err = txn.Delete(db.L1HandlerTxnHash.Key(l1handler.MessageHash())); err != nil { + return err + } + } } return nil