@@ -20,6 +20,8 @@ const PSBT_OUT_TAP_INTERNAL_KEY: u64 = 0x05;
2020const PSBT_OUT_TAP_TREE : u64 = 0x06 ;
2121/// Type: Taproot Key BIP 32 Derivation Path PSBT_OUT_TAP_BIP32_DERIVATION = 0x07
2222const PSBT_OUT_TAP_BIP32_DERIVATION : u64 = 0x07 ;
23+ /// Type: MuSig2 Public Keys Participating in Aggregate Output PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS = 0x08
24+ const PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS : u64 = 0x08 ;
2325/// Type: Proprietary Use Type PSBT_IN_PROPRIETARY = 0xFC
2426const PSBT_OUT_PROPRIETARY : u64 = 0xFC ;
2527
@@ -40,6 +42,8 @@ pub struct Output {
4042 pub tap_tree : Option < TapTree > ,
4143 /// Map of tap root x only keys to origin info and leaf hashes contained in it.
4244 pub tap_key_origins : BTreeMap < XOnlyPublicKey , ( Vec < TapLeafHash > , KeySource ) > ,
45+ /// Mapping from MuSig2 aggregate keys to the participant keys from which they were aggregated.
46+ pub musig2_participant_pubkeys : BTreeMap < secp256k1:: PublicKey , Vec < secp256k1:: PublicKey > > ,
4347 /// Proprietary key-value pairs for this output.
4448 pub proprietary : BTreeMap < raw:: ProprietaryKey , Vec < u8 > > ,
4549 /// Unknown key-value pairs for this output.
@@ -90,6 +94,11 @@ impl Output {
9094 self . tap_key_origins <= <raw_key: XOnlyPublicKey >|< raw_value: ( Vec <TapLeafHash >, KeySource ) >
9195 }
9296 }
97+ PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS => {
98+ impl_psbt_insert_pair ! {
99+ self . musig2_participant_pubkeys <= <raw_key: secp256k1:: PublicKey >|< raw_value: Vec <secp256k1:: PublicKey > >
100+ }
101+ }
93102 _ => match self . unknown . entry ( raw_key) {
94103 btree_map:: Entry :: Vacant ( empty_key) => {
95104 empty_key. insert ( raw_value) ;
@@ -107,6 +116,7 @@ impl Output {
107116 self . proprietary . extend ( other. proprietary ) ;
108117 self . unknown . extend ( other. unknown ) ;
109118 self . tap_key_origins . extend ( other. tap_key_origins ) ;
119+ self . musig2_participant_pubkeys . extend ( other. musig2_participant_pubkeys ) ;
110120
111121 combine ! ( redeem_script, self , other) ;
112122 combine ! ( witness_script, self , other) ;
@@ -143,6 +153,10 @@ impl Map for Output {
143153 rv. push_map( self . tap_key_origins, PSBT_OUT_TAP_BIP32_DERIVATION )
144154 }
145155
156+ impl_psbt_get_pair ! {
157+ rv. push_map( self . musig2_participant_pubkeys, PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS )
158+ }
159+
146160 for ( key, value) in self . proprietary . iter ( ) {
147161 rv. push ( raw:: Pair { key : key. to_key ( ) , value : value. clone ( ) } ) ;
148162 }
0 commit comments