Skip to content

Commit 23b6a0e

Browse files
authored
Merge pull request #400 from OffchainLabs/fix_triedb_flush
Fixes mutex in FlushTrieDB
2 parents 5a7010a + cbb47d1 commit 23b6a0e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/blockchain_arbitrum.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package core
1919

2020
import (
2121
"fmt"
22-
"sync"
2322
"time"
2423

2524
"github.com/ethereum/go-ethereum/common"
@@ -30,13 +29,15 @@ import (
3029
"github.com/ethereum/go-ethereum/rpc"
3130
)
3231

33-
func (bc *BlockChain) FlushTrieDB(advanceBlockChainMutex *sync.Mutex, capLimit common.StorageSize) error {
32+
func (bc *BlockChain) FlushTrieDB(capLimit common.StorageSize) error {
3433
if bc.triedb.Scheme() == rawdb.PathScheme {
3534
return nil
3635
}
3736

38-
advanceBlockChainMutex.Lock()
39-
defer advanceBlockChainMutex.Unlock()
37+
if !bc.chainmu.TryLock() {
38+
return errChainStopped
39+
}
40+
defer bc.chainmu.Unlock()
4041

4142
if !bc.triegc.Empty() {
4243
_, triegcBlockNumber := bc.triegc.Peek()

0 commit comments

Comments
 (0)