mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
fix(system-contract): Check coinbase during header verification (#1128)
This commit is contained in:
parent
1ceb1ba496
commit
87e196052a
2 changed files with 9 additions and 2 deletions
|
|
@ -37,7 +37,10 @@ var (
|
||||||
// that is not part of the local blockchain.
|
// that is not part of the local blockchain.
|
||||||
errUnknownBlock = errors.New("unknown block")
|
errUnknownBlock = errors.New("unknown block")
|
||||||
|
|
||||||
// errNonceNotEmpty is returned if a nonce value is non-zero
|
// errInvalidCoinbase is returned if a coinbase value is non-zero
|
||||||
|
errInvalidCoinbase = errors.New("coinbase not empty")
|
||||||
|
|
||||||
|
// errInvalidNonce is returned if a nonce value is non-zero
|
||||||
errInvalidNonce = errors.New("nonce not empty nor zero")
|
errInvalidNonce = errors.New("nonce not empty nor zero")
|
||||||
|
|
||||||
// errMissingSignature is returned if a block's extra-data section doesn't seem
|
// errMissingSignature is returned if a block's extra-data section doesn't seem
|
||||||
|
|
@ -116,6 +119,10 @@ func (s *SystemContract) verifyHeader(chain consensus.ChainHeaderReader, header
|
||||||
if header.Time > uint64(time.Now().Unix()) {
|
if header.Time > uint64(time.Now().Unix()) {
|
||||||
return consensus.ErrFutureBlock
|
return consensus.ErrFutureBlock
|
||||||
}
|
}
|
||||||
|
// Ensure that the coinbase is zero
|
||||||
|
if header.Coinbase != (common.Address{}) {
|
||||||
|
return errInvalidCoinbase
|
||||||
|
}
|
||||||
// Ensure that the nonce is zero
|
// Ensure that the nonce is zero
|
||||||
if header.Nonce != (types.BlockNonce{}) {
|
if header.Nonce != (types.BlockNonce{}) {
|
||||||
return errInvalidNonce
|
return errInvalidNonce
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 5 // Major version component of the current release
|
VersionMajor = 5 // Major version component of the current release
|
||||||
VersionMinor = 8 // Minor version component of the current release
|
VersionMinor = 8 // Minor version component of the current release
|
||||||
VersionPatch = 16 // Patch version component of the current release
|
VersionPatch = 17 // Patch version component of the current release
|
||||||
VersionMeta = "mainnet" // Version metadata to append to the version string
|
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue