core/rawdb: add HasCode, HashTrieNode and use them where possible (#24454)
This commit is contained in:
@ -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.ReadTrieNode(p.db, root); len(blob) == 0 {
|
||||
if !rawdb.HasTrieNode(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.ReadTrieNode(p.db, layers[i].Root()); len(blob) != 0 {
|
||||
if rawdb.HasTrieNode(p.db, layers[i].Root()) {
|
||||
root = layers[i].Root()
|
||||
found = true
|
||||
log.Info("Selecting middle-layer as the pruning target", "root", root, "depth", i)
|
||||
|
Reference in New Issue
Block a user