From 1dba05e7f6b188e2fb4183037aaf27cfb1bff916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Wed, 6 May 2026 14:27:13 +0200 Subject: [PATCH] wallet: use outpoint when estimating input size `CalculateMaximumSignedInputSize()` is passed the outpoint being sized, but that context was not used when estimating the signed input size. Pass the outpoint through so externally selected inputs are not underestimated. Co-authored-by: Antoine Poinsot Github-Pull: #35228 Rebased-From: cd8d3bd937b5515ea000408eb07d2ae3cd1aa417 --- src/wallet/spend.cpp | 2 +- src/wallet/test/spend_tests.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index dc34060d729..9524e7a0bec 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -94,7 +94,7 @@ int CalculateMaximumSignedInputSize(const CTxOut& txout, const COutPoint outpoin if (!provider) return -1; if (const auto desc = InferDescriptor(txout.scriptPubKey, *provider)) { - if (const auto weight = MaxInputWeight(*desc, {}, coin_control, true, can_grind_r)) { + if (const auto weight = MaxInputWeight(*desc, CTxIn{outpoint}, coin_control, true, can_grind_r)) { return static_cast(GetVirtualTransactionSize(*weight, 0, 0)); } } diff --git a/src/wallet/test/spend_tests.cpp b/src/wallet/test/spend_tests.cpp index 963c0f838b1..ac76fe4dda0 100644 --- a/src/wallet/test/spend_tests.cpp +++ b/src/wallet/test/spend_tests.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include +#include #include #include