From db5c6d86f62db7f72885dd1d4e7d9ab7ce9b526c Mon Sep 17 00:00:00 2001 From: Salvatore Ingala <6681844+bigspider@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:55:38 +0100 Subject: [PATCH] Fix txmaker incorrectly filling the psbt for taproot transactions --- test_utils/txmaker.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test_utils/txmaker.py b/test_utils/txmaker.py index 3a1e26e42..e5caeee73 100644 --- a/test_utils/txmaker.py +++ b/test_utils/txmaker.py @@ -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") @@ -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