Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Commit 338747b

Browse files
authoredJul 2, 2019
State trie clearing fix (#82)
* Fixed commit state trie clearing detail * Added stc to miner work state committing
1 parent 91521e7 commit 338747b

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed
 

‎cmd/evm/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ func run(ctx *cli.Context) error {
163163
vmdone := time.Since(tstart)
164164

165165
if ctx.GlobalBool(DumpFlag.Name) {
166-
statedb.CommitTo(db, false)
166+
statedb.IntermediateRoot(true)
167+
statedb.CommitTo(db, true)
167168
fmt.Println(string(statedb.Dump([]common.Address{})))
168169
}
169170

‎core/blockchain.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import (
4646
"github.com/eth-classic/go-ethereum/pow"
4747
"github.com/eth-classic/go-ethereum/rlp"
4848
"github.com/eth-classic/go-ethereum/trie"
49-
"github.com/hashicorp/golang-lru"
49+
lru "github.com/hashicorp/golang-lru"
5050
)
5151

5252
var (
@@ -1655,7 +1655,7 @@ func (bc *BlockChain) InsertChain(chain types.Blocks) (res *ChainInsertResult) {
16551655
return
16561656
}
16571657
// Write state changes to database
1658-
_, err = bc.stateCache.CommitTo(bc.chainDb, false)
1658+
_, err = bc.stateCache.CommitTo(bc.chainDb, bc.config.IsAtlantis(block.Number()))
16591659
if err != nil {
16601660
res.Error = err
16611661
return

‎core/chain_manager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func GenerateChain(config *ChainConfig, parent *types.Block, db ethdb.Database,
234234
gen(i, b)
235235
}
236236
AccumulateRewards(config, statedb, h, b.uncles)
237-
root, err := statedb.CommitTo(db, false)
237+
root, err := statedb.CommitTo(db, config.IsAtlantis(b.header.Number))
238238
if err != nil {
239239
panic(fmt.Sprintf("state write error: %v", err))
240240
}

‎miner/worker.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func (self *worker) wait() {
267267
}
268268
go self.mux.Post(core.NewMinedBlockEvent{Block: block})
269269
} else {
270-
work.state.CommitTo(self.chainDb, false)
270+
work.state.CommitTo(self.chainDb, work.config.IsAtlantis(block.Number()))
271271
parent := self.chain.GetBlock(block.ParentHash())
272272
if parent == nil {
273273
glog.V(logger.Error).Infoln("Invalid block found during mining")

0 commit comments

Comments
 (0)
This repository has been archived.