Skip to content

Commit

Permalink
test: cancel async cap difflayer
Browse files Browse the repository at this point in the history
  • Loading branch information
joeylichang committed Apr 25, 2024
1 parent 7ba4851 commit 3d381c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,6 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
}
// Make sure no inconsistent state is leaked during insertion
externTd := new(big.Int).Add(block.Difficulty(), ptd)
state.SetExpectedStateRoot(block.Root())

// Irrelevant of the canonical status, write the block itself to the database.
//
Expand Down
26 changes: 13 additions & 13 deletions trie/triedb/pathdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/gopool"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
Expand Down Expand Up @@ -234,18 +233,19 @@ func (db *Database) Update(root common.Hash, parentRoot common.Hash, block uint6
if err := db.tree.add(root, parentRoot, block, nodes, states); err != nil {
return err
}
gopool.Submit(func() {
// Keep 128 diff layers in the memory, persistent layer is 129th.
// - head layer is paired with HEAD state
// - head-1 layer is paired with HEAD-1 state
// - head-127 layer(bottom-most diff layer) is paired with HEAD-127 state
// - head-128 layer(disk layer) is paired with HEAD-128 state
err := db.tree.cap(root, maxDiffLayers)
if err != nil {
log.Crit("failed to cap layer tree", "root", root, "error", err)
}
})
return nil
//gopool.Submit(func() {
// // Keep 128 diff layers in the memory, persistent layer is 129th.
// // - head layer is paired with HEAD state
// // - head-1 layer is paired with HEAD-1 state
// // - head-127 layer(bottom-most diff layer) is paired with HEAD-127 state
// // - head-128 layer(disk layer) is paired with HEAD-128 state
// err := db.tree.cap(root, maxDiffLayers)
// if err != nil {
// log.Crit("failed to cap layer tree", "root", root, "error", err)
// }
//})
//return nil
return db.tree.cap(root, maxDiffLayers)
}

// Commit traverses downwards the layer tree from a specified layer with the
Expand Down

0 comments on commit 3d381c7

Please sign in to comment.