mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
consensus: verify header hash is same as input hash in getEpochSwitchInfo (#1627)
This commit is contained in:
parent
25a70e8770
commit
b49f6cb0f2
1 changed files with 4 additions and 0 deletions
|
|
@ -42,6 +42,10 @@ func (x *XDPoS_v2) getEpochSwitchInfo(chain consensus.ChainReader, header *types
|
||||||
if h == nil {
|
if h == nil {
|
||||||
return nil, fmt.Errorf("[getEpochSwitchInfo] can not find header from db hash %v", hash.Hex())
|
return nil, fmt.Errorf("[getEpochSwitchInfo] can not find header from db hash %v", hash.Hex())
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if h.Hash() != hash {
|
||||||
|
return nil, fmt.Errorf("[getEpochSwitchInfo] header hash not match, header hash %v, input hash %v", h.Hash().Hex(), hash.Hex())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
isEpochSwitch, _, err := x.IsEpochSwitch(h)
|
isEpochSwitch, _, err := x.IsEpochSwitch(h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue