mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-21 13:36:42 +00:00
Change PoW error (#1234)
* Use proper error for invalid PoW * Add comment
This commit is contained in:
parent
dc3ae4d3ac
commit
b510fc08a7
@ -97,7 +97,7 @@ func (v *blockValidator) checkProofOfWork(header *externalapi.DomainBlockHeader)
|
|||||||
if !v.skipPoW {
|
if !v.skipPoW {
|
||||||
valid := pow.CheckProofOfWorkWithTarget(header, target)
|
valid := pow.CheckProofOfWorkWithTarget(header, target)
|
||||||
if !valid {
|
if !valid {
|
||||||
return errors.Wrap(ruleerrors.ErrUnexpectedDifficulty, "block has invalid difficulty")
|
return errors.Wrap(ruleerrors.ErrInvalidPoW, "block has invalid proof of work")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -44,6 +44,9 @@ var (
|
|||||||
// range.
|
// range.
|
||||||
ErrUnexpectedDifficulty = newRuleError("ErrUnexpectedDifficulty")
|
ErrUnexpectedDifficulty = newRuleError("ErrUnexpectedDifficulty")
|
||||||
|
|
||||||
|
// ErrInvalidPoW indicates that the block proof-of-work is invalid.
|
||||||
|
ErrInvalidPoW = newRuleError("ErrInvalidPoW")
|
||||||
|
|
||||||
// ErrHighHash indicates the block does not hash to a value which is
|
// ErrHighHash indicates the block does not hash to a value which is
|
||||||
// lower than the required target difficultly.
|
// lower than the required target difficultly.
|
||||||
ErrHighHash = newRuleError("ErrHighHash")
|
ErrHighHash = newRuleError("ErrHighHash")
|
||||||
@ -56,7 +59,7 @@ var (
|
|||||||
// the expected value.
|
// the expected value.
|
||||||
ErrBadUTXOCommitment = newRuleError("ErrBadUTXOCommitment")
|
ErrBadUTXOCommitment = newRuleError("ErrBadUTXOCommitment")
|
||||||
|
|
||||||
// ErrInvalidSubnetwork indicates the subnetwork is now allowed.
|
// ErrInvalidSubnetwork indicates the subnetwork is not allowed.
|
||||||
ErrInvalidSubnetwork = newRuleError("ErrInvalidSubnetwork")
|
ErrInvalidSubnetwork = newRuleError("ErrInvalidSubnetwork")
|
||||||
|
|
||||||
// ErrFinalityPointTimeTooOld indicates a block has a timestamp before the
|
// ErrFinalityPointTimeTooOld indicates a block has a timestamp before the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user