@@ -296,13 +296,17 @@ func (dl *diffLayer) AccountRLP(hash common.Hash) ([]byte, error) {
296
296
if ! hit {
297
297
hit = dl .diffed .Contains (destructBloomHasher (hash ))
298
298
}
299
+ var origin * diskLayer
300
+ if ! hit {
301
+ origin = dl .origin // extract origin while holding the lock
302
+ }
299
303
dl .lock .RUnlock ()
300
304
301
305
// If the bloom filter misses, don't even bother with traversing the memory
302
306
// diff layers, reach straight into the bottom persistent disk layer
303
- if ! hit {
307
+ if origin != nil {
304
308
snapshotBloomAccountMissMeter .Mark (1 )
305
- return dl . origin .AccountRLP (hash )
309
+ return origin .AccountRLP (hash )
306
310
}
307
311
// The bloom filter hit, start poking in the internal maps
308
312
return dl .accountRLP (hash , 0 )
@@ -358,13 +362,17 @@ func (dl *diffLayer) Storage(accountHash, storageHash common.Hash) ([]byte, erro
358
362
if ! hit {
359
363
hit = dl .diffed .Contains (destructBloomHasher (accountHash ))
360
364
}
365
+ var origin * diskLayer
366
+ if ! hit {
367
+ origin = dl .origin // extract origin while holding the lock
368
+ }
361
369
dl .lock .RUnlock ()
362
370
363
371
// If the bloom filter misses, don't even bother with traversing the memory
364
372
// diff layers, reach straight into the bottom persistent disk layer
365
- if ! hit {
373
+ if origin != nil {
366
374
snapshotBloomStorageMissMeter .Mark (1 )
367
- return dl . origin .Storage (accountHash , storageHash )
375
+ return origin .Storage (accountHash , storageHash )
368
376
}
369
377
// The bloom filter hit, start poking in the internal maps
370
378
return dl .storage (accountHash , storageHash , 0 )
0 commit comments