From 8b6df6b449ec1828c534d7260fda2a9e79523d97 Mon Sep 17 00:00:00 2001 From: Diego Nava Date: Tue, 26 Sep 2023 11:24:25 +0200 Subject: [PATCH] verify root hashes after commit --- core/preimages.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/preimages.go b/core/preimages.go index 7df555015..a70694d83 100644 --- a/core/preimages.go +++ b/core/preimages.go @@ -240,8 +240,10 @@ func GeneratePreimages(chain BlockChain, start, end uint64) error { } if stateAt != nil { - if _, err := endingState.Commit(false); err != nil { + if root, err := endingState.Commit(false); err != nil { return fmt.Errorf("unabe to commit state for block '%d': %w", i, err) + } else if root.Hex() != block.Root().Hex() { + return fmt.Errorf("block root hashes different after commit commitRoot='%s' blockRoot='%s'", root.Hex(), block.Root().Hex()) } if err := chain.CommitPreimages(); err != nil {