wallet: export ScriptForOutput
We need to be able to call ScriptForOutput in external code, so we export it.
This commit is contained in:
parent
6eede89a43
commit
f2ec9f1ec8
2 changed files with 4 additions and 4 deletions
|
@ -117,7 +117,7 @@ func (w *Wallet) FundPsbt(packet *psbt.Packet, keyScope *waddrmgr.KeyScope,
|
||||||
// For nested P2WKH we need to add the redeem script to
|
// For nested P2WKH we need to add the redeem script to
|
||||||
// the input, otherwise an offline wallet won't be able
|
// the input, otherwise an offline wallet won't be able
|
||||||
// to sign for it. For normal P2WKH this will be nil.
|
// to sign for it. For normal P2WKH this will be nil.
|
||||||
addr, witnessProgram, _, err := w.scriptForOutput(utxo)
|
addr, witnessProgram, _, err := w.ScriptForOutput(utxo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error fetching UTXO "+
|
return fmt.Errorf("error fetching UTXO "+
|
||||||
"script: %v", err)
|
"script: %v", err)
|
||||||
|
|
|
@ -14,10 +14,10 @@ import (
|
||||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||||
)
|
)
|
||||||
|
|
||||||
// scriptForOutput returns the address, witness program and redeem script for a
|
// ScriptForOutput returns the address, witness program and redeem script for a
|
||||||
// given UTXO. An error is returned if the UTXO does not belong to our wallet or
|
// given UTXO. An error is returned if the UTXO does not belong to our wallet or
|
||||||
// it is not a managed pubKey address.
|
// it is not a managed pubKey address.
|
||||||
func (w *Wallet) scriptForOutput(output *wire.TxOut) (
|
func (w *Wallet) ScriptForOutput(output *wire.TxOut) (
|
||||||
waddrmgr.ManagedPubKeyAddress, []byte, []byte, error) {
|
waddrmgr.ManagedPubKeyAddress, []byte, []byte, error) {
|
||||||
|
|
||||||
// First make sure we can sign for the input by making sure the script
|
// First make sure we can sign for the input by making sure the script
|
||||||
|
@ -92,7 +92,7 @@ func (w *Wallet) ComputeInputScript(tx *wire.MsgTx, output *wire.TxOut,
|
||||||
hashType txscript.SigHashType, tweaker PrivKeyTweaker) (wire.TxWitness,
|
hashType txscript.SigHashType, tweaker PrivKeyTweaker) (wire.TxWitness,
|
||||||
[]byte, error) {
|
[]byte, error) {
|
||||||
|
|
||||||
walletAddr, witnessProgram, sigScript, err := w.scriptForOutput(output)
|
walletAddr, witnessProgram, sigScript, err := w.ScriptForOutput(output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue