Enum bitcoins::types::tx::BitcoinTx [−][src]
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
0: WitnessTx
Witness
Legacy(LegacyTx)
Tuple Fields
0: LegacyTx
Legacy
Implementations
Trait Implementations
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.
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
fn read_seq_from<R>(
reader: &mut R,
mode: ReadSeqMode
) -> Result<Vec<Self, Global>, Self::Error> where
R: Read,
fn read_seq_from<R>(
reader: &mut R,
mode: ReadSeqMode
) -> Result<Vec<Self, Global>, Self::Error> where
R: Read,
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
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
Instantiate a new BitcoinTx
. This always returns a BitcoinTx::Legacy
Get the inputs from the underlying tx
fn write_sighash_preimage<W: Write>(
&self,
writer: &mut W,
args: &Self::SighashArgs
) -> Result<(), Self::TxError>
fn write_sighash_preimage<W: Write>(
&self,
writer: &mut W,
args: &Self::SighashArgs
) -> Result<(), Self::TxError>
Return the TXID of the transaction
type TxIn = BitcoinTxIn
type TxIn = BitcoinTxIn
The Input type for the transaction
type HashWriter = Hash256
type HashWriter = Hash256
A type that implements HashWriter
. Used to generate the TXID
and Sighash
.
type SighashArgs = WitnessSighashArgs
type SighashArgs = WitnessSighashArgs
A type describing arguments for the sighash function for this transaction.
fn sighash(
&self,
args: &Self::SighashArgs
) -> Result<GenericArray<u8, <Self::HashWriter as Digest>::OutputSize>, Self::TxError>
fn sighash(
&self,
args: &Self::SighashArgs
) -> Result<GenericArray<u8, <Self::HashWriter as Digest>::OutputSize>, Self::TxError>
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
impl RefUnwindSafe for BitcoinTx
impl UnwindSafe for BitcoinTx
Blanket Implementations
Mutably borrows from an owned value. Read more