@@ -34,7 +34,7 @@ use crate::{transaction::SighashTypeParseError, SchnorrSighashType};
34
34
use crate :: { AssetIssuance , BlockHash , EcdsaSighashType , Script , Transaction , TxIn , TxOut , Txid } ;
35
35
use bitcoin:: bip32:: KeySource ;
36
36
use bitcoin:: { PublicKey , key:: XOnlyPublicKey } ;
37
- use secp256k1_zkp:: { self , RangeProof , Tweak , ZERO_TWEAK } ;
37
+ use secp256k1_zkp:: { self , RangeProof , SurjectionProof , Tweak , ZERO_TWEAK } ;
38
38
39
39
use crate :: { OutPoint , Sequence } ;
40
40
@@ -148,6 +148,21 @@ const PSBT_ELEMENTS_IN_ISSUANCE_BLIND_VALUE_PROOF: u8 = 0x0f;
148
148
/// in PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS. If provided,
149
149
/// PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS_COMMITMENT must be provided too.
150
150
const PSBT_ELEMENTS_IN_ISSUANCE_BLIND_INFLATION_KEYS_PROOF : u8 = 0x10 ;
151
+ /// The explicit value for the input being spent. If provided,
152
+ /// PSBT_ELEMENTS_IN_VALUE_PROOF must be provided too.
153
+ const PSBT_ELEMENTS_IN_EXPLICIT_VALUE : u8 = 0x11 ;
154
+ /// An explicit value rangeproof that proves that the value commitment in this
155
+ /// input's UTXO matches the explicit value in PSBT_ELEMENTS_IN_EXPLICIT_VALUE.
156
+ /// If provided, PSBT_ELEMENTS_IN_EXPLICIT_VALUE must be provided too.
157
+ const PSBT_ELEMENTS_IN_VALUE_PROOF : u8 = 0x12 ;
158
+ /// The explicit asset for the input being spent. If provided,
159
+ /// PSBT_ELEMENTS_IN_ASSET_PROOF must be provided too.
160
+ const PSBT_ELEMENTS_IN_EXPLICIT_ASSET : u8 = 0x13 ;
161
+ /// An asset surjection proof with this input's asset as the only asset in the
162
+ /// input set in order to prove that the asset commitment in the UTXO matches
163
+ /// the explicit asset in PSBT_ELEMENTS_IN_EXPLICIT_ASSET. If provided,
164
+ /// PSBT_ELEMENTS_IN_EXPLICIT_ASSET must be provided too.
165
+ const PSBT_ELEMENTS_IN_ASSET_PROOF : u8 = 0x14 ;
151
166
/// A key-value map for an input of the corresponding index in the unsigned
152
167
/// transaction.
153
168
#[ derive( Clone , Debug , PartialEq ) ]
@@ -271,6 +286,14 @@ pub struct Input {
271
286
pub in_issuance_blind_value_proof : Option < Box < RangeProof > > ,
272
287
/// Proof that blinded inflation keys matches the corresponding commitment
273
288
pub in_issuance_blind_inflation_keys_proof : Option < Box < RangeProof > > ,
289
+ /// The explicit amount of the input
290
+ pub amount : Option < u64 > ,
291
+ /// The blind value rangeproof
292
+ pub blind_value_proof : Option < Box < RangeProof > > ,
293
+ /// The input explicit asset
294
+ pub asset : Option < AssetId > ,
295
+ /// The blind asset surjection proof
296
+ pub blind_asset_proof : Option < Box < SurjectionProof > > ,
274
297
/// Other fields
275
298
#[ cfg_attr(
276
299
feature = "serde" ,
@@ -287,7 +310,7 @@ pub struct Input {
287
310
288
311
impl Default for Input {
289
312
fn default ( ) -> Self {
290
- 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 ( ) , proprietary : Default :: default ( ) , unknown : Default :: default ( ) }
313
+ 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 ( ) , proprietary : Default :: default ( ) , unknown : Default :: default ( ) }
291
314
}
292
315
}
293
316
@@ -705,6 +728,18 @@ impl Map for Input {
705
728
PSBT_ELEMENTS_IN_ISSUANCE_BLIND_INFLATION_KEYS_PROOF => {
706
729
impl_pset_prop_insert_pair ! ( self . in_issuance_blind_inflation_keys_proof <= <raw_key: _> | <raw_value : Box <RangeProof >>)
707
730
}
731
+ PSBT_ELEMENTS_IN_EXPLICIT_VALUE => {
732
+ impl_pset_prop_insert_pair ! ( self . amount <= <raw_key: _> | <raw_value : u64 >)
733
+ }
734
+ PSBT_ELEMENTS_IN_VALUE_PROOF => {
735
+ impl_pset_prop_insert_pair ! ( self . blind_value_proof <= <raw_key: _> | <raw_value : Box <RangeProof >>)
736
+ }
737
+ PSBT_ELEMENTS_IN_EXPLICIT_ASSET => {
738
+ impl_pset_prop_insert_pair ! ( self . asset <= <raw_key: _> | <raw_value : AssetId >)
739
+ }
740
+ PSBT_ELEMENTS_IN_ASSET_PROOF => {
741
+ impl_pset_prop_insert_pair ! ( self . blind_asset_proof <= <raw_key: _> | <raw_value : Box <SurjectionProof >>)
742
+ }
708
743
_ => match self . proprietary . entry ( prop_key) {
709
744
Entry :: Vacant ( empty_key) => {
710
745
empty_key. insert ( raw_value) ;
@@ -903,6 +938,22 @@ impl Map for Input {
903
938
rv. push_prop( self . in_issuance_blind_inflation_keys_proof as <PSBT_ELEMENTS_IN_ISSUANCE_BLIND_INFLATION_KEYS_PROOF , _>)
904
939
}
905
940
941
+ impl_pset_get_pair ! {
942
+ rv. push_prop( self . amount as <PSBT_ELEMENTS_IN_EXPLICIT_VALUE , _>)
943
+ }
944
+
945
+ impl_pset_get_pair ! {
946
+ rv. push_prop( self . blind_value_proof as <PSBT_ELEMENTS_IN_VALUE_PROOF , _>)
947
+ }
948
+
949
+ impl_pset_get_pair ! {
950
+ rv. push_prop( self . asset as <PSBT_ELEMENTS_IN_EXPLICIT_ASSET , _>)
951
+ }
952
+
953
+ impl_pset_get_pair ! {
954
+ rv. push_prop( self . blind_asset_proof as <PSBT_ELEMENTS_IN_ASSET_PROOF , _>)
955
+ }
956
+
906
957
for ( key, value) in self . proprietary . iter ( ) {
907
958
rv. push ( raw:: Pair {
908
959
key : key. to_key ( ) ,
0 commit comments