Skip to content

Commit

Permalink
improve upgrade config
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoyangLiu committed Jul 3, 2020
1 parent 4389b6f commit 8bffb98
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cmd/geth/retesteth.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ func (api *RetestethAPI) mineBlock() error {
if api.chainConfig.DAOForkSupport && api.chainConfig.DAOForkBlock != nil && api.chainConfig.DAOForkBlock.Cmp(header.Number) == 0 {
misc.ApplyDAOHardFork(statedb)
}
systemcontractupgrade.UpgradeBuildInSystemContract(header.Number, statedb)
systemcontractupgrade.UpgradeBuildInSystemContract(api.chainConfig, header.Number, statedb)
gasPool := new(core.GasPool).AddGas(header.GasLimit)
txCount := 0
var txs []*types.Transaction
Expand Down
2 changes: 1 addition & 1 deletion core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
if config.DAOForkSupport && config.DAOForkBlock != nil && config.DAOForkBlock.Cmp(b.header.Number) == 0 {
misc.ApplyDAOHardFork(statedb)
}
systemcontractupgrade.UpgradeBuildInSystemContract(b.header.Number, statedb)
systemcontractupgrade.UpgradeBuildInSystemContract(config, b.header.Number, statedb)
// Execute any user modifications to the block
if gen != nil {
gen(i, b)
Expand Down
2 changes: 1 addition & 1 deletion core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
misc.ApplyDAOHardFork(statedb)
}
// Handle upgrade build-in system contract code
systemcontractupgrade.UpgradeBuildInSystemContract(block.Number(), statedb)
systemcontractupgrade.UpgradeBuildInSystemContract(p.config, block.Number(), statedb)
// Iterate over and process the individual transactions
posa, isPoSA := p.engine.(consensus.PoSA)
commonTxs := make([]*types.Transaction, 0, len(block.Transactions()))
Expand Down
97 changes: 83 additions & 14 deletions core/systemcontractupgrade/system-contract-upgrade.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64)
if w.chainConfig.DAOForkSupport && w.chainConfig.DAOForkBlock != nil && w.chainConfig.DAOForkBlock.Cmp(header.Number) == 0 {
misc.ApplyDAOHardFork(env.state)
}
systemcontractupgrade.UpgradeBuildInSystemContract(header.Number, env.state)
systemcontractupgrade.UpgradeBuildInSystemContract(w.chainConfig, header.Number, env.state)
// Accumulate the uncles for the current block
uncles := make([]*types.Header, 0, 2)
commitUncles := func(blocks map[common.Hash]*types.Block) {
Expand Down

0 comments on commit 8bffb98

Please sign in to comment.