From bc32ff6057ce423e6c208d9f5c8c6c27ec871cbf Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 17 Feb 2023 16:29:49 -0500 Subject: [PATCH] BIP341 txdata cannot be precomputed without spent outputs Github-Pull: #27122 Rebased-From: 95f12de92505522a32ba58acd5251c69e602d160 (cherry picked from commit 95f12de92505522a32ba58acd5251c69e602d160) --- src/script/interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index ce08a5544a0..09ce746f0ba 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -2585,7 +2585,7 @@ void PrecomputedTransactionData::Init(const T& txTo, std::vector&& spent hashRangeproofs = GetRangeproofsHash(txTo); m_bip143_segwit_ready = true; } - if (uses_bip341_taproot) { + if (uses_bip341_taproot && m_spent_outputs_ready) { // line copied from GetTransactionWeight() in src/consensus/validation.h // (we cannot directly use that function for type reasons) m_tx_weight = ::GetSerializeSize(txTo, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * (WITNESS_SCALE_FACTOR - 1) + ::GetSerializeSize(txTo, PROTOCOL_VERSION);