From bf2eb667fb4dea8191a8f4f04b99a7271a339b6e Mon Sep 17 00:00:00 2001 From: ivanlele Date: Wed, 18 Mar 2026 12:14:06 +0000 Subject: [PATCH] Fix PSBT validation --- src/psbt.h | 2 +- src/qt/test/wallettests.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/psbt.h b/src/psbt.h index d55e3fe32d..99ee2b0602 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -2024,7 +2024,7 @@ struct PartiallySignedTransaction // Make sure that all scriptSigs and scriptWitnesses are empty for (unsigned int i = 0; i < tx->vin.size(); i++) { const CTxIn& txin = tx->vin[i]; - if (!txin.scriptSig.empty() || !tx->witness.vtxinwit[i].scriptWitness.IsNull()) { + if (!txin.scriptSig.empty() || (i < tx->witness.vtxinwit.size() && !tx->witness.vtxinwit[i].scriptWitness.IsNull())) { throw std::ios_base::failure("Unsigned tx does not have empty scriptSigs and scriptWitnesses."); } } diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 91eb14d5b5..d463cfafa5 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -447,7 +447,7 @@ void TestGUIWatchOnly(interfaces::Node& node, TestChain100Setup& test) QVERIFY(decoded_psbt); PartiallySignedTransaction psbt; std::string err; - // QVERIFY(DecodeRawPSBT(psbt, MakeByteSpan(*decoded_psbt), err)); // ELEMENTS FIXME: psbt + QVERIFY(DecodeRawPSBT(psbt, MakeByteSpan(*decoded_psbt), err)); } void TestGUI(interfaces::Node& node)