Skip to content

Commit

Permalink
blockchain: export CheckBlockHeaderSanity as a library function
Browse files Browse the repository at this point in the history
  • Loading branch information
Crypt-iQ committed Jun 29, 2023
1 parent 00d0edd commit ee6c0e1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions blockchain/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit ee6c0e1

Please sign in to comment.