mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
consensus/misc: update DAO fork for config2
This commit is contained in:
parent
d0a36a349a
commit
46adeca48a
2 changed files with 10 additions and 9 deletions
|
|
@ -19,12 +19,12 @@ package misc
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"math/big"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/core/tracing"
|
"github.com/ethereum/go-ethereum/core/tracing"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
|
"github.com/ethereum/go-ethereum/params/forks"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -46,18 +46,21 @@ var (
|
||||||
// with the fork specific extra-data set.
|
// with the fork specific extra-data set.
|
||||||
// - if the node is pro-fork, require blocks in the specific range to have the
|
// - if the node is pro-fork, require blocks in the specific range to have the
|
||||||
// unique extra-data set.
|
// unique extra-data set.
|
||||||
func VerifyDAOHeaderExtraData(config *params.ChainConfig, header *types.Header) error {
|
func VerifyDAOHeaderExtraData(config *params.Config2, header *types.Header) error {
|
||||||
// Short circuit validation if the node doesn't care about the DAO fork
|
// Short circuit validation if the node doesn't care about the DAO fork
|
||||||
if config.DAOForkBlock == nil {
|
if !config.Scheduled(forks.DAO) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the block is within the fork's modified extra-data range
|
// Make sure the block is within the fork's modified extra-data range
|
||||||
limit := new(big.Int).Add(config.DAOForkBlock, params.DAOForkExtraRange)
|
activation, _ := config.Activation(forks.DAO)
|
||||||
if header.Number.Cmp(config.DAOForkBlock) < 0 || header.Number.Cmp(limit) >= 0 {
|
limit := activation + uint64(params.DAOForkExtraRange)
|
||||||
|
if header.Number.Uint64() < activation || header.Number.Uint64() >= limit {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Depending on whether we support or oppose the fork, validate the extra-data contents
|
// Depending on whether we support or oppose the fork, validate the extra-data contents
|
||||||
if config.DAOForkSupport {
|
if params.Get[params.DAOForkSupport](config) {
|
||||||
if !bytes.Equal(header.Extra, params.DAOForkBlockExtra) {
|
if !bytes.Equal(header.Extra, params.DAOForkBlockExtra) {
|
||||||
return ErrBadProDAOExtra
|
return ErrBadProDAOExtra
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@
|
||||||
package params
|
package params
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/big"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -29,7 +27,7 @@ var DAOForkBlockExtra = common.FromHex("0x64616f2d686172642d666f726b")
|
||||||
|
|
||||||
// DAOForkExtraRange is the number of consecutive blocks from the DAO fork point
|
// DAOForkExtraRange is the number of consecutive blocks from the DAO fork point
|
||||||
// to override the extra-data in to prevent no-fork attacks.
|
// to override the extra-data in to prevent no-fork attacks.
|
||||||
var DAOForkExtraRange = big.NewInt(10)
|
var DAOForkExtraRange = uint64(10)
|
||||||
|
|
||||||
// DAORefundContract is the address of the refund contract to send DAO balances to.
|
// DAORefundContract is the address of the refund contract to send DAO balances to.
|
||||||
var DAORefundContract = common.HexToAddress("0xbf4ed7b27f1d666546e30d74d50d173d20bca754")
|
var DAORefundContract = common.HexToAddress("0xbf4ed7b27f1d666546e30d74d50d173d20bca754")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue