pub struct Utxo {
    pub outpoint: BitcoinOutpoint,
    pub value: u64,
    pub script_pubkey: ScriptPubkey,
    /* private fields */
}
Expand description

Information necessary to spend an output.

Fields

outpoint: BitcoinOutpoint

UTXO outpoint

value: u64

UTXO value

script_pubkey: ScriptPubkey

The prevout script pubkey

Implementations

Instantiate a new UTXO with the given arguments. If spend_script is provided, but the script_pubkey does not require a spend script, the spend_script will be discarded.

Produce a UTXO from a transaction output

Produce a UTXO from an output and the outpoint that identifies it

Return a reference to the script pubkey

Return a reference to the spend script

Return the script that ought to be signed. This is the spend_script (redeem/witness script) if present, the script pubkey if legacy PKH, and the legacy PKH script if WPKH. .

Inspect the Script to determine its type.

Attempts to set the script. Returns true if succesful, false otherwise. Before setting, we check that the provided script’s hash matches the payload of the script pubkey. As such, this will always fail for UTXOs with PKH or WPKH script pubkeys.

Construct LegacySighashArgs from this UTXO. Returns None if the prevout is WSH or SH and the witness or redeem script is Missing. It is safe to unwrap this Option if the signing script is PKH, or WPKH, or if the underlying witness or redeem script is Known.

Construct WitnessSighashArgs from this UTXO. Returns None if the prevout is WSH or SH and the witness or redeem script is Missing. It is safe to unwrap this Option if the signing script is PKH, or WPKH, or if the underlying witness or redeem script is Known.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.