Merge bitcoin/bitcoin#36012: psbt: Remove unused IsNull() methods

2c16efbb7b psbt: Remove unused IsNull() methods (nebula-21)

Pull request description:

  This PR removes the `IsNull()` methods from `PartiallySignedTransaction`, `PSBTInput`, and `PSBTOutput`, along with their calls from the fuzz target.

  This methods have no production callers, their only callers are the fuzz target. As such, keeping these methods seems not useful.

  The motivation for this PR came from jeanpablojp's comment on [#35848](https://github.com/bitcoin/bitcoin/pull/35848#issuecomment-5274013825), added him as coauthor.

ACKs for top commit:
  maflcko:
    review ACK 2c16efbb7b 🥑
  vicjuma:
    ACK 2c16efbb7b
  sedited:
    ACK 2c16efbb7b

Tree-SHA512: 129933ae9803a2d053e340ee2a85efd1e5d9e5e38833fac0a0a9cbd467fec3157087959c464a8eeedb04ea99b1e5d7eba5a2fafde2e78a4fabcd247fac855477
This commit is contained in:
merge-script
2026-08-19 18:30:06 +02:00
3 changed files with 0 additions and 21 deletions

View File

@@ -31,11 +31,6 @@ PartiallySignedTransaction::PartiallySignedTransaction(const CMutableTransaction
}
}
bool PartiallySignedTransaction::IsNull() const
{
return inputs.empty() && outputs.empty() && unknown.empty();
}
bool PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt)
{
// Prohibited to merge two PSBTs over different transactions
@@ -289,11 +284,6 @@ COutPoint PSBTInput::GetOutPoint() const
return COutPoint(prev_txid, prev_out);
}
bool PSBTInput::IsNull() const
{
return !non_witness_utxo && witness_utxo.IsNull() && partial_sigs.empty() && unknown.empty() && hd_keypaths.empty() && redeem_script.empty() && witness_script.empty();
}
void PSBTInput::FillSignatureData(SignatureData& sigdata) const
{
if (!final_script_sig.empty()) {
@@ -528,11 +518,6 @@ void PSBTOutput::FromSignatureData(const SignatureData& sigdata)
m_musig2_participants.insert(sigdata.musig2_pubkeys.begin(), sigdata.musig2_pubkeys.end());
}
bool PSBTOutput::IsNull() const
{
return redeem_script.empty() && witness_script.empty() && hd_keypaths.empty() && unknown.empty();
}
bool PSBTOutput::Merge(const PSBTOutput& output)
{
hd_keypaths.insert(output.hd_keypaths.begin(), output.hd_keypaths.end());

View File

@@ -321,7 +321,6 @@ public:
std::set<PSBTProprietary> m_proprietary;
std::optional<int> sighash_type;
bool IsNull() const;
void FillSignatureData(SignatureData& sigdata) const;
void FromSignatureData(const SignatureData& sigdata);
[[nodiscard]] bool Merge(const PSBTInput& input);
@@ -956,7 +955,6 @@ public:
CAmount amount;
CScript script;
bool IsNull() const;
void FillSignatureData(SignatureData& sigdata) const;
void FromSignatureData(const SignatureData& sigdata);
[[nodiscard]] bool Merge(const PSBTOutput& output);
@@ -1254,7 +1252,6 @@ public:
uint32_t tx_version;
std::optional<uint32_t> fallback_locktime;
bool IsNull() const;
uint32_t GetVersion() const;
/** Merge psbt into this. The two psbts must have the same underlying CTransaction (i.e. the

View File

@@ -54,12 +54,10 @@ FUZZ_TARGET(psbt)
(void)PSBTRoleName(input_analysis.next);
}
(void)psbt.IsNull();
(void)psbt.GetUnsignedTx();
for (const PSBTInput& input : psbt.inputs) {
(void)PSBTInputSigned(input);
(void)input.IsNull();
PSBTInput input_mod = input;
CTxOut tx_out;
if (input.GetUTXO(tx_out)) {
@@ -96,7 +94,6 @@ FUZZ_TARGET(psbt)
(void)CountPSBTUnsignedInputs(psbt);
for (const PSBTOutput& output : psbt.outputs) {
(void)output.IsNull();
PSBTOutput output_mod = output;
// A PSBT output must roundtrip to signature data.
PSBTOutput output_fill{psbt_version, output_mod.amount, output_mod.script};