Skip to content

Commit

Permalink
upgrade.go: system contracts defined after genesis need to be explici…
Browse files Browse the repository at this point in the history
…tly created (#425)
  • Loading branch information
blxdyx authored Jul 5, 2024
1 parent 386a482 commit dbbbf53
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/systemcontracts/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ func UpgradeBuildInSystemContract(config *chain.Config, blockNumber *big.Int, la
}
for addr, account := range allocs {
logger.Debug("[parlia] upgrade System Contract code", "blockNumber", blockNumber, "blockTime", blockTime, "targetNumberOrTime", numOrTime, "address", addr)
prevContractCode := state.GetCode(addr)
if len(prevContractCode) == 0 && len(account.Code) > 0 {
// system contracts defined after genesis need to be explicitly created
state.CreateAccount(addr, true)
}
state.SetCode(addr, account.Code)
}
}
Expand Down

0 comments on commit dbbbf53

Please sign in to comment.