Skip to content

Commit 87e1960

Browse files
authored
fix(system-contract): Check coinbase during header verification (#1128)
1 parent 1ceb1ba commit 87e1960

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

consensus/system_contract/consensus.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ var (
3737
// that is not part of the local blockchain.
3838
errUnknownBlock = errors.New("unknown block")
3939

40-
// errNonceNotEmpty is returned if a nonce value is non-zero
40+
// errInvalidCoinbase is returned if a coinbase value is non-zero
41+
errInvalidCoinbase = errors.New("coinbase not empty")
42+
43+
// errInvalidNonce is returned if a nonce value is non-zero
4144
errInvalidNonce = errors.New("nonce not empty nor zero")
4245

4346
// 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
116119
if header.Time > uint64(time.Now().Unix()) {
117120
return consensus.ErrFutureBlock
118121
}
122+
// Ensure that the coinbase is zero
123+
if header.Coinbase != (common.Address{}) {
124+
return errInvalidCoinbase
125+
}
119126
// Ensure that the nonce is zero
120127
if header.Nonce != (types.BlockNonce{}) {
121128
return errInvalidNonce

params/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 8 // Minor version component of the current release
27-
VersionPatch = 16 // Patch version component of the current release
27+
VersionPatch = 17 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)