Export the CheckBlockSanity function.
This commit is contained in:
parent
36941cc427
commit
09b53a8fca
4 changed files with 4 additions and 10 deletions
|
@ -16,12 +16,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TstCheckBlockSanity makes the internal checkBlockSanity function available to
|
|
||||||
// the test package.
|
|
||||||
func (b *BlockChain) TstCheckBlockSanity(block *btcutil.Block) error {
|
|
||||||
return b.checkBlockSanity(block)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TstSetCoinbaseMaturity makes the ability to set the coinbase maturity
|
// TstSetCoinbaseMaturity makes the ability to set the coinbase maturity
|
||||||
// available to the test package.
|
// available to the test package.
|
||||||
func TstSetCoinbaseMaturity(maturity int64) {
|
func TstSetCoinbaseMaturity(maturity int64) {
|
||||||
|
|
|
@ -112,7 +112,7 @@ func (b *BlockChain) ProcessBlock(block *btcutil.Block) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform preliminary sanity checks on the block and its transactions.
|
// Perform preliminary sanity checks on the block and its transactions.
|
||||||
err = b.checkBlockSanity(block)
|
err = b.CheckBlockSanity(block)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,9 +388,9 @@ func countP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, txStore TxStore) (int, e
|
||||||
return totalSigOps, nil
|
return totalSigOps, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkBlockSanity performs some preliminary checks on a block to ensure it is
|
// CheckBlockSanity performs some preliminary checks on a block to ensure it is
|
||||||
// sane before continuing with block processing. These checks are context free.
|
// sane before continuing with block processing. These checks are context free.
|
||||||
func (b *BlockChain) checkBlockSanity(block *btcutil.Block) error {
|
func (b *BlockChain) CheckBlockSanity(block *btcutil.Block) error {
|
||||||
// NOTE: bitcoind does size limits checking here, but the size limits
|
// NOTE: bitcoind does size limits checking here, but the size limits
|
||||||
// have already been checked by btcwire for incoming blocks. Also,
|
// have already been checked by btcwire for incoming blocks. Also,
|
||||||
// btcwire checks the size limits on send too, so there is no need
|
// btcwire checks the size limits on send too, so there is no need
|
||||||
|
|
|
@ -24,7 +24,7 @@ func TestCheckBlockSanity(t *testing.T) {
|
||||||
defer teardownFunc()
|
defer teardownFunc()
|
||||||
|
|
||||||
block := btcutil.NewBlock(&Block100000)
|
block := btcutil.NewBlock(&Block100000)
|
||||||
err = chain.TstCheckBlockSanity(block)
|
err = chain.CheckBlockSanity(block)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("CheckBlockSanity: %v", err)
|
t.Errorf("CheckBlockSanity: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue