Skip to content

Commit 8ba245c

Browse files
committed
test: add constants for MuSig2 PSBT key types (BIP 373)
Also, support serialization of lists of byte-strings as PSBTMap values, which will be simply concatenated without any compact-size prefixes (neither for the individual items nor for the size of the list).
1 parent efac285 commit 8ba245c

File tree

1 file changed

+7
-0
lines changed
  • test/functional/test_framework

1 file changed

+7
-0
lines changed

test/functional/test_framework/psbt.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
PSBT_IN_TAP_BIP32_DERIVATION = 0x16
5151
PSBT_IN_TAP_INTERNAL_KEY = 0x17
5252
PSBT_IN_TAP_MERKLE_ROOT = 0x18
53+
PSBT_IN_MUSIG2_PARTICIPANT_PUBKEYS = 0x1a
54+
PSBT_IN_MUSIG2_PUB_NONCE = 0x1b
55+
PSBT_IN_MUSIG2_PARTIAL_SIG = 0x1c
5356
PSBT_IN_PROPRIETARY = 0xfc
5457

5558
# per-output types
@@ -61,6 +64,7 @@
6164
PSBT_OUT_TAP_INTERNAL_KEY = 0x05
6265
PSBT_OUT_TAP_TREE = 0x06
6366
PSBT_OUT_TAP_BIP32_DERIVATION = 0x07
67+
PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS = 0x08
6468
PSBT_OUT_PROPRIETARY = 0xfc
6569

6670

@@ -88,6 +92,9 @@ def serialize(self):
8892
for k,v in self.map.items():
8993
if isinstance(k, int) and 0 <= k and k <= 255:
9094
k = bytes([k])
95+
if isinstance(v, list):
96+
assert all(type(elem) is bytes for elem in v)
97+
v = b"".join(v) # simply concatenate the byte-strings w/o size prefixes
9198
m += ser_compact_size(len(k)) + k
9299
m += ser_compact_size(len(v)) + v
93100
m += b"\x00"

0 commit comments

Comments
 (0)