diff --git a/attestation/attestclient.go b/attestation/attestclient.go index 1e58787..1592d55 100644 --- a/attestation/attestclient.go +++ b/attestation/attestclient.go @@ -439,12 +439,15 @@ func (w *AttestClient) SignTransaction(hash chainhash.Hash, msgTx wire.MsgTx) ( return nil, prevTxErr } - var inputs []btcjson.RawTxInput // new tx inputs - var keys []string // keys to sign inputs + var inputs []btcjson.RawTxWitnessInput // new tx inputs + var keys []string // keys to sign inputs // add prev attestation tx input info and priv key - inputs = append(inputs, btcjson.RawTxInput{prevTxId.String(), 0, - hex.EncodeToString(prevTx.MsgTx().TxOut[0].PkScript), ""}) + inputs = append(inputs, btcjson.RawTxWitnessInput{ + Txid: prevTxId.String(), + Vout: 0, + ScriptPubKey: hex.EncodeToString(prevTx.MsgTx().TxOut[0].PkScript), + }) keys = append(keys, key.String()) // for any remaining vins - sign with topup privkey @@ -456,14 +459,18 @@ func (w *AttestClient) SignTransaction(hash chainhash.Hash, msgTx wire.MsgTx) ( if prevTxErr != nil { return nil, prevTxErr } - inputs = append(inputs, btcjson.RawTxInput{prevTxId.String(), 0, - hex.EncodeToString(prevTx.MsgTx().TxOut[0].PkScript), w.scriptTopup}) + inputs = append(inputs, btcjson.RawTxWitnessInput{ + Txid: prevTxId.String(), + Vout: 0, + ScriptPubKey: hex.EncodeToString(prevTx.MsgTx().TxOut[0].PkScript), + RedeemScript: &w.scriptTopup, + }) keys = append(keys, w.WalletPrivTopup.String()) } // attempt to sign transcation with provided inputs - keys - signedMsgTx, _, errSign := w.MainClient.SignRawTransaction3( - &msgTx, inputs, keys) + signedMsgTx, _, errSign := w.MainClient.SignRawTransactionWithWallet2( + &msgTx, inputs) log.Infof("error: %v", errSign) if errSign != nil { return nil, errSign diff --git a/crypto/tweaking.go b/crypto/tweaking.go index e5c0211..9b8e501 100644 --- a/crypto/tweaking.go +++ b/crypto/tweaking.go @@ -140,7 +140,7 @@ func TweakExtendedKey(extndPubKey *hdkeychain.ExtendedKey, tweak []byte) (*hdkey childInt := binary.BigEndian.Uint32(childBytes) // get tweaked pubkey - extndPubKey, childErr = extndPubKey.Child(childInt) + extndPubKey, childErr = extndPubKey.Derive(childInt) if childErr != nil { return nil, childErr } diff --git a/go.mod b/go.mod index 5f448ef..c135a90 100644 --- a/go.mod +++ b/go.mod @@ -3,19 +3,26 @@ module mainstay go 1.20 require ( - github.com/btcsuite/btcd v0.20.0-beta - github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d - + github.com/btcsuite/btcd v0.22.0-beta + github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce go.mongodb.org/mongo-driver v1.3.1 ) require ( + github.com/aead/siphash v1.0.1 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect + github.com/btcsuite/goleveldb v1.0.0 // indirect + github.com/btcsuite/snappy-go v1.0.0 // indirect github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect + github.com/btcsuite/winsvc v1.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/decred/dcrd/lru v1.0.0 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/golang/snappy v0.0.1 // indirect + github.com/jessevdk/go-flags v1.4.0 // indirect + github.com/jrick/logrotate v1.0.0 // indirect + github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 // indirect github.com/klauspost/compress v1.9.5 // indirect github.com/pkg/errors v0.8.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -23,7 +30,7 @@ require ( github.com/stretchr/testify v1.8.4 // indirect github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc // indirect - golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5 // indirect + golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 // indirect golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect golang.org/x/text v0.3.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect