Update btcscript import paths to new location.
This commit is contained in:
parent
31149b88b9
commit
6d4889ffb0
10 changed files with 60 additions and 60 deletions
|
@ -17,7 +17,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/btcsuite/btcscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcwallet/chain"
|
"github.com/btcsuite/btcwallet/chain"
|
||||||
"github.com/btcsuite/btcwallet/keystore"
|
"github.com/btcsuite/btcwallet/keystore"
|
||||||
|
@ -99,7 +99,7 @@ func (w *Wallet) addReceivedTx(tx *btcutil.Tx, block *txstore.Block) error {
|
||||||
for txOutIdx, txOut := range tx.MsgTx().TxOut {
|
for txOutIdx, txOut := range tx.MsgTx().TxOut {
|
||||||
// Errors don't matter here. If addrs is nil, the range below
|
// Errors don't matter here. If addrs is nil, the range below
|
||||||
// does nothing.
|
// does nothing.
|
||||||
_, addrs, _, _ := btcscript.ExtractPkScriptAddrs(txOut.PkScript,
|
_, addrs, _, _ := txscript.ExtractPkScriptAddrs(txOut.PkScript,
|
||||||
activeNet.Params)
|
activeNet.Params)
|
||||||
insert := false
|
insert := false
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
|
|
22
createtx.go
22
createtx.go
|
@ -24,7 +24,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/btcsuite/btcchain"
|
"github.com/btcsuite/btcchain"
|
||||||
"github.com/btcsuite/btcscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcwallet/keystore"
|
"github.com/btcsuite/btcwallet/keystore"
|
||||||
"github.com/btcsuite/btcwallet/txstore"
|
"github.com/btcsuite/btcwallet/txstore"
|
||||||
|
@ -275,7 +275,7 @@ func createTx(
|
||||||
// addChange adds a new output with the given amount and address, and
|
// addChange adds a new output with the given amount and address, and
|
||||||
// randomizes the index (and returns it) of the newly added output.
|
// randomizes the index (and returns it) of the newly added output.
|
||||||
func addChange(msgtx *btcwire.MsgTx, change btcutil.Amount, changeAddr btcutil.Address) (int, error) {
|
func addChange(msgtx *btcwire.MsgTx, change btcutil.Amount, changeAddr btcutil.Address) (int, error) {
|
||||||
pkScript, err := btcscript.PayToAddrScript(changeAddr)
|
pkScript, err := txscript.PayToAddrScript(changeAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("cannot create txout script: %s", err)
|
return 0, fmt.Errorf("cannot create txout script: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -321,7 +321,7 @@ func addOutputs(msgtx *btcwire.MsgTx, pairs map[string]btcutil.Amount) (btcutil.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add output to spend amt to addr.
|
// Add output to spend amt to addr.
|
||||||
pkScript, err := btcscript.PayToAddrScript(addr)
|
pkScript, err := txscript.PayToAddrScript(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return minAmount, fmt.Errorf("cannot create txout script: %s", err)
|
return minAmount, fmt.Errorf("cannot create txout script: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -342,8 +342,8 @@ func (w *Wallet) findEligibleOutputs(minconf int, bs *keystore.BlockStamp) ([]tx
|
||||||
// signrawtransaction, and sendrawtransaction).
|
// signrawtransaction, and sendrawtransaction).
|
||||||
eligible := make([]txstore.Credit, 0, len(unspent))
|
eligible := make([]txstore.Credit, 0, len(unspent))
|
||||||
for i := range unspent {
|
for i := range unspent {
|
||||||
switch btcscript.GetScriptClass(unspent[i].TxOut().PkScript) {
|
switch txscript.GetScriptClass(unspent[i].TxOut().PkScript) {
|
||||||
case btcscript.PubKeyHashTy:
|
case txscript.PubKeyHashTy:
|
||||||
if !unspent[i].Confirmed(minconf, bs.Height) {
|
if !unspent[i].Confirmed(minconf, bs.Height) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -399,8 +399,8 @@ func signMsgTx(msgtx *btcwire.MsgTx, prevOutputs []txstore.Credit, store *keysto
|
||||||
return fmt.Errorf("cannot get private key: %v", err)
|
return fmt.Errorf("cannot get private key: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sigscript, err := btcscript.SignatureScript(
|
sigscript, err := txscript.SignatureScript(
|
||||||
msgtx, i, output.TxOut().PkScript, btcscript.SigHashAll, privkey, ai.Compressed())
|
msgtx, i, output.TxOut().PkScript, txscript.SigHashAll, privkey, ai.Compressed())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot create sigscript: %s", err)
|
return fmt.Errorf("cannot create sigscript: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -411,13 +411,13 @@ func signMsgTx(msgtx *btcwire.MsgTx, prevOutputs []txstore.Credit, store *keysto
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateMsgTx(msgtx *btcwire.MsgTx, prevOutputs []txstore.Credit) error {
|
func validateMsgTx(msgtx *btcwire.MsgTx, prevOutputs []txstore.Credit) error {
|
||||||
flags := btcscript.ScriptCanonicalSignatures | btcscript.ScriptStrictMultiSig
|
flags := txscript.ScriptCanonicalSignatures | txscript.ScriptStrictMultiSig
|
||||||
bip16 := time.Now().After(btcscript.Bip16Activation)
|
bip16 := time.Now().After(txscript.Bip16Activation)
|
||||||
if bip16 {
|
if bip16 {
|
||||||
flags |= btcscript.ScriptBip16
|
flags |= txscript.ScriptBip16
|
||||||
}
|
}
|
||||||
for i, txin := range msgtx.TxIn {
|
for i, txin := range msgtx.TxIn {
|
||||||
engine, err := btcscript.NewScript(
|
engine, err := txscript.NewScript(
|
||||||
txin.SignatureScript, prevOutputs[i].TxOut().PkScript, i, msgtx, flags)
|
txin.SignatureScript, prevOutputs[i].TxOut().PkScript, i, msgtx, flags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot create script engine: %s", err)
|
return fmt.Errorf("cannot create script engine: %s", err)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/btcsuite/btcscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcwallet/keystore"
|
"github.com/btcsuite/btcwallet/keystore"
|
||||||
"github.com/btcsuite/btcwallet/txstore"
|
"github.com/btcsuite/btcwallet/txstore"
|
||||||
|
@ -133,7 +133,7 @@ func checkOutputsMatch(t *testing.T, msgtx *btcwire.MsgTx, expected map[string]b
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Cannot decode address: %v", err)
|
t.Fatalf("Cannot decode address: %v", err)
|
||||||
}
|
}
|
||||||
pkScript, err := btcscript.PayToAddrScript(addr)
|
pkScript, err := txscript.PayToAddrScript(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Cannot create pkScript: %v", err)
|
t.Fatalf("Cannot create pkScript: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/btcsuite/btcscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcwallet/tx"
|
"github.com/btcsuite/btcwallet/tx"
|
||||||
"github.com/btcsuite/btcwire"
|
"github.com/btcsuite/btcwire"
|
||||||
|
@ -97,7 +97,7 @@ func TestFakeTxs(t *testing.T) {
|
||||||
|
|
||||||
// Create and add a fake Utxo so we have some funds to spend.
|
// Create and add a fake Utxo so we have some funds to spend.
|
||||||
//
|
//
|
||||||
// This will pass validation because btcscript is unaware of invalid
|
// This will pass validation because txcscript is unaware of invalid
|
||||||
// tx inputs, however, this example would fail in btcd.
|
// tx inputs, however, this example would fail in btcd.
|
||||||
utxo := &tx.Utxo{}
|
utxo := &tx.Utxo{}
|
||||||
addr, err := w.NextChainedAddress(&keystore.BlockStamp{}, 100)
|
addr, err := w.NextChainedAddress(&keystore.BlockStamp{}, 100)
|
||||||
|
@ -111,7 +111,7 @@ func TestFakeTxs(t *testing.T) {
|
||||||
28, 29, 30, 31, 32})
|
28, 29, 30, 31, 32})
|
||||||
out := btcwire.NewOutPoint(&ophash, 0)
|
out := btcwire.NewOutPoint(&ophash, 0)
|
||||||
utxo.Out = tx.OutPoint(*out)
|
utxo.Out = tx.OutPoint(*out)
|
||||||
ss, err := btcscript.PayToAddrScript(addr)
|
ss, err := txscript.PayToAddrScript(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Could not create utxo PkScript: %s", err)
|
t.Errorf("Could not create utxo PkScript: %s", err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -36,9 +36,9 @@ import (
|
||||||
|
|
||||||
"golang.org/x/crypto/ripemd160"
|
"golang.org/x/crypto/ripemd160"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcec"
|
"github.com/btcsuite/btcec"
|
||||||
"github.com/btcsuite/btcnet"
|
"github.com/btcsuite/btcnet"
|
||||||
"github.com/btcsuite/btcscript"
|
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcwallet/rename"
|
"github.com/btcsuite/btcwallet/rename"
|
||||||
"github.com/btcsuite/btcwire"
|
"github.com/btcsuite/btcwire"
|
||||||
|
@ -2764,7 +2764,7 @@ func (a *p2SHScript) WriteTo(w io.Writer) (n int64, err error) {
|
||||||
type scriptAddress struct {
|
type scriptAddress struct {
|
||||||
store *Store
|
store *Store
|
||||||
address btcutil.Address
|
address btcutil.Address
|
||||||
class btcscript.ScriptClass
|
class txscript.ScriptClass
|
||||||
addresses []btcutil.Address
|
addresses []btcutil.Address
|
||||||
reqSigs int
|
reqSigs int
|
||||||
flags scriptFlags
|
flags scriptFlags
|
||||||
|
@ -2782,7 +2782,7 @@ type ScriptAddress interface {
|
||||||
// Returns the script associated with the address.
|
// Returns the script associated with the address.
|
||||||
Script() []byte
|
Script() []byte
|
||||||
// Returns the class of the script associated with the address.
|
// Returns the class of the script associated with the address.
|
||||||
ScriptClass() btcscript.ScriptClass
|
ScriptClass() txscript.ScriptClass
|
||||||
// Returns the addresses that are required to sign transactions from the
|
// Returns the addresses that are required to sign transactions from the
|
||||||
// script address.
|
// script address.
|
||||||
Addresses() []btcutil.Address
|
Addresses() []btcutil.Address
|
||||||
|
@ -2794,7 +2794,7 @@ type ScriptAddress interface {
|
||||||
// iv must be 16 bytes, or nil (in which case it is randomly generated).
|
// iv must be 16 bytes, or nil (in which case it is randomly generated).
|
||||||
func newScriptAddress(s *Store, script []byte, bs *BlockStamp) (addr *scriptAddress, err error) {
|
func newScriptAddress(s *Store, script []byte, bs *BlockStamp) (addr *scriptAddress, err error) {
|
||||||
class, addresses, reqSigs, err :=
|
class, addresses, reqSigs, err :=
|
||||||
btcscript.ExtractPkScriptAddrs(script, s.netParams())
|
txscript.ExtractPkScriptAddrs(script, s.netParams())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -2885,7 +2885,7 @@ func (sa *scriptAddress) ReadFrom(r io.Reader) (n int64, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
class, addresses, reqSigs, err :=
|
class, addresses, reqSigs, err :=
|
||||||
btcscript.ExtractPkScriptAddrs(sa.script, sa.store.netParams())
|
txscript.ExtractPkScriptAddrs(sa.script, sa.store.netParams())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
@ -2972,7 +2972,7 @@ func (sa *scriptAddress) Addresses() []btcutil.Address {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScriptClass returns the type of script the address is.
|
// ScriptClass returns the type of script the address is.
|
||||||
func (sa *scriptAddress) ScriptClass() btcscript.ScriptClass {
|
func (sa *scriptAddress) ScriptClass() txscript.ScriptClass {
|
||||||
return sa.class
|
return sa.class
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcec"
|
"github.com/btcsuite/btcec"
|
||||||
"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"
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ func TestBtcAddressSerializer(t *testing.T) {
|
||||||
|
|
||||||
func TestScriptAddressSerializer(t *testing.T) {
|
func TestScriptAddressSerializer(t *testing.T) {
|
||||||
fakeWallet := &Store{net: (*netParams)(tstNetParams)}
|
fakeWallet := &Store{net: (*netParams)(tstNetParams)}
|
||||||
script := []byte{btcscript.OP_TRUE, btcscript.OP_DUP,
|
script := []byte{txscript.OP_TRUE, txscript.OP_DUP,
|
||||||
btcscript.OP_DROP}
|
txscript.OP_DROP}
|
||||||
addr, err := newScriptAddress(fakeWallet, script, makeBS(0))
|
addr, err := newScriptAddress(fakeWallet, script, makeBS(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err.Error())
|
t.Error(err.Error())
|
||||||
|
@ -878,8 +878,8 @@ func TestImportScript(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
script := []byte{btcscript.OP_TRUE, btcscript.OP_DUP,
|
script := []byte{txscript.OP_TRUE, txscript.OP_DUP,
|
||||||
btcscript.OP_DROP}
|
txscript.OP_DROP}
|
||||||
importHeight := int32(50)
|
importHeight := int32(50)
|
||||||
stamp := makeBS(importHeight)
|
stamp := makeBS(importHeight)
|
||||||
address, err := w.ImportScript(script, stamp)
|
address, err := w.ImportScript(script, stamp)
|
||||||
|
@ -901,7 +901,7 @@ func TestImportScript(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if sinfo.ScriptClass() != btcscript.NonStandardTy {
|
if sinfo.ScriptClass() != txscript.NonStandardTy {
|
||||||
t.Error("script type incorrect.")
|
t.Error("script type incorrect.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
44
rpcserver.go
44
rpcserver.go
|
@ -37,10 +37,10 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcec"
|
"github.com/btcsuite/btcec"
|
||||||
"github.com/btcsuite/btcjson"
|
"github.com/btcsuite/btcjson"
|
||||||
"github.com/btcsuite/btcrpcclient"
|
"github.com/btcsuite/btcrpcclient"
|
||||||
"github.com/btcsuite/btcscript"
|
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcwallet/chain"
|
"github.com/btcsuite/btcwallet/chain"
|
||||||
"github.com/btcsuite/btcwallet/keystore"
|
"github.com/btcsuite/btcwallet/keystore"
|
||||||
|
@ -1570,7 +1570,7 @@ func makeMultiSigScript(w *Wallet, keys []string, nRequired int) ([]byte, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return btcscript.MultiSigScript(keysesPrecious, nRequired)
|
return txscript.MultiSigScript(keysesPrecious, nRequired)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddMultiSigAddress handles an addmultisigaddress request by adding a
|
// AddMultiSigAddress handles an addmultisigaddress request by adding a
|
||||||
|
@ -2699,24 +2699,24 @@ func SignRawTransaction(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hashType := btcscript.SigHashAll
|
hashType := txscript.SigHashAll
|
||||||
if cmd.Flags != "" {
|
if cmd.Flags != "" {
|
||||||
switch cmd.Flags {
|
switch cmd.Flags {
|
||||||
case "ALL":
|
case "ALL":
|
||||||
hashType = btcscript.SigHashAll
|
hashType = txscript.SigHashAll
|
||||||
case "NONE":
|
case "NONE":
|
||||||
hashType = btcscript.SigHashNone
|
hashType = txscript.SigHashNone
|
||||||
case "SINGLE":
|
case "SINGLE":
|
||||||
hashType = btcscript.SigHashSingle
|
hashType = txscript.SigHashSingle
|
||||||
case "ALL|ANYONECANPAY":
|
case "ALL|ANYONECANPAY":
|
||||||
hashType = btcscript.SigHashAll |
|
hashType = txscript.SigHashAll |
|
||||||
btcscript.SigHashAnyOneCanPay
|
txscript.SigHashAnyOneCanPay
|
||||||
case "NONE|ANYONECANPAY":
|
case "NONE|ANYONECANPAY":
|
||||||
hashType = btcscript.SigHashNone |
|
hashType = txscript.SigHashNone |
|
||||||
btcscript.SigHashAnyOneCanPay
|
txscript.SigHashAnyOneCanPay
|
||||||
case "SINGLE|ANYONECANPAY":
|
case "SINGLE|ANYONECANPAY":
|
||||||
hashType = btcscript.SigHashSingle |
|
hashType = txscript.SigHashSingle |
|
||||||
btcscript.SigHashAnyOneCanPay
|
txscript.SigHashAnyOneCanPay
|
||||||
default:
|
default:
|
||||||
e := errors.New("Invalid sighash parameter")
|
e := errors.New("Invalid sighash parameter")
|
||||||
return nil, InvalidParameterError{e}
|
return nil, InvalidParameterError{e}
|
||||||
|
@ -2762,9 +2762,9 @@ func SignRawTransaction(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (in
|
||||||
txIn.PreviousOutPoint.Index)
|
txIn.PreviousOutPoint.Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up our callbacks that we pass to btcscript so it can
|
// Set up our callbacks that we pass to txscript so it can
|
||||||
// look up the appropriate keys and scripts by address.
|
// look up the appropriate keys and scripts by address.
|
||||||
getKey := btcscript.KeyClosure(func(addr btcutil.Address) (
|
getKey := txscript.KeyClosure(func(addr btcutil.Address) (
|
||||||
*btcec.PrivateKey, bool, error) {
|
*btcec.PrivateKey, bool, error) {
|
||||||
if len(keys) != 0 {
|
if len(keys) != 0 {
|
||||||
wif, ok := keys[addr.EncodeAddress()]
|
wif, ok := keys[addr.EncodeAddress()]
|
||||||
|
@ -2793,7 +2793,7 @@ func SignRawTransaction(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (in
|
||||||
return key, pka.Compressed(), nil
|
return key, pka.Compressed(), nil
|
||||||
})
|
})
|
||||||
|
|
||||||
getScript := btcscript.ScriptClosure(func(
|
getScript := txscript.ScriptClosure(func(
|
||||||
addr btcutil.Address) ([]byte, error) {
|
addr btcutil.Address) ([]byte, error) {
|
||||||
// If keys were provided then we can only use the
|
// If keys were provided then we can only use the
|
||||||
// scripts provided with our inputs, too.
|
// scripts provided with our inputs, too.
|
||||||
|
@ -2824,10 +2824,10 @@ func SignRawTransaction(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (in
|
||||||
// SigHashSingle inputs can only be signed if there's a
|
// SigHashSingle inputs can only be signed if there's a
|
||||||
// corresponding output. However this could be already signed,
|
// corresponding output. However this could be already signed,
|
||||||
// so we always verify the output.
|
// so we always verify the output.
|
||||||
if (hashType&btcscript.SigHashSingle) !=
|
if (hashType&txscript.SigHashSingle) !=
|
||||||
btcscript.SigHashSingle || i < len(msgTx.TxOut) {
|
txscript.SigHashSingle || i < len(msgTx.TxOut) {
|
||||||
|
|
||||||
script, err := btcscript.SignTxOutput(activeNet.Params,
|
script, err := txscript.SignTxOutput(activeNet.Params,
|
||||||
msgTx, i, input, hashType, getKey,
|
msgTx, i, input, hashType, getKey,
|
||||||
getScript, txIn.SignatureScript)
|
getScript, txIn.SignatureScript)
|
||||||
// Failure to sign isn't an error, it just means that
|
// Failure to sign isn't an error, it just means that
|
||||||
|
@ -2841,9 +2841,9 @@ func SignRawTransaction(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (in
|
||||||
|
|
||||||
// Either it was already signed or we just signed it.
|
// Either it was already signed or we just signed it.
|
||||||
// Find out if it is completely satisfied or still needs more.
|
// Find out if it is completely satisfied or still needs more.
|
||||||
flags := btcscript.ScriptBip16 | btcscript.ScriptCanonicalSignatures |
|
flags := txscript.ScriptBip16 | txscript.ScriptCanonicalSignatures |
|
||||||
btcscript.ScriptStrictMultiSig
|
txscript.ScriptStrictMultiSig
|
||||||
engine, err := btcscript.NewScript(txIn.SignatureScript, input,
|
engine, err := txscript.NewScript(txIn.SignatureScript, input,
|
||||||
i, msgTx, flags)
|
i, msgTx, flags)
|
||||||
if err != nil || engine.Execute() != nil {
|
if err != nil || engine.Execute() != nil {
|
||||||
complete = false
|
complete = false
|
||||||
|
@ -2905,7 +2905,7 @@ func ValidateAddress(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (inter
|
||||||
class := sa.ScriptClass()
|
class := sa.ScriptClass()
|
||||||
// script type
|
// script type
|
||||||
result.Script = class.String()
|
result.Script = class.String()
|
||||||
if class == btcscript.MultiSigTy {
|
if class == txscript.MultiSigTy {
|
||||||
result.SigsRequired = int32(sa.RequiredSigs())
|
result.SigsRequired = int32(sa.RequiredSigs())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@ package txstore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/btcsuite/btcchain"
|
"github.com/btcsuite/btcchain"
|
||||||
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcjson"
|
"github.com/btcsuite/btcjson"
|
||||||
"github.com/btcsuite/btcnet"
|
"github.com/btcsuite/btcnet"
|
||||||
"github.com/btcsuite/btcscript"
|
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ func (d Debits) toJSON(account string, chainHeight int32,
|
||||||
|
|
||||||
for _, txOut := range msgTx.TxOut {
|
for _, txOut := range msgTx.TxOut {
|
||||||
address := ""
|
address := ""
|
||||||
_, addrs, _, _ := btcscript.ExtractPkScriptAddrs(txOut.PkScript, net)
|
_, addrs, _, _ := txscript.ExtractPkScriptAddrs(txOut.PkScript, net)
|
||||||
if len(addrs) == 1 {
|
if len(addrs) == 1 {
|
||||||
address = addrs[0].EncodeAddress()
|
address = addrs[0].EncodeAddress()
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ func (c Credit) toJSON(account string, chainHeight int32,
|
||||||
txout := msgTx.TxOut[c.OutputIndex]
|
txout := msgTx.TxOut[c.OutputIndex]
|
||||||
|
|
||||||
var address string
|
var address string
|
||||||
_, addrs, _, _ := btcscript.ExtractPkScriptAddrs(txout.PkScript, net)
|
_, addrs, _, _ := txscript.ExtractPkScriptAddrs(txout.PkScript, net)
|
||||||
if len(addrs) == 1 {
|
if len(addrs) == 1 {
|
||||||
address = addrs[0].EncodeAddress()
|
address = addrs[0].EncodeAddress()
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/btcsuite/btcchain"
|
"github.com/btcsuite/btcchain"
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
|
@ -1420,7 +1420,7 @@ func (d Debits) Fee() btcutil.Amount {
|
||||||
|
|
||||||
// Addresses parses the pubkey script, extracting all addresses for a
|
// Addresses parses the pubkey script, extracting all addresses for a
|
||||||
// standard script.
|
// standard script.
|
||||||
func (c Credit) Addresses(net *btcnet.Params) (btcscript.ScriptClass,
|
func (c Credit) Addresses(net *btcnet.Params) (txscript.ScriptClass,
|
||||||
[]btcutil.Address, int, error) {
|
[]btcutil.Address, int, error) {
|
||||||
|
|
||||||
c.s.mtx.RLock()
|
c.s.mtx.RLock()
|
||||||
|
@ -1428,7 +1428,7 @@ func (c Credit) Addresses(net *btcnet.Params) (btcscript.ScriptClass,
|
||||||
|
|
||||||
msgTx := c.Tx().MsgTx()
|
msgTx := c.Tx().MsgTx()
|
||||||
pkScript := msgTx.TxOut[c.OutputIndex].PkScript
|
pkScript := msgTx.TxOut[c.OutputIndex].PkScript
|
||||||
return btcscript.ExtractPkScriptAddrs(pkScript, net)
|
return txscript.ExtractPkScriptAddrs(pkScript, net)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change returns whether the credit is the result of a change output.
|
// Change returns whether the credit is the result of a change output.
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/btcsuite/btcscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcutil/hdkeychain"
|
"github.com/btcsuite/btcutil/hdkeychain"
|
||||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||||
|
@ -521,7 +521,7 @@ func (vp *Pool) DepositScript(seriesID, branch, index uint32) ([]byte, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
script, err := btcscript.MultiSigScript(pks, int(series.reqSigs))
|
script, err := txscript.MultiSigScript(pks, int(series.reqSigs))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
str := fmt.Sprintf("error while making multisig script hash, %d", len(pks))
|
str := fmt.Sprintf("error while making multisig script hash, %d", len(pks))
|
||||||
return nil, managerError(waddrmgr.ErrScriptCreation, str, err)
|
return nil, managerError(waddrmgr.ErrScriptCreation, str, err)
|
||||||
|
|
Loading…
Reference in a new issue