File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
2323 "errors"
2424 "fmt"
2525 "math/big"
26+ "sync"
2627
2728 "github.com/ethereum/go-ethereum/common"
2829 "github.com/ethereum/go-ethereum/core/types"
6364 oldBlockHashPrefix = []byte ("block-hash-" ) // [deprecated by the header/block split, remove eventually]
6465
6566 ChainConfigNotFoundErr = errors .New ("ChainConfig not found" ) // general config not found error
67+
68+ mipmapBloomMu sync.Mutex // protect against race condition when updating mipmap blooms
6669)
6770
6871// encodeBlockNumber encodes a block number as big endian uint64
@@ -564,6 +567,9 @@ func mipmapKey(num, level uint64) []byte {
564567// WriteMapmapBloom writes each address included in the receipts' logs to the
565568// MIP bloom bin.
566569func WriteMipmapBloom (db ethdb.Database , number uint64 , receipts types.Receipts ) error {
570+ mipmapBloomMu .Lock ()
571+ defer mipmapBloomMu .Unlock ()
572+
567573 batch := db .NewBatch ()
568574 for _ , level := range MIPMapLevels {
569575 key := mipmapKey (number , level )
You can’t perform that action at this time.
0 commit comments