pub struct TxIn {
pub previous_output: OutPoint,
pub is_pegin: bool,
pub script_sig: Script,
pub sequence: Sequence,
pub asset_issuance: AssetIssuance,
pub witness: TxInWitness,
}Expand description
A transaction input, which defines old coins to be consumed
Fields§
§previous_output: OutPointThe reference to the previous output that is being used as an input
is_pegin: boolFlag indicating that previous_outpoint refers to something on the main chain
script_sig: ScriptThe script which pushes values on the stack which will cause the referenced output’s script to accept
sequence: SequenceThe sequence number, which suggests to miners which of two conflicting transactions should be preferred, or 0xFFFFFFFF to ignore this feature. This is generally never used since the miner behaviour cannot be enforced.
asset_issuance: AssetIssuanceAsset issuance data
witness: TxInWitnessWitness data - not deserialized/serialized as part of a TxIn object
(rather as part of its containing transaction, if any) but is logically
part of the txin.
Implementations§
Source§impl TxIn
impl TxIn
Sourcepub fn blind_issuances_with_bfs<C: Signing>(
&mut self,
secp: &Secp256k1<C>,
issue_vbf: ValueBlindingFactor,
token_vbf: ValueBlindingFactor,
issue_sk: SecretKey,
token_sk: SecretKey,
) -> Result<(), BlindError>
pub fn blind_issuances_with_bfs<C: Signing>( &mut self, secp: &Secp256k1<C>, issue_vbf: ValueBlindingFactor, token_vbf: ValueBlindingFactor, issue_sk: SecretKey, token_sk: SecretKey, ) -> Result<(), BlindError>
Blind issuances for this TxIn. Asset amount and token amount must be
set in AssetIssuance field for this input
Sourcepub fn blind_issuances<C: Signing, R: RngCore + CryptoRng>(
&mut self,
secp: &Secp256k1<C>,
rng: &mut R,
) -> Result<(ValueBlindingFactor, SecretKey, ValueBlindingFactor, SecretKey), BlindError>
pub fn blind_issuances<C: Signing, R: RngCore + CryptoRng>( &mut self, secp: &Secp256k1<C>, rng: &mut R, ) -> Result<(ValueBlindingFactor, SecretKey, ValueBlindingFactor, SecretKey), BlindError>
Blind issuances for this TxIn. Asset amount and token amount must be
set in AssetIssuance field for this input
Returns (issuance_blinding_factor, issue_blind_sec_key, token_blinding_factor, token_blind_sec_key)
Source§impl TxIn
impl TxIn
Sourcepub fn is_coinbase(&self) -> bool
pub fn is_coinbase(&self) -> bool
Whether the input is a coinbase
Sourcepub fn pegin_prevout(&self) -> Option<OutPoint>
pub fn pegin_prevout(&self) -> Option<OutPoint>
In case of a pegin input, returns the Bitcoin prevout.
Sourcepub fn pegin_data(&self) -> Option<PeginData<'_>>
pub fn pegin_data(&self) -> Option<PeginData<'_>>
Extracts witness data from a pegin. Will return None if any data
cannot be parsed. The combination of is_pegin() returning true
and pegin_data() returning None indicates an invalid transaction.
Sourcepub fn has_issuance(&self) -> bool
pub fn has_issuance(&self) -> bool
Helper to determine whether an input has an asset issuance attached
Sourcepub fn outpoint_flag(&self) -> u8
pub fn outpoint_flag(&self) -> u8
Obtain the outpoint flag corresponding to this input
Sourcepub fn issuance_ids(&self) -> (AssetId, AssetId)
pub fn issuance_ids(&self) -> (AssetId, AssetId)
Compute the issuance asset ids from this TxIn. This function does not check
whether there is an issuance in this input. Returns (asset_id, token_id)