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 (
23
23
"errors"
24
24
"fmt"
25
25
"math/big"
26
+ "sync"
26
27
27
28
"github.com/ethereum/go-ethereum/common"
28
29
"github.com/ethereum/go-ethereum/core/types"
63
64
oldBlockHashPrefix = []byte ("block-hash-" ) // [deprecated by the header/block split, remove eventually]
64
65
65
66
ChainConfigNotFoundErr = errors .New ("ChainConfig not found" ) // general config not found error
67
+
68
+ mipmapBloomMu sync.Mutex // protect against race condition when updating mipmap blooms
66
69
)
67
70
68
71
// encodeBlockNumber encodes a block number as big endian uint64
@@ -564,6 +567,9 @@ func mipmapKey(num, level uint64) []byte {
564
567
// WriteMapmapBloom writes each address included in the receipts' logs to the
565
568
// MIP bloom bin.
566
569
func WriteMipmapBloom (db ethdb.Database , number uint64 , receipts types.Receipts ) error {
570
+ mipmapBloomMu .Lock ()
571
+ defer mipmapBloomMu .Unlock ()
572
+
567
573
batch := db .NewBatch ()
568
574
for _ , level := range MIPMapLevels {
569
575
key := mipmapKey (number , level )
You can’t perform that action at this time.
0 commit comments