Struct psbt::Input

source ·
pub struct Input {
Show 26 fields pub previous_outpoint: Outpoint, pub sequence_number: Option<SeqNo>, pub required_time_lock: Option<LockTimestamp>, pub required_height_lock: Option<LockHeight>, pub non_witness_tx: Option<Tx>, pub witness_utxo: Option<TxOut>, pub partial_sigs: IndexMap<LegacyPk, LegacySig>, pub sighash_type: Option<SighashType>, pub redeem_script: Option<RedeemScript>, pub witness_script: Option<WitnessScript>, pub bip32_derivation: IndexMap<CompressedPk, KeyOrigin>, pub final_script_sig: Option<SigScript>, pub final_witness: Option<Witness>, pub proof_of_reserves: Option<String>, pub ripemd160: IndexMap<Bytes20, ByteStr>, pub sha256: IndexMap<Bytes32, ByteStr>, pub hash160: IndexMap<Bytes20, ByteStr>, pub hash256: IndexMap<Bytes32, ByteStr>, pub tap_key_sig: Option<Bip340Sig>, pub tap_script_sig: IndexMap<(InternalPk, Bytes32), Bip340Sig>, pub tap_leaf_script: IndexMap<ControlBlock, LeafScript>, pub tap_bip32_derivation: IndexMap<XOnlyPk, TapDerivation>, pub tap_internal_key: Option<InternalPk>, pub tap_merkle_root: Option<TapNodeHash>, pub proprietary: IndexMap<PropKey, ValueData>, pub unknown: IndexMap<u8, IndexMap<KeyData, ValueData>>, /* private fields */
}

Fields§

§previous_outpoint: Outpoint

Previous transaction outpoint to spent.

§sequence_number: Option<SeqNo>

Sequence number of this input. If omitted, the sequence number is assumed to be the final sequence number (0xffffffff).

§required_time_lock: Option<LockTimestamp>

32 bit unsigned little endian integer greater than or equal to 500000000 representing the minimum Unix timestamp that this input requires to be set as the transaction’s lock time.

§required_height_lock: Option<LockHeight>

32 bit unsigned little endian integer less than 500000000 representing the minimum block height that this input requires to be set as the transaction’s lock time.

§non_witness_tx: Option<Tx>

The non-witness transaction this input spends from. Should only be Some for inputs which spend non-segwit outputs or if it is unknown whether an input spends a segwit output.

§witness_utxo: Option<TxOut>

The transaction output this input spends from. Should only be Some for inputs which spend segwit outputs, including P2SH embedded ones.

§partial_sigs: IndexMap<LegacyPk, LegacySig>

A map from public keys to their corresponding signature as would be pushed to the stack from a scriptSig or witness for a non-taproot inputs.

§sighash_type: Option<SighashType>

The sighash type to be used for this input. Signatures for this input must use the sighash type.

§redeem_script: Option<RedeemScript>

The redeem script for this input.

§witness_script: Option<WitnessScript>

The witness script for this input.

§bip32_derivation: IndexMap<CompressedPk, KeyOrigin>

A map from public keys needed to sign this input to their corresponding master key fingerprints and derivation paths.

§final_script_sig: Option<SigScript>

The finalized, fully-constructed scriptSig with signatures and any other scripts necessary for this input to pass validation.

§final_witness: Option<Witness>

The finalized, fully-constructed scriptWitness with signatures and any other scripts necessary for this input to pass validation.

§proof_of_reserves: Option<String>

The UTF-8 encoded commitment message string for the proof-of-reserves. See BIP 127 for more information.

§ripemd160: IndexMap<Bytes20, ByteStr>

The hash preimage, encoded as a byte vector, which must equal the key when run through the RIPEMD160 algorithm.

§sha256: IndexMap<Bytes32, ByteStr>

The hash preimage, encoded as a byte vector, which must equal the key when run through the SHA256 algorithm.

§hash160: IndexMap<Bytes20, ByteStr>

The hash preimage, encoded as a byte vector, which must equal the key when run through the SHA256 algorithm followed by the RIPEMD160 algorithm .

§hash256: IndexMap<Bytes32, ByteStr>

The hash preimage, encoded as a byte vector, which must equal the key when run through the SHA256 algorithm twice.

§tap_key_sig: Option<Bip340Sig>

The 64 or 65 byte Schnorr signature for key path spending a Taproot output. Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed.

§tap_script_sig: IndexMap<(InternalPk, Bytes32), Bip340Sig>

The 64 or 65 byte Schnorr signature for this pubkey and leaf combination. Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed.

§tap_leaf_script: IndexMap<ControlBlock, LeafScript>

The script for this leaf as would be provided in the witness stack followed by the single byte leaf version. Note that the leaves included in this field should be those that the signers of this input are expected to be able to sign for. Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed.

§tap_bip32_derivation: IndexMap<XOnlyPk, TapDerivation>

A compact size unsigned integer representing the number of leaf hashes, followed by a list of leaf hashes, followed by the 4 byte master key fingerprint concatenated with the derivation path of the public key. The derivation path is represented as 32-bit little endian unsigned integer indexes concatenated with each other. Public keys are those needed to spend this output. The leaf hashes are of the leaves which involve this public key. The internal key does not have leaf hashes, so can be indicated with a hashes len of 0. Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed.

§tap_internal_key: Option<InternalPk>

The X-only pubkey used as the internal key in this output. Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed.

§tap_merkle_root: Option<TapNodeHash>

The 32 byte Merkle root hash. Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed.

§proprietary: IndexMap<PropKey, ValueData>

Proprietary keys

§unknown: IndexMap<u8, IndexMap<KeyData, ValueData>>

Unknown keys

Implementations§

source§

impl Input

source

pub fn new(index: usize) -> Input

source

pub fn with_txin(txin: impl Into<UnsignedTxIn>, index: usize) -> Input

source

pub fn from_unsigned_txin((index, txin): (usize, UnsignedTxIn)) -> Input

source

pub fn to_unsigned_txin(&self) -> UnsignedTxIn

source

pub fn prev_txout(&self) -> &TxOut

source

pub fn prevout(&self) -> Prevout

source

pub fn value(&self) -> Sats

source

pub fn index(&self) -> usize

Trait Implementations§

source§

impl Clone for Input

source§

fn clone(&self) -> Input

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Input

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl KeyMap for Input

§

type Keys = InputKey

source§

const PROPRIETARY_TYPE: Self::Keys = InputKey::Proprietary

source§

fn retrieve_key_pair<'enc>( &'enc self, _: PsbtVer, key_type: Self::Keys ) -> Vec<KeyPair<Self::Keys, Box<dyn Encode + 'enc>, Box<dyn Encode + 'enc>>>

source§

fn insert_singular( &mut self, key_type: Self::Keys, value_data: ValueData ) -> Result<(), PsbtError>

source§

fn insert_plural( &mut self, key_type: Self::Keys, key_data: KeyData, value_data: ValueData ) -> Result<(), PsbtError>

source§

fn encode_map( &self, version: PsbtVer, writer: &mut dyn Write ) -> Result<usize, IoError>

source§

fn parse_map( &mut self, version: PsbtVer, map: Map<Self::Keys> ) -> Result<(), PsbtError>

source§

fn has_proprietary(&self, key: &PropKey) -> bool

source§

fn proprietary(&self, key: &PropKey) -> Option<&ValueData>

source§

fn proprietary_mut(&mut self, key: &PropKey) -> Option<&mut ValueData>

source§

fn push_proprietary( &mut self, key: PropKey, value: impl Into<ValueData> ) -> Result<(), KeyAlreadyPresent>

source§

fn remove_proprietary(&mut self, key: &PropKey) -> Option<ValueData>

source§

fn insert_proprietary(&mut self, prop_key: PropKey, value_data: ValueData)

source§

fn insert_unknown( &mut self, key_type: u8, key_data: KeyData, value_data: ValueData )

source§

impl PartialEq for Input

source§

fn eq(&self, other: &Input) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Input

source§

impl StructuralEq for Input

source§

impl StructuralPartialEq for Input

Auto Trait Implementations§

§

impl RefUnwindSafe for Input

§

impl Send for Input

§

impl Sync for Input

§

impl Unpin for Input

§

impl UnwindSafe for Input

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> VerifyEq for T
where T: Eq,

§

fn verify_eq(&self, other: &T) -> bool

Verifies commit-equivalence of two instances of the same type.