In PrecomputedTransactionData::Init
, if force
is set to true
, m_bip341_taproot_ready
is always set to true, suggesting that all its BIP341-relevant members (including m_spent_amounts_single_hash
) are correct. If however no spent
array of spent previous CTxOut
s is provided, some of these members will be incorrect. This option was introduced in #21365.
That doesn’t actually hurt, as without prevout data, it’s fundamentally impossible to generate correct BIP341 signatures anyway, and https://github.com/bitcoin/bitcoin/blob/f722a9bd132222d9d5cd503b5af25c905b205cdb/src/script/sign.cpp#L71 should prevent the logic from being used anyway.
Still, don’t set m_bip341_taproot_ready
variable when we clearly don’t have enough data to compute it.
Discovered by Russell O’Connor.