Skip to content

Commit

Permalink
Fix txmaker incorrectly filling the psbt for taproot transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
bigspider committed Jan 29, 2024
1 parent 3fb299d commit db5c6d8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test_utils/txmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def createPsbt(wallet: WalletPolicy, input_amounts: List[int], output_amounts: L
psbt.inputs[i].hd_keypaths[input_key] = KeyOriginInfo(
master_key_fpr, path)
elif is_taproot:
tweaked_key = get_taproot_output_key(input_key)
psbt.inputs[i].tap_bip32_paths[tweaked_key] = (
list(), KeyOriginInfo(master_key_fpr, path))
internal_key = input_key[1:]
psbt.inputs[i].tap_bip32_paths[internal_key] = (
{}, KeyOriginInfo(master_key_fpr, path))
else:
raise RuntimeError("Unexpected state: unknown transaction type")

Expand All @@ -224,12 +224,12 @@ def createPsbt(wallet: WalletPolicy, input_amounts: List[int], output_amounts: L
psbt.outputs[i].hd_keypaths[output_key] = KeyOriginInfo(
master_key_fpr, path)
elif is_taproot:
tweaked_key = get_taproot_output_key(output_key)
psbt.outputs[i].tap_bip32_paths[tweaked_key] = (
list(), KeyOriginInfo(master_key_fpr, path))
internal_key = output_key[1:]
psbt.outputs[i].tap_bip32_paths[internal_key] = (
{}, KeyOriginInfo(master_key_fpr, path))

psbt.outputs[i].tap_bip32_paths[tweaked_key] = (
list(), KeyOriginInfo(master_key_fpr, path))
psbt.outputs[i].tap_bip32_paths[internal_key] = (
{}, KeyOriginInfo(master_key_fpr, path))

psbt.tx = tx

Expand Down

0 comments on commit db5c6d8

Please sign in to comment.