Skip to content

Commit 84ef028

Browse files
mflaxmanhowechMichael Flaxman
authored
Bugfix for create_multisig_psbt() (#131)
* None for witness_lookup bad for PSBT.create() Passing in None to the witness_lookup in psbt_helper::create_multisig_psbt does the wrong thing if you end up passing in a P2WSH address as an output. It seems that an empty dictionary behaves correctly as an empty witness_lookup object. * add test coverage and bump version number Co-authored-by: Chris Howe <[email protected]> Co-authored-by: Michael Flaxman <[email protected]>
1 parent 629d8f9 commit 84ef028

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

buidl/psbt_helper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,6 @@ def create_multisig_psbt(
221221
tx_lookup=tx_lookup,
222222
pubkey_lookup=pubkey_lookup,
223223
redeem_lookup=redeem_lookup,
224-
witness_lookup=None,
224+
witness_lookup={},
225225
hd_pubs=hd_pubs,
226226
)

buidl/test/test_psbt_helper.py

+8
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ def test_sweep_1of2_p2sh(self):
131131

132132
self.assertEqual(psbt_obj.final_tx().hash().hex(), signed_tx_hash_hex)
133133

134+
# add in smeonwhat random test to confirm this bug is fixed
135+
# https://github.com/buidl-bitcoin/buidl-python/pull/129
136+
# this should NOT raise an exception
137+
kwargs["output_dicts"][0][
138+
"address"
139+
] = "tb1q9hj5j7mh9f7t6cwdvz34nj6pyzva5ftj2ecarcdqph5wc3n49hyqchh3cg"
140+
create_multisig_psbt(**kwargs, script_type="p2sh")
141+
134142
def test_sweep_1of2_p2sh_with_non_BIP67_input(self):
135143

136144
# This test will produce a validly signed TX for the 1-of-2 p2sh using either key, which will result in a different TX ID

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="buidl",
9-
version="0.2.35",
9+
version="0.2.36",
1010
author="Example Author",
1111
author_email="[email protected]",
1212
description="An easy-to-use and fully featured bitcoin library written in pure python (no dependencies).",

0 commit comments

Comments
 (0)