Enum bitcoins::types::tx::BitcoinTx[][src]

pub enum BitcoinTx {
    Witness(WitnessTx),
    Legacy(LegacyTx),
}
Expand description

Wrapper enum for returning values that may be EITHER a Witness OR a Legacy tx and the type is not known in advance. While a few transaction methods have been implemented for convenience, This wrapper must be explicitly unwrapped before the tx object can be signed.

Variants

Witness(WitnessTx)

Tuple Fields

Witness

Legacy(LegacyTx)

Tuple Fields

Legacy

Implementations

True if the wrapped tx is a witness transaction. False otherwise

True if the wrapped tx is a legacy transaction. False otherwise

Trait Implementations

Returns a reference to the tx as a legacy tx.

Return a reference to a slice of witnesses. For legacy txins this will ALWAYS be length 0. For witness txns, this will ALWAYS be the same length as the input vector. Read more

Consume the tx and convert it to a legacy tx. Useful for when you have dyn BitcoinTransaction or impl BitcoinTransaction types, but into_witness should be preferred, as it will never drop information. Read more

Consume the tx and convert it to a legacy tx. Useful for when you have dyn BitcoinTransaction or impl BitcoinTransaction types. Read more

Get a reference to the output by

Returns the byte-length of the serialized data structure.

An associated error type

Deserializes an instance of Self from a std::io::Read. The limit argument is used only when deserializing collections, and specifies a maximum number of instances of the underlying type to read. Read more

Serializes self to a std::io::Write. Following Write trait conventions, its Ok type must be a usize denoting the number of bytes written. Read more

Read a sequence of exactly limit objects from the reader.

Write a sequence of ByteFormat objects to a writer. The iter argument may be any object that implements IntoIterator<Item = &Item>. This means we can seamlessly use vectors, slices, etc. Read more

Decodes a hex string to a Vec<u8>, deserializes an instance of Self from that vector.

Serialize self to a base64 string, using standard RFC4648 non-url safe characters

Serializes self to a vector, returns the hex-encoded vector

Serialize self to a base64 string, using standard RFC4648 non-url safe characters

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Performs the conversion.

Performs the conversion.

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

Instantiate a new BitcoinTx. This always returns a BitcoinTx::Legacy

Get the version number from the underlying tx

Get the inputs from the underlying tx

Get the outputs from the underlying tx

Get the locktime from the underlying tx

Return the TXID of the transaction

Return the TXID of the transaction

An associated error type, used in Results returned by the Transaction.

A marked hash (see crate::hashes::marked) to be used as the transaction ID type.

The Output type for the transaction

The Input type for the transaction

A type that implements HashWriter. Used to generate the TXID and Sighash.

A type describing arguments for the sighash function for this transaction.

Calls write_sighash_preimage with the provided arguments and a new HashWriter. Returns the sighash digest which should be signed. 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

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.