Merge bitcoin/bitcoin#36012: psbt: Remove unused `IsNull()` methods
What changed, and why it matters
This commit simply removes three unused helper methods named IsNull() from the PSBT (Partially Signed Bitcoin Transaction) code, along with their only callers in a fuzz test. There is no security fix here; it is routine code cleanup.
No action required; this is a non-security refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes IsNull() implementations from PartiallySignedTransaction, PSBTInput, and PSBTOutput, and removes the corresponding calls in src/test/fuzz/psbt.cpp. The PR description states these methods have no production callers and only existed for the fuzz target. No logic changes, no bug fixes, no security relevance.
Changed components
src/psbt.cppsrc/psbt.hsrc/test/fuzz/psbt.cppInspect captured patch +0 / −21
### src/psbt.cpp
@@ -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());
### src/psbt.h
@@ -321,7 +321,6 @@ class PSBTInput
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 @@ class PSBTOutput
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 @@ class PartiallySignedTransaction
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
### src/test/fuzz/psbt.cpp
@@ -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};Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.