diff --git a/cmd/ronin/snapshot.go b/cmd/ronin/snapshot.go index 2a6a97f36..acb24361c 100644 --- a/cmd/ronin/snapshot.go +++ b/cmd/ronin/snapshot.go @@ -394,8 +394,7 @@ func traverseRawState(ctx *cli.Context) error { if node != (common.Hash{}) { // Check the present for non-empty hash node(embedded node doesn't // have their own hash). - blob := rawdb.ReadLegacyTrieNode(chaindb, node) - if len(blob) == 0 { + if !rawdb.HasLegacyTrieNode(chaindb, node) { log.Error("Missing trie node(account)", "hash", node) return errors.New("missing account") } @@ -423,8 +422,7 @@ func traverseRawState(ctx *cli.Context) error { // Check the present for non-empty hash node(embedded node doesn't // have their own hash). if node != (common.Hash{}) { - blob := rawdb.ReadLegacyTrieNode(chaindb, node) - if len(blob) == 0 { + if !rawdb.HasLegacyTrieNode(chaindb, node) { log.Error("Missing trie node(storage)", "hash", node) return errors.New("missing storage") } diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go index 34497569d..a383990be 100644 --- a/core/state/pruner/pruner.go +++ b/core/state/pruner/pruner.go @@ -265,7 +265,7 @@ func (p *Pruner) Prune(root common.Hash) error { // Ensure the root is really present. The weak assumption // is the presence of root can indicate the presence of the // entire trie. - if blob := rawdb.ReadLegacyTrieNode(p.db, root); len(blob) == 0 { + if !rawdb.HasLegacyTrieNode(p.db, root) { // The special case is for clique based networks(rinkeby, goerli // and some other private networks), it's possible that two // consecutive blocks will have same root. In this case snapshot @@ -279,7 +279,7 @@ func (p *Pruner) Prune(root common.Hash) error { // as the pruning target. var found bool for i := len(layers) - 2; i >= 2; i-- { - if blob := rawdb.ReadLegacyTrieNode(p.db, layers[i].Root()); len(blob) != 0 { + if !rawdb.HasLegacyTrieNode(p.db, layers[i].Root()) { root = layers[i].Root() found = true log.Info("Selecting middle-layer as the pruning target", "root", root, "depth", i)