taproot_bip32_derivations won't be populated for non-change p2tr addresses and therefor my_pubkey will be None.

The additional indendation of script.p2tr(my_pubkey) will make it so it's only called when my_pubkey is not None.
This commit is contained in:
Nick Klockenga
2023-03-18 22:33:12 -04:00
parent 2570dfef61
commit afdd3d1ffc
+1 -1
View File
@@ -148,7 +148,7 @@ class PSBTParser():
leaf_hashes, derivation = list(out.taproot_bip32_derivations.values())[0]
der = derivation.derivation
my_pubkey = self.root.derive(der)
sc = script.p2tr(my_pubkey)
sc = script.p2tr(my_pubkey)
if sc.data == self.psbt.tx.vout[i].script_pubkey.data:
is_change = True