Pluralize change_data's claimed keys

claimed_fingerprints and claimed_derivation_paths each hold a list
(one entry per cosigner), so the singular key names misread at their
call sites. Also drop a commented-out debugging print.
This commit is contained in:
kdmukai
2026-08-22 10:46:22 -05:00
parent 622a9fed1f
commit 4f00d32fc8
3 changed files with 14 additions and 15 deletions
+2 -2
View File
@@ -277,8 +277,8 @@ class PSBTParser():
"output_index": i,
"address": addr,
"amount": vout[i].value,
"claimed_fingerprint": claimed_fingerprints,
"claimed_derivation_path": claimed_derivation_paths,
"claimed_fingerprints": claimed_fingerprints,
"claimed_derivation_paths": claimed_derivation_paths,
})
self.change_amount += vout[i].value
+8 -9
View File
@@ -116,16 +116,15 @@ class PSBTOverviewView(View):
{
'address': 'bc1q............',
'amount': 397621401,
'claimed_fingerprint': ['22bde1a9', '73c5da0a'],
'claimed_derivation_path': ['m/48h/1h/0h/2h/1/0', 'm/48h/1h/0h/2h/1/0']
'claimed_fingerprints': ['22bde1a9', '73c5da0a'],
'claimed_derivation_paths': ['m/48h/1h/0h/2h/1/0', 'm/48h/1h/0h/2h/1/0']
}, {},
]
"""
num_change_outputs = 0
num_self_transfer_outputs = 0
for change_output in change_data:
# print(f"""{change_output["claimed_derivation_path"][0]}""")
if change_output["claimed_derivation_path"][0].split("/")[-2] == "1":
if change_output["claimed_derivation_paths"][0].split("/")[-2] == "1":
num_change_outputs += 1
else:
num_self_transfer_outputs += 1
@@ -325,8 +324,8 @@ class PSBTChangeDetailsView(View):
{
'address': 'bc1q............',
'amount': 397621401,
'claimed_fingerprint': ['22bde1a9', '73c5da0a'],
'claimed_derivation_path': ['m/48h/1h/0h/2h/1/0', 'm/48h/1h/0h/2h/1/0']
'claimed_fingerprints': ['22bde1a9', '73c5da0a'],
'claimed_derivation_paths': ['m/48h/1h/0h/2h/1/0', 'm/48h/1h/0h/2h/1/0']
}
"""
@@ -334,12 +333,12 @@ class PSBTChangeDetailsView(View):
# and derivation path.
seed_fingerprint = self.controller.psbt_seed.get_fingerprint(self.settings.get_value(SettingsConstants.SETTING__NETWORK))
if seed_fingerprint not in change_data.get("claimed_fingerprint"):
if seed_fingerprint not in change_data.get("claimed_fingerprints"):
# TODO: Something is wrong with this psbt(?). Reroute to warning?
return Destination(NotYetImplementedView)
i = change_data.get("claimed_fingerprint").index(seed_fingerprint)
claimed_derivation_path = change_data.get("claimed_derivation_path")[i]
i = change_data.get("claimed_fingerprints").index(seed_fingerprint)
claimed_derivation_path = change_data.get("claimed_derivation_paths")[i]
# 'm/84h/1h/0h/1/0' would be a change addr while 'm/84h/1h/0h/0/0' is a self-receive
is_change_derivation_path = int(claimed_derivation_path.split("/")[-2]) == 1
+4 -4
View File
@@ -321,8 +321,8 @@ def test_p2tr_change_detection():
'output_index': 0,
'address': 'bcrt1prz4g6saush37epdwhvwpu78td3q7yfz3xxz37axlx7udck6wracq3rwq30',
'amount': 2871443918,
'claimed_fingerprint': ['394aed14'],
'claimed_derivation_path': ['m/86h/1h/0h/1/1']}
'claimed_fingerprints': ['394aed14'],
'claimed_derivation_paths': ['m/86h/1h/0h/1/1']}
]
assert pp.spend_amount == 319049328
assert pp.change_amount == 2871443918
@@ -481,8 +481,8 @@ def test_parse_op_return_content():
'output_index': 0,
'address': 'bcrt1qvwkhakqhz7m7kmz6332avatsmdy32m644g86vv',
'amount': 99992296,
'claimed_fingerprint': ['0fb882ff'],
'claimed_derivation_path': ["m/84h/1h/0h/0/2"]}
'claimed_fingerprints': ['0fb882ff'],
'claimed_derivation_paths': ["m/84h/1h/0h/0/2"]}
]
assert psbt_parser.spend_amount == 0 # This is a self-spend; no value being spent, other than the tx fee
assert psbt_parser.change_amount == 99992296