From dfce82c102929e7231bfd18c5b6d48446f4eec2d Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 2 Jan 2024 15:50:14 +0100 Subject: [PATCH] Allow creating a transaction without unlocking the wallet IF transaction is unsigned --- pktwallet/wallet/wallet.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pktwallet/wallet/wallet.go b/pktwallet/wallet/wallet.go index 961d2b784f..941fed42b1 100644 --- a/pktwallet/wallet/wallet.go +++ b/pktwallet/wallet/wallet.go @@ -674,13 +674,19 @@ out: for { select { case txr := <-w.createTxRequests: - heldUnlock, err := w.holdUnlock() - if err != nil { - txr.resp <- createTxResponse{nil, err} - continue + var hu heldUnlock + if txr.req.SendMode > SendModeUnsigned { + h, err := w.holdUnlock() + if err != nil { + txr.resp <- createTxResponse{nil, err} + continue + } + hu = h } tx, err := w.txToOutputs(txr.req) - heldUnlock.release() + if hu != nil { + hu.release() + } txr.resp <- createTxResponse{tx, err} case <-quit: break out