Skip to content

Commit

Permalink
Merge pull request #400 from OffchainLabs/fix_triedb_flush
Browse files Browse the repository at this point in the history
Fixes mutex in FlushTrieDB
  • Loading branch information
tsahee authored Jan 24, 2025
2 parents 5a7010a + cbb47d1 commit 23b6a0e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/blockchain_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package core

import (
"fmt"
"sync"
"time"

"github.com/ethereum/go-ethereum/common"
Expand All @@ -30,13 +29,15 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)

func (bc *BlockChain) FlushTrieDB(advanceBlockChainMutex *sync.Mutex, capLimit common.StorageSize) error {
func (bc *BlockChain) FlushTrieDB(capLimit common.StorageSize) error {
if bc.triedb.Scheme() == rawdb.PathScheme {
return nil
}

advanceBlockChainMutex.Lock()
defer advanceBlockChainMutex.Unlock()
if !bc.chainmu.TryLock() {
return errChainStopped
}
defer bc.chainmu.Unlock()

if !bc.triegc.Empty() {
_, triegcBlockNumber := bc.triegc.Peek()
Expand Down

0 comments on commit 23b6a0e

Please sign in to comment.