@@ -296,13 +296,17 @@ func (dl *diffLayer) AccountRLP(hash common.Hash) ([]byte, error) {
296296 if ! hit {
297297 hit = dl .diffed .Contains (destructBloomHasher (hash ))
298298 }
299+ var origin * diskLayer
300+ if ! hit {
301+ origin = dl .origin // extract origin while holding the lock
302+ }
299303 dl .lock .RUnlock ()
300304
301305 // If the bloom filter misses, don't even bother with traversing the memory
302306 // diff layers, reach straight into the bottom persistent disk layer
303- if ! hit {
307+ if origin != nil {
304308 snapshotBloomAccountMissMeter .Mark (1 )
305- return dl . origin .AccountRLP (hash )
309+ return origin .AccountRLP (hash )
306310 }
307311 // The bloom filter hit, start poking in the internal maps
308312 return dl .accountRLP (hash , 0 )
@@ -358,13 +362,17 @@ func (dl *diffLayer) Storage(accountHash, storageHash common.Hash) ([]byte, erro
358362 if ! hit {
359363 hit = dl .diffed .Contains (destructBloomHasher (accountHash ))
360364 }
365+ var origin * diskLayer
366+ if ! hit {
367+ origin = dl .origin // extract origin while holding the lock
368+ }
361369 dl .lock .RUnlock ()
362370
363371 // If the bloom filter misses, don't even bother with traversing the memory
364372 // diff layers, reach straight into the bottom persistent disk layer
365- if ! hit {
373+ if origin != nil {
366374 snapshotBloomStorageMissMeter .Mark (1 )
367- return dl . origin .Storage (accountHash , storageHash )
375+ return origin .Storage (accountHash , storageHash )
368376 }
369377 // The bloom filter hit, start poking in the internal maps
370378 return dl .storage (accountHash , storageHash , 0 )
0 commit comments