mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
remove isemptyhash
This commit is contained in:
parent
cddeaf2db1
commit
221326aafc
2 changed files with 2 additions and 11 deletions
|
|
@ -124,7 +124,7 @@ func (x *XDPoS_v2) SignHash(header *types.Header) (hash common.Hash) {
|
||||||
func (x *XDPoS_v2) Initial(chain consensus.ChainReader, header *types.Header, masternodes []common.Address) error {
|
func (x *XDPoS_v2) Initial(chain consensus.ChainReader, header *types.Header, masternodes []common.Address) error {
|
||||||
log.Info("[Initial] initial v2 related parameters")
|
log.Info("[Initial] initial v2 related parameters")
|
||||||
|
|
||||||
if !isEmptyHash(x.highestQuorumCert.ProposedBlockInfo.Hash) { // already initialized
|
if x.highestQuorumCert.ProposedBlockInfo.Hash != (common.Hash{}) { // already initialized
|
||||||
log.Error("[Initial] Already initialized", "blockNum", header.Number, "Hash", header.Hash())
|
log.Error("[Initial] Already initialized", "blockNum", header.Number, "Hash", header.Hash())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -573,7 +573,7 @@ func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Heade
|
||||||
return utils.ErrInvalidQC
|
return utils.ErrInvalidQC
|
||||||
}
|
}
|
||||||
|
|
||||||
if isEmptyHash(quorumCert.ProposedBlockInfo.Hash) {
|
if quorumCert.ProposedBlockInfo.Hash == (common.Hash{}) {
|
||||||
return utils.ErrEmptyBlockInfoHash
|
return utils.ErrEmptyBlockInfoHash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,12 +68,3 @@ func decodeMasternodesFromHeaderExtra(checkpointHeader *types.Header) []common.A
|
||||||
}
|
}
|
||||||
return masternodes
|
return masternodes
|
||||||
}
|
}
|
||||||
|
|
||||||
func isEmptyHash(hash common.Hash) bool {
|
|
||||||
for _, b := range hash {
|
|
||||||
if b != 0 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue