Struct bitcoin::blockdata::transaction::TxOut
source · pub struct TxOut {
pub value: Amount,
pub script_pubkey: ScriptBuf,
}
Expand description
Bitcoin transaction output.
Defines new coins to be created as a result of the transaction, along with spending conditions (“script”, aka “output script”), which an input spending it must satisfy.
An output that is not yet spent by an input is called Unspent Transaction Output (“UTXO”).
Bitcoin Core References
Fields§
§value: Amount
The value of the output, in satoshis.
script_pubkey: ScriptBuf
The script which must be satisfied for the output to be spent.
Implementations§
source§impl TxOut
impl TxOut
sourcepub fn weight(&self) -> Weight
pub fn weight(&self) -> Weight
The weight of this output.
Keep in mind that when adding a TxOut
to a Transaction
the total weight of the
transaction might increase more than TxOut::weight
. This happens when the new output added
causes the output length VarInt
to increase its encoding length.
Panics
If output size * 4 overflows, this should never happen under normal conditions. Use
Weght::from_vb_checked(self.size() as u64)
if you are concerned.
sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Returns the total number of bytes that this output contributes to a transaction.
There is no difference between base size vs total size for outputs.
sourcepub fn minimal_non_dust(script_pubkey: ScriptBuf) -> Self
pub fn minimal_non_dust(script_pubkey: ScriptBuf) -> Self
Creates a TxOut
with given script and the smallest possible value
that is not dust
per current Core policy.
The current dust fee rate is 3 sat/vB.
Trait Implementations§
source§impl<'de> Deserialize<'de> for TxOut
impl<'de> Deserialize<'de> for TxOut
source§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>,
source§impl Ord for TxOut
impl Ord for TxOut
source§impl PartialEq<TxOut> for TxOut
impl PartialEq<TxOut> for TxOut
source§impl PartialOrd<TxOut> for TxOut
impl PartialOrd<TxOut> for TxOut
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more