Struct bitcoins::types::legacy::LegacySighashArgs[][src]

pub struct LegacySighashArgs {
    pub index: usize,
    pub sighash_flag: Sighash,
    pub prevout_script: Script,
}

Arguments required to serialize the transaction to create the sighash digest.Used in legacy_sighashto abstract the sighash serialization logic from the hasher used.

SIGHASH_ALL commits to ALL inputs, and ALL outputs. It indicates that no further modification of the transaction is allowed without invalidating the signature.

SIGHASH_ALL + ANYONECANPAY commits to ONE input and ALL outputs. It indicates that anyone may add additional value to the transaction, but that no one may modify the payments made. Any extra value added above the sum of output values will be given to miners as part of the tx fee.

SIGHASH_SINGLE commits to ALL inputs, and ONE output. It indicates that anyone may append additional outputs to the transaction to reroute funds from the inputs. Additional inputs cannot be added without invalidating the signature. It is logically difficult to use securely, as it consents to funds being moved, without specifying their destination.

SIGHASH_SINGLE commits specifically the the output at the same index as the input being signed. If there is no output at that index, (because, e.g. the input vector is longer than the output vector) it behaves insecurely, and we do not implement that protocol bug.

SIGHASH_SINGLE + ANYONECANPAY commits to ONE input and ONE output. It indicates that anyone may add additional value to the transaction, and route value to any other location. The signed input and output must be included in the fully-formed transaction at the same index in their respective vectors.

For Legacy sighash documentation, see here:

  • https://en.bitcoin.it/wiki/OP_CHECKSIG#Hashtype_SIGHASH_ALL_.28default.29

Note

After signing the digest, you MUST append the sighash indicator byte to the resulting signature.

Fields

index: usize

The index of the input we’d like to sign

sighash_flag: Sighash

The sighash mode to use.

prevout_script: Script

The script used in the prevout, which must be signed. In complex cases involving OP_CODESEPARATOR this must be the subset of the script containing the OP_CHECKSIG currently being executed.

Trait Implementations

impl Clone for LegacySighashArgs[src]

impl Debug for LegacySighashArgs[src]

impl Eq for LegacySighashArgs[src]

impl From<&'_ WitnessSighashArgs> for LegacySighashArgs[src]

impl PartialEq<LegacySighashArgs> for LegacySighashArgs[src]

impl StructuralEq for LegacySighashArgs[src]

impl StructuralPartialEq for LegacySighashArgs[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.