From f22b9ca70c867a02d6f578dc56d4997b7a4ff9c9 Mon Sep 17 00:00:00 2001 From: willcl-ark Date: Fri, 28 Jun 2024 12:41:57 +0100 Subject: [PATCH] wallet: fix FillPSBT errantly showing as complete Fix cases of calls to `FillPSBT` returning `complete=true` when it's not the case. This can happen when some inputs have been signed but the transaction is subsequently modified, e.g. in the context of PayJoins. Also fixes a related bug where a finalized hex string is attempted to be added during `walletprocesspsbt` but a CHECK_NONFATAL causes an abort. Reported in #30077. Github-Pull: #30357 Rebased-From: 39cea21ec51b9838669c38fefa14f25c36ae7096 --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 3ac09430d83..af85f561b6f 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2184,8 +2184,8 @@ TransactionError CWallet::FillPSBT(PartiallySignedTransaction& psbtx, bool& comp // Complete if every input is now signed complete = true; - for (const auto& input : psbtx.inputs) { - complete &= PSBTInputSigned(input); + for (size_t i = 0; i < psbtx.inputs.size(); ++i) { + complete &= PSBTInputSignedAndVerified(psbtx, i, &txdata); } return TransactionError::OK;