@@ -23,7 +23,7 @@ use std::{
23
23
use crate :: taproot:: { ControlBlock , LeafVersion , TapNodeHash , TapLeafHash } ;
24
24
use crate :: { schnorr, AssetId , ContractHash } ;
25
25
26
- use crate :: { confidential, locktime} ;
26
+ use crate :: { confidential:: { self , AssetBlindingFactor } , locktime} ;
27
27
use crate :: encode:: { self , Decodable } ;
28
28
use crate :: hashes:: { self , hash160, ripemd160, sha256, sha256d, Hash } ;
29
29
use crate :: pset:: map:: Map ;
@@ -168,6 +168,8 @@ const PSBT_ELEMENTS_IN_ASSET_PROOF: u8 = 0x14;
168
168
/// Note that this does not indicate actual blinding status,
169
169
/// but rather the expected blinding status prior to signing.
170
170
const PSBT_ELEMENTS_IN_BLINDED_ISSUANCE : u8 = 0x15 ;
171
+ /// The 32 byte asset blinding factor for the input being spent.
172
+ const PSBT_ELEMENTS_IN_ASSET_BLINDING_FACTOR : u8 = 0x16 ;
171
173
/// A key-value map for an input of the corresponding index in the unsigned
172
174
/// transaction.
173
175
#[ derive( Clone , Debug , PartialEq ) ]
@@ -301,6 +303,8 @@ pub struct Input {
301
303
pub blind_asset_proof : Option < Box < SurjectionProof > > ,
302
304
/// Whether the issuance is blinded
303
305
pub blinded_issuance : Option < u8 > ,
306
+ /// The input asset blinding factor
307
+ pub asset_blinding_factor : Option < AssetBlindingFactor > ,
304
308
/// Other fields
305
309
#[ cfg_attr(
306
310
feature = "serde" ,
@@ -317,7 +321,7 @@ pub struct Input {
317
321
318
322
impl Default for Input {
319
323
fn default ( ) -> Self {
320
- Self { non_witness_utxo : Default :: default ( ) , witness_utxo : Default :: default ( ) , partial_sigs : Default :: default ( ) , sighash_type : Default :: default ( ) , redeem_script : Default :: default ( ) , witness_script : Default :: default ( ) , bip32_derivation : Default :: default ( ) , final_script_sig : Default :: default ( ) , final_script_witness : Default :: default ( ) , ripemd160_preimages : Default :: default ( ) , sha256_preimages : Default :: default ( ) , hash160_preimages : Default :: default ( ) , hash256_preimages : Default :: default ( ) , previous_txid : Txid :: all_zeros ( ) , previous_output_index : Default :: default ( ) , sequence : Default :: default ( ) , required_time_locktime : Default :: default ( ) , required_height_locktime : Default :: default ( ) , tap_key_sig : Default :: default ( ) , tap_script_sigs : Default :: default ( ) , tap_scripts : Default :: default ( ) , tap_key_origins : Default :: default ( ) , tap_internal_key : Default :: default ( ) , tap_merkle_root : Default :: default ( ) , issuance_value_amount : Default :: default ( ) , issuance_value_comm : Default :: default ( ) , issuance_value_rangeproof : Default :: default ( ) , issuance_keys_rangeproof : Default :: default ( ) , pegin_tx : Default :: default ( ) , pegin_txout_proof : Default :: default ( ) , pegin_genesis_hash : Default :: default ( ) , pegin_claim_script : Default :: default ( ) , pegin_value : Default :: default ( ) , pegin_witness : Default :: default ( ) , issuance_inflation_keys : Default :: default ( ) , issuance_inflation_keys_comm : Default :: default ( ) , issuance_blinding_nonce : Default :: default ( ) , issuance_asset_entropy : Default :: default ( ) , in_utxo_rangeproof : Default :: default ( ) , in_issuance_blind_value_proof : Default :: default ( ) , in_issuance_blind_inflation_keys_proof : Default :: default ( ) , amount : Default :: default ( ) , blind_value_proof : Default :: default ( ) , asset : Default :: default ( ) , blind_asset_proof : Default :: default ( ) , blinded_issuance : Default :: default ( ) , proprietary : Default :: default ( ) , unknown : Default :: default ( ) }
324
+ Self { non_witness_utxo : Default :: default ( ) , witness_utxo : Default :: default ( ) , partial_sigs : Default :: default ( ) , sighash_type : Default :: default ( ) , redeem_script : Default :: default ( ) , witness_script : Default :: default ( ) , bip32_derivation : Default :: default ( ) , final_script_sig : Default :: default ( ) , final_script_witness : Default :: default ( ) , ripemd160_preimages : Default :: default ( ) , sha256_preimages : Default :: default ( ) , hash160_preimages : Default :: default ( ) , hash256_preimages : Default :: default ( ) , previous_txid : Txid :: all_zeros ( ) , previous_output_index : Default :: default ( ) , sequence : Default :: default ( ) , required_time_locktime : Default :: default ( ) , required_height_locktime : Default :: default ( ) , tap_key_sig : Default :: default ( ) , tap_script_sigs : Default :: default ( ) , tap_scripts : Default :: default ( ) , tap_key_origins : Default :: default ( ) , tap_internal_key : Default :: default ( ) , tap_merkle_root : Default :: default ( ) , issuance_value_amount : Default :: default ( ) , issuance_value_comm : Default :: default ( ) , issuance_value_rangeproof : Default :: default ( ) , issuance_keys_rangeproof : Default :: default ( ) , pegin_tx : Default :: default ( ) , pegin_txout_proof : Default :: default ( ) , pegin_genesis_hash : Default :: default ( ) , pegin_claim_script : Default :: default ( ) , pegin_value : Default :: default ( ) , pegin_witness : Default :: default ( ) , issuance_inflation_keys : Default :: default ( ) , issuance_inflation_keys_comm : Default :: default ( ) , issuance_blinding_nonce : Default :: default ( ) , issuance_asset_entropy : Default :: default ( ) , in_utxo_rangeproof : Default :: default ( ) , in_issuance_blind_value_proof : Default :: default ( ) , in_issuance_blind_inflation_keys_proof : Default :: default ( ) , amount : Default :: default ( ) , blind_value_proof : Default :: default ( ) , asset : Default :: default ( ) , blind_asset_proof : Default :: default ( ) , blinded_issuance : Default :: default ( ) , asset_blinding_factor : Default :: default ( ) , proprietary : Default :: default ( ) , unknown : Default :: default ( ) }
321
325
}
322
326
}
323
327
@@ -750,6 +754,9 @@ impl Map for Input {
750
754
PSBT_ELEMENTS_IN_BLINDED_ISSUANCE => {
751
755
impl_pset_prop_insert_pair ! ( self . blinded_issuance <= <raw_key: _> | <raw_value : u8 >)
752
756
}
757
+ PSBT_ELEMENTS_IN_ASSET_BLINDING_FACTOR => {
758
+ impl_pset_prop_insert_pair ! ( self . asset_blinding_factor <= <raw_key: _> | <raw_value : AssetBlindingFactor >)
759
+ }
753
760
_ => match self . proprietary . entry ( prop_key) {
754
761
Entry :: Vacant ( empty_key) => {
755
762
empty_key. insert ( raw_value) ;
@@ -968,6 +975,10 @@ impl Map for Input {
968
975
rv. push_prop( self . blinded_issuance as <PSBT_ELEMENTS_IN_BLINDED_ISSUANCE , _>)
969
976
}
970
977
978
+ impl_pset_get_pair ! {
979
+ rv. push_prop( self . asset_blinding_factor as <PSBT_ELEMENTS_IN_ASSET_BLINDING_FACTOR , _>)
980
+ }
981
+
971
982
for ( key, value) in self . proprietary . iter ( ) {
972
983
rv. push ( raw:: Pair {
973
984
key : key. to_key ( ) ,
@@ -1047,6 +1058,7 @@ impl Map for Input {
1047
1058
merge ! ( asset, self , other) ;
1048
1059
merge ! ( blind_asset_proof, self , other) ;
1049
1060
merge ! ( blinded_issuance, self , other) ;
1061
+ merge ! ( asset_blinding_factor, self , other) ;
1050
1062
Ok ( ( ) )
1051
1063
}
1052
1064
}
0 commit comments