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: 39cea21ec5
This commit is contained in:
willcl-ark 2024-06-28 12:41:57 +01:00 committed by fanquake
parent 05192ba84c
commit f22b9ca70c
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -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;