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.
This commit is contained in:
willcl-ark 2024-06-28 12:41:57 +01:00
parent 04d63fb8c3
commit 39cea21ec5
No known key found for this signature in database
GPG key ID: CE6EC49945C17EA6

View file

@ -2225,8 +2225,8 @@ std::optional<PSBTError> CWallet::FillPSBT(PartiallySignedTransaction& psbtx, bo
// 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 {};