@@ -22,7 +22,7 @@ use crate::encode::Decodable;
2222use crate :: pset:: map:: Map ;
2323use crate :: pset:: raw;
2424use crate :: pset:: Error ;
25- use crate :: { confidential, pset} ;
25+ use crate :: { confidential:: { self , AssetBlindingFactor } , pset} ;
2626use crate :: { encode, Script , TxOutWitness } ;
2727use bitcoin:: bip32:: KeySource ;
2828use bitcoin:: { PublicKey , key:: XOnlyPublicKey } ;
@@ -83,6 +83,8 @@ const PSBT_ELEMENTS_OUT_BLIND_VALUE_PROOF: u8 = 0x09;
8383/// PSBT_ELEMENTS_OUT_ASSET. If provided, PSBT_ELEMENTS_OUT_ASSET_COMMITMENT must
8484/// be provided too.
8585const PSBT_ELEMENTS_OUT_BLIND_ASSET_PROOF : u8 = 0x0a ;
86+ /// The 32 byte asset blinding factor for this output.
87+ const PSBT_ELEMENTS_OUT_ASSET_BLINDING_FACTOR : u8 = 0x0b ;
8688
8789/// A key-value map for an output of the corresponding index in the unsigned
8890/// transaction.
@@ -129,6 +131,8 @@ pub struct Output {
129131 pub blind_value_proof : Option < Box < RangeProof > > ,
130132 /// The blind asset surjection proof
131133 pub blind_asset_proof : Option < Box < SurjectionProof > > ,
134+ /// The 32 byte asset blinding factor
135+ pub asset_blinding_factor : Option < AssetBlindingFactor > ,
132136 /// Pset
133137 /// Other fields
134138 #[ cfg_attr(
@@ -374,6 +378,9 @@ impl Map for Output {
374378 PSBT_ELEMENTS_OUT_BLIND_ASSET_PROOF => {
375379 impl_pset_prop_insert_pair ! ( self . blind_asset_proof <= <raw_key: _> | <raw_value : Box <SurjectionProof >>)
376380 }
381+ PSBT_ELEMENTS_OUT_ASSET_BLINDING_FACTOR => {
382+ impl_pset_prop_insert_pair ! ( self . asset_blinding_factor <= <raw_key: _> | <raw_value : AssetBlindingFactor >)
383+ }
377384 _ => match self . proprietary . entry ( prop_key) {
378385 Entry :: Vacant ( empty_key) => {
379386 empty_key. insert ( raw_value) ;
@@ -488,6 +495,10 @@ impl Map for Output {
488495 rv. push_prop( self . blind_asset_proof as <PSBT_ELEMENTS_OUT_BLIND_ASSET_PROOF , _>)
489496 }
490497
498+ impl_pset_get_pair ! {
499+ rv. push_prop( self . asset_blinding_factor as <PSBT_ELEMENTS_OUT_ASSET_BLINDING_FACTOR , _>)
500+ }
501+
491502 for ( key, value) in self . proprietary . iter ( ) {
492503 rv. push ( raw:: Pair {
493504 key : key. to_key ( ) ,
@@ -525,6 +536,7 @@ impl Map for Output {
525536 merge ! ( blinder_index, self , other) ;
526537 merge ! ( blind_value_proof, self , other) ;
527538 merge ! ( blind_asset_proof, self , other) ;
539+ merge ! ( asset_blinding_factor, self , other) ;
528540 Ok ( ( ) )
529541 }
530542}
0 commit comments