Struct bitcoins::types::utxo::Utxo [−][src]
pub struct Utxo {
pub outpoint: BitcoinOutpoint,
pub value: u64,
pub script_pubkey: ScriptPubkey,
// some fields omitted
}
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
pub fn new(
outpoint: BitcoinOutpoint,
value: u64,
script_pubkey: ScriptPubkey,
spend_script: SpendScript
) -> Utxo
pub fn new(
outpoint: BitcoinOutpoint,
value: u64,
script_pubkey: ScriptPubkey,
spend_script: SpendScript
) -> Utxo
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
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Utxo
impl UnwindSafe for Utxo
Blanket Implementations
Mutably borrows from an owned value. Read more