Skip to content

Commit f26deb5

Browse files
committed
triedb/pathdb: skip unused recursive call
1 parent c4f8310 commit f26deb5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

triedb/pathdb/difflayer.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,17 @@ func (dl *diffLayer) node(owner common.Hash, path []byte, hash common.Hash, dept
192192
persistLayer := dl.originDiskLayer()
193193
if hash != (common.Hash{}) && persistLayer != nil {
194194
blob, rhash, nloc, err := persistLayer.node(owner, path, hash, depth+1)
195-
if err != nil || rhash != hash {
195+
if err != nil {
196+
return nil, common.Hash{}, nil, err
197+
}
198+
if rhash != hash {
196199
// This is a bad case with a very low probability.
197200
// r/w the difflayer cache and r/w the disklayer are not in the same lock,
198201
// so in extreme cases, both reading the difflayer cache and reading the disklayer may fail, eg, disklayer is stale.
199202
// In this case, fallback to the original 128-layer recursive difflayer query path.
200203
diffHashCacheSlowPathMeter.Mark(1)
201204
log.Debug("Retry difflayer due to query origin failed",
202205
"owner", owner, "path", path, "query_hash", hash.String(), "return_hash", rhash.String(), "error", err)
203-
return dl.intervalNode(owner, path, hash, 0)
204206
} else { // This is the fastpath.
205207
return blob, rhash, nloc, nil
206208
}

0 commit comments

Comments
 (0)