mirror of
https://github.com/btcsuite/btcd.git
synced 2025-01-18 21:32:30 +01:00
blockchain: export CheckBlockHeaderSanity as a library function
This commit is contained in:
parent
00d0edd5c4
commit
ee6c0e1962
@ -421,13 +421,15 @@ func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, utxoView *UtxoViewpoint)
|
||||
return totalSigOps, nil
|
||||
}
|
||||
|
||||
// checkBlockHeaderSanity performs some preliminary checks on a block header to
|
||||
// CheckBlockHeaderSanity performs some preliminary checks on a block header to
|
||||
// ensure it is sane before continuing with processing. These checks are
|
||||
// context free.
|
||||
//
|
||||
// The flags do not modify the behavior of this function directly, however they
|
||||
// are needed to pass along to checkProofOfWork.
|
||||
func checkBlockHeaderSanity(header *wire.BlockHeader, powLimit *big.Int, timeSource MedianTimeSource, flags BehaviorFlags) error {
|
||||
func CheckBlockHeaderSanity(header *wire.BlockHeader, powLimit *big.Int,
|
||||
timeSource MedianTimeSource, flags BehaviorFlags) error {
|
||||
|
||||
// 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
|
||||
// bits.
|
||||
@ -467,7 +469,7 @@ func checkBlockHeaderSanity(header *wire.BlockHeader, powLimit *big.Int, timeSou
|
||||
func checkBlockSanity(block *btcutil.Block, powLimit *big.Int, timeSource MedianTimeSource, flags BehaviorFlags) error {
|
||||
msgBlock := block.MsgBlock()
|
||||
header := &msgBlock.Header
|
||||
err := checkBlockHeaderSanity(header, powLimit, timeSource, flags)
|
||||
err := CheckBlockHeaderSanity(header, powLimit, timeSource, flags)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user