test: updated different_key to be different_field and also used a single assert_equal with 3 args instead of multiple assert_equals
What changed, and why it matters
This is a minor cleanup of a Bitcoin Core test file. It renames a helper function parameter from 'different_key' to 'different_field' and combines two separate length checks into one three-argument equality assertion. There is no change to production code, no security fix, and no behavior change in what the test verifies.
No action needed. This is a non-security test refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies only test/functional/wallet_musig.py. It renames the parameter ‘different_key’ to ‘different_field’ in assert_musig_signer_data and updates its single usage. It also replaces two consecutive assert_equal calls checking the lengths of musig2_pubnonces and musig2_partial_sigs with a single assert_equal(a, b, c) call. The test logic remains identical: it still checks that two decoded PSBTs have the same number of entries and that the expected count matches.
Changed components
test/functional/wallet_musig.pyInspect captured patch +4 / −6
diff --git a/test/functional/wallet_musig.py b/test/functional/wallet_musig.py
index c392abaf..fbf0558e 100755
--- a/test/functional/wallet_musig.py
+++ b/test/functional/wallet_musig.py
@@ -112,7 +112,7 @@ class WalletMuSigTest(BitcoinTestFramework):
return wallets, psbt
- def assert_musig_signer_data(self, first, second, different_key):
+ def assert_musig_signer_data(self, first, second, different_field):
assert_equal(first["participant_pubkey"], second["participant_pubkey"])
assert_equal(first["aggregate_pubkey"], second["aggregate_pubkey"])
if "leaf_hash" in first:
@@ -120,7 +120,7 @@ class WalletMuSigTest(BitcoinTestFramework):
else:
assert "leaf_hash" not in second
- assert_not_equal(first[different_key], second[different_key])
+ assert_not_equal(first[different_field], second[different_field])
def assert_musig_aggregate_in_script(self, signer_data, pattern, psbtin):
pubkey = signer_data["aggregate_pubkey"][2:]
@@ -290,8 +290,7 @@ class WalletMuSigTest(BitcoinTestFramework):
dec_psbt = self.nodes[0].decodepsbt(comb_nonce_psbt)
dec_psbt2 = self.nodes[0].decodepsbt(comb_nonce_psbt2)
- assert_equal(len(dec_psbt["inputs"][0]["musig2_pubnonces"]), expected_pubnonces)
- assert_equal(len(dec_psbt2["inputs"][0]["musig2_pubnonces"]), expected_pubnonces)
+ assert_equal(len(dec_psbt["inputs"][0]["musig2_pubnonces"]), len(dec_psbt2["inputs"][0]["musig2_pubnonces"]), expected_pubnonces)
for pn, pn2 in zip(dec_psbt["inputs"][0]["musig2_pubnonces"], dec_psbt2["inputs"][0]["musig2_pubnonces"]):
self.assert_musig_signer_data(pn, pn2, "pubnonce")
self.assert_musig_aggregate_in_script(pn, pattern, dec_psbt["inputs"][0])
@@ -312,8 +311,7 @@ class WalletMuSigTest(BitcoinTestFramework):
dec_psbt = self.nodes[0].decodepsbt(comb_psig_psbt)
dec_psbt2 = self.nodes[0].decodepsbt(comb_psig_psbt2)
- assert_equal(len(dec_psbt["inputs"][0]["musig2_partial_sigs"]), expected_partial_sigs)
- assert_equal(len(dec_psbt2["inputs"][0]["musig2_partial_sigs"]), expected_partial_sigs)
+ assert_equal(len(dec_psbt["inputs"][0]["musig2_partial_sigs"]), len(dec_psbt2["inputs"][0]["musig2_partial_sigs"]), expected_partial_sigs)
for ps, ps2 in zip(dec_psbt["inputs"][0]["musig2_partial_sigs"], dec_psbt2["inputs"][0]["musig2_partial_sigs"]):
self.assert_musig_signer_data(ps, ps2, "partial_sig")
self.assert_musig_aggregate_in_script(ps, pattern, dec_psbt["inputs"][0])
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.