Update btcscript import paths to new location.

This commit is contained in:
Dave Collins 2015-01-30 12:08:47 -06:00
parent dd512e7315
commit 3f177c9895
3 changed files with 21 additions and 21 deletions

View File

@ -7,8 +7,8 @@ package btcchain
import ( import (
"fmt" "fmt"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcnet" "github.com/btcsuite/btcnet"
"github.com/btcsuite/btcscript"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwire" "github.com/btcsuite/btcwire"
) )
@ -192,8 +192,8 @@ func isNonstandardTransaction(tx *btcutil.Tx) bool {
// Check all of the output public key scripts for non-standard scripts. // Check all of the output public key scripts for non-standard scripts.
for _, txOut := range tx.MsgTx().TxOut { for _, txOut := range tx.MsgTx().TxOut {
scriptClass := btcscript.GetScriptClass(txOut.PkScript) scriptClass := txscript.GetScriptClass(txOut.PkScript)
if scriptClass == btcscript.NonStandardTy { if scriptClass == txscript.NonStandardTy {
return true return true
} }
} }

View File

@ -9,7 +9,7 @@ import (
"math" "math"
"runtime" "runtime"
"github.com/btcsuite/btcscript" "github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwire" "github.com/btcsuite/btcwire"
) )
@ -29,7 +29,7 @@ type txValidator struct {
quitChan chan struct{} quitChan chan struct{}
resultChan chan error resultChan chan error
txStore TxStore txStore TxStore
flags btcscript.ScriptFlags flags txscript.ScriptFlags
} }
// sendResult sends the result of a script pair validation on the internal // sendResult sends the result of a script pair validation on the internal
@ -83,7 +83,7 @@ out:
// Create a new script engine for the script pair. // Create a new script engine for the script pair.
sigScript := txIn.SignatureScript sigScript := txIn.SignatureScript
pkScript := originMsgTx.TxOut[originTxIndex].PkScript pkScript := originMsgTx.TxOut[originTxIndex].PkScript
engine, err := btcscript.NewScript(sigScript, pkScript, engine, err := txscript.NewScript(sigScript, pkScript,
txVI.txInIndex, txVI.tx.MsgTx(), v.flags) txVI.txInIndex, txVI.tx.MsgTx(), v.flags)
if err != nil { if err != nil {
str := fmt.Sprintf("failed to parse input "+ str := fmt.Sprintf("failed to parse input "+
@ -179,7 +179,7 @@ func (v *txValidator) Validate(items []*txValidateItem) error {
// newTxValidator returns a new instance of txValidator to be used for // newTxValidator returns a new instance of txValidator to be used for
// validating transaction scripts asynchronously. // validating transaction scripts asynchronously.
func newTxValidator(txStore TxStore, flags btcscript.ScriptFlags) *txValidator { func newTxValidator(txStore TxStore, flags txscript.ScriptFlags) *txValidator {
return &txValidator{ return &txValidator{
validateChan: make(chan *txValidateItem), validateChan: make(chan *txValidateItem),
quitChan: make(chan struct{}), quitChan: make(chan struct{}),
@ -191,7 +191,7 @@ func newTxValidator(txStore TxStore, flags btcscript.ScriptFlags) *txValidator {
// ValidateTransactionScripts validates the scripts for the passed transaction // ValidateTransactionScripts validates the scripts for the passed transaction
// using multiple goroutines. // using multiple goroutines.
func ValidateTransactionScripts(tx *btcutil.Tx, txStore TxStore, flags btcscript.ScriptFlags) error { func ValidateTransactionScripts(tx *btcutil.Tx, txStore TxStore, flags txscript.ScriptFlags) error {
// Collect all of the transaction inputs and required information for // Collect all of the transaction inputs and required information for
// validation. // validation.
txIns := tx.MsgTx().TxIn txIns := tx.MsgTx().TxIn
@ -224,9 +224,9 @@ func ValidateTransactionScripts(tx *btcutil.Tx, txStore TxStore, flags btcscript
func checkBlockScripts(block *btcutil.Block, txStore TxStore) error { func checkBlockScripts(block *btcutil.Block, txStore TxStore) error {
// Setup the script validation flags. Blocks created after the BIP0016 // Setup the script validation flags. Blocks created after the BIP0016
// activation time need to have the pay-to-script-hash checks enabled. // activation time need to have the pay-to-script-hash checks enabled.
var flags btcscript.ScriptFlags var flags txscript.ScriptFlags
if block.MsgBlock().Header.Timestamp.After(btcscript.Bip16Activation) { if block.MsgBlock().Header.Timestamp.After(txscript.Bip16Activation) {
flags |= btcscript.ScriptBip16 flags |= txscript.ScriptBip16
} }
// Collect all of the transaction inputs and required information for // Collect all of the transaction inputs and required information for

View File

@ -12,8 +12,8 @@ import (
"time" "time"
"github.com/btcsuite/btcd/database" "github.com/btcsuite/btcd/database"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcnet" "github.com/btcsuite/btcnet"
"github.com/btcsuite/btcscript"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwire" "github.com/btcsuite/btcwire"
) )
@ -331,7 +331,7 @@ func CheckProofOfWork(block *btcutil.Block, powLimit *big.Int) error {
// CountSigOps returns the number of signature operations for all transaction // CountSigOps returns the number of signature operations for all transaction
// input and output scripts in the provided transaction. This uses the // input and output scripts in the provided transaction. This uses the
// quicker, but imprecise, signature operation counting mechanism from // quicker, but imprecise, signature operation counting mechanism from
// btcscript. // txscript.
func CountSigOps(tx *btcutil.Tx) int { func CountSigOps(tx *btcutil.Tx) int {
msgTx := tx.MsgTx() msgTx := tx.MsgTx()
@ -339,14 +339,14 @@ func CountSigOps(tx *btcutil.Tx) int {
// inputs. // inputs.
totalSigOps := 0 totalSigOps := 0
for _, txIn := range msgTx.TxIn { for _, txIn := range msgTx.TxIn {
numSigOps := btcscript.GetSigOpCount(txIn.SignatureScript) numSigOps := txscript.GetSigOpCount(txIn.SignatureScript)
totalSigOps += numSigOps totalSigOps += numSigOps
} }
// Accumulate the number of signature operations in all transaction // Accumulate the number of signature operations in all transaction
// outputs. // outputs.
for _, txOut := range msgTx.TxOut { for _, txOut := range msgTx.TxOut {
numSigOps := btcscript.GetSigOpCount(txOut.PkScript) numSigOps := txscript.GetSigOpCount(txOut.PkScript)
totalSigOps += numSigOps totalSigOps += numSigOps
} }
@ -355,8 +355,8 @@ func CountSigOps(tx *btcutil.Tx) int {
// CountP2SHSigOps returns the number of signature operations for all input // CountP2SHSigOps returns the number of signature operations for all input
// transactions which are of the pay-to-script-hash type. This uses the // transactions which are of the pay-to-script-hash type. This uses the
// precise, signature operation counting mechanism from btcscript which requires // precise, signature operation counting mechanism from the script engine which
// access to the input transaction scripts. // requires access to the input transaction scripts.
func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, txStore TxStore) (int, error) { func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, txStore TxStore) (int, error) {
// Coinbase transactions have no interesting inputs. // Coinbase transactions have no interesting inputs.
if isCoinBaseTx { if isCoinBaseTx {
@ -392,14 +392,14 @@ func CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool, txStore TxStore) (int, e
// We're only interested in pay-to-script-hash types, so skip // We're only interested in pay-to-script-hash types, so skip
// this input if it's not one. // this input if it's not one.
pkScript := originMsgTx.TxOut[originTxIndex].PkScript pkScript := originMsgTx.TxOut[originTxIndex].PkScript
if !btcscript.IsPayToScriptHash(pkScript) { if !txscript.IsPayToScriptHash(pkScript) {
continue continue
} }
// Count the precise number of signature operations in the // Count the precise number of signature operations in the
// referenced public key script. // referenced public key script.
sigScript := txIn.SignatureScript sigScript := txIn.SignatureScript
numSigOps := btcscript.GetPreciseSigOpCount(sigScript, pkScript, numSigOps := txscript.GetPreciseSigOpCount(sigScript, pkScript,
true) true)
// We could potentially overflow the accumulator so check for // We could potentially overflow the accumulator so check for
@ -817,10 +817,10 @@ func (b *BlockChain) checkConnectBlock(node *blockNode, block *btcutil.Block) er
// BIP0016 describes a pay-to-script-hash type that is considered a // BIP0016 describes a pay-to-script-hash type that is considered a
// "standard" type. The rules for this BIP only apply to transactions // "standard" type. The rules for this BIP only apply to transactions
// after the timestamp defined by btcscript.Bip16Activation. See // after the timestamp defined by txscript.Bip16Activation. See
// https://en.bitcoin.it/wiki/BIP_0016 for more details. // https://en.bitcoin.it/wiki/BIP_0016 for more details.
enforceBIP0016 := false enforceBIP0016 := false
if node.timestamp.After(btcscript.Bip16Activation) { if node.timestamp.After(txscript.Bip16Activation) {
enforceBIP0016 = true enforceBIP0016 = true
} }