Export CheckProofOfWork function.
This commit is contained in:
parent
38a694e309
commit
958ea38fdd
1 changed files with 3 additions and 3 deletions
|
@ -259,10 +259,10 @@ func CheckTransactionSanity(tx *btcutil.Tx) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkProofOfWork ensures the block header bits which indicate the target
|
// CheckProofOfWork ensures the block header bits which indicate the target
|
||||||
// difficulty is in min/max range and that the block hash is less than the
|
// difficulty is in min/max range and that the block hash is less than the
|
||||||
// target difficulty as claimed.
|
// target difficulty as claimed.
|
||||||
func checkProofOfWork(block *btcutil.Block, powLimit *big.Int) error {
|
func CheckProofOfWork(block *btcutil.Block, powLimit *big.Int) error {
|
||||||
// The target difficulty must be larger than zero.
|
// The target difficulty must be larger than zero.
|
||||||
target := CompactToBig(block.MsgBlock().Header.Bits)
|
target := CompactToBig(block.MsgBlock().Header.Bits)
|
||||||
if target.Sign() <= 0 {
|
if target.Sign() <= 0 {
|
||||||
|
@ -394,7 +394,7 @@ func CheckBlockSanity(block *btcutil.Block, powLimit *big.Int) error {
|
||||||
// Ensure the proof of work bits in the block header is in min/max range
|
// Ensure the proof of work bits in the block header is in min/max range
|
||||||
// and the block hash is less than the target value described by the
|
// and the block hash is less than the target value described by the
|
||||||
// bits.
|
// bits.
|
||||||
err := checkProofOfWork(block, powLimit)
|
err := CheckProofOfWork(block, powLimit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue