mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-31 01:11:31 +00:00
Merge pull request #768 from guggero/send-outputs-watch-only
wallet: return unsigned TX in watch-only SendOutputs
This commit is contained in:
commit
541a8512cc
1 changed files with 11 additions and 0 deletions
|
@ -72,6 +72,10 @@ var (
|
|||
// to true.
|
||||
ErrTxLabelExists = errors.New("transaction already labelled")
|
||||
|
||||
// ErrTxUnsigned is returned when a transaction is created in the
|
||||
// watch-only mode where we can select coins but not sign any inputs.
|
||||
ErrTxUnsigned = errors.New("watch-only wallet, transaction not signed")
|
||||
|
||||
// Namespace bucket keys.
|
||||
waddrmgrNamespaceKey = []byte("waddrmgr")
|
||||
wtxmgrNamespaceKey = []byte("wtxmgr")
|
||||
|
@ -3209,6 +3213,13 @@ func (w *Wallet) SendOutputs(outputs []*wire.TxOut, keyScope *waddrmgr.KeyScope,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// If our wallet is read-only, we'll get a transaction with coins
|
||||
// selected but no witness data. In such a case we need to inform our
|
||||
// caller that they'll actually need to go ahead and sign the TX.
|
||||
if w.Manager.WatchOnly() {
|
||||
return createdTx.Tx, ErrTxUnsigned
|
||||
}
|
||||
|
||||
txHash, err := w.reliablyPublishTransaction(createdTx.Tx, label)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Reference in a new issue