From c0c8a64343fc53718506341b6bbb83ac3f8bf70c Mon Sep 17 00:00:00 2001 From: "will@2012" Date: Thu, 13 Jun 2024 21:14:34 +0800 Subject: [PATCH] fix: add more check --- triedb/pathdb/difflayer.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/triedb/pathdb/difflayer.go b/triedb/pathdb/difflayer.go index 48bc0e8cc908c..c3fe4bb7c489e 100644 --- a/triedb/pathdb/difflayer.go +++ b/triedb/pathdb/difflayer.go @@ -232,7 +232,7 @@ func (dl *diffLayer) node(owner common.Hash, path []byte, hash common.Hash, dept diffHashCacheMissMeter.Mark(1) persistLayer := dl.originDiskLayer() - if persistLayer != nil { + if hash != (common.Hash{}) && persistLayer != nil { blob, rhash, nloc, err := persistLayer.node(owner, path, hash, depth+1) if err != nil || rhash != hash { // This is a bad case with a very low probability. @@ -248,7 +248,8 @@ func (dl *diffLayer) node(owner common.Hash, path []byte, hash common.Hash, dept } } diffHashCacheSlowPathMeter.Mark(1) - log.Debug("Retry difflayer due to origin is nil", "owner", owner, "path", path, "hash", hash.String()) + log.Debug("Retry difflayer due to origin is nil or hash is empty", + "owner", owner, "path", path, "query_hash", hash.String(), "disk_layer_is_empty", persistLayer == nil) return dl.intervalNode(owner, path, hash, 0) }