wallet: don't hold unlock in watch-only mode
If we're running in watch-only mode, there is no unlock possible. Therefore, we also don't need to prevent any unlocks from happening when doing coin selection in that mode.
This commit is contained in:
parent
cdf737027b
commit
47a13774bb
1 changed files with 15 additions and 5 deletions
|
@ -1169,17 +1169,27 @@ out:
|
|||
for {
|
||||
select {
|
||||
case txr := <-w.createTxRequests:
|
||||
heldUnlock, err := w.holdUnlock()
|
||||
if err != nil {
|
||||
txr.resp <- createTxResponse{nil, err}
|
||||
continue
|
||||
// If the wallet can be locked because it contains
|
||||
// private key material, we need to prevent it from
|
||||
// doing so while we are assembling the transaction.
|
||||
release := func() {}
|
||||
if !w.Manager.WatchOnly() {
|
||||
heldUnlock, err := w.holdUnlock()
|
||||
if err != nil {
|
||||
txr.resp <- createTxResponse{nil, err}
|
||||
continue
|
||||
}
|
||||
|
||||
release = heldUnlock.release
|
||||
}
|
||||
|
||||
tx, err := w.txToOutputs(
|
||||
txr.outputs, txr.keyScope, txr.account,
|
||||
txr.minconf, txr.feeSatPerKB,
|
||||
txr.coinSelectionStrategy, txr.dryRun,
|
||||
)
|
||||
heldUnlock.release()
|
||||
|
||||
release()
|
||||
txr.resp <- createTxResponse{tx, err}
|
||||
case <-quit:
|
||||
break out
|
||||
|
|
Loading…
Reference in a new issue