Struct elements::PeginData

source ·
pub struct PeginData<'tx> {
    pub outpoint: OutPoint,
    pub value: u64,
    pub asset: AssetId,
    pub genesis_hash: BlockHash,
    pub claim_script: &'tx [u8],
    pub tx: &'tx [u8],
    pub merkle_proof: &'tx [u8],
    pub referenced_block: BlockHash,
}
Expand description

Parsed data from a transaction input’s pegin witness

Fields§

§outpoint: OutPoint

Reference to the pegin output on the mainchain

§value: u64

The value, in satoshis, of the pegin

§asset: AssetId

Asset type being pegged in

§genesis_hash: BlockHash

Hash of genesis block of originating blockchain

§claim_script: &'tx [u8]

The claim script that we should hash to tweak our address. Unparsed to avoid unnecessary allocation and copying. Typical use is simply to feed it raw into a hash function.

§tx: &'tx [u8]

Mainchain transaction; not parsed to save time/memory since the parsed transaction is typically not useful without auxiliary data (e.g. knowing how to compute pegin addresses for the sidechain).

§merkle_proof: &'tx [u8]

Merkle proof of transaction inclusion; also not parsed

§referenced_block: BlockHash

The Bitcoin block that the pegin output appears in; scraped from the transaction inclusion proof

Implementations§

source§

impl<'tx> PeginData<'tx>

source

pub fn from_pegin_witness( pegin_witness: &'tx [Vec<u8>], prevout: OutPoint ) -> Result<PeginData<'tx>, &'static str>

Construct the pegin data from a pegin witness. Returns None if not a valid pegin witness.

source

pub fn to_pegin_witness(&self) -> Vec<Vec<u8>>

Construct a pegin witness from the pegin data.

source

pub fn parse_tx(&self) -> Result<Transaction, Error>

Parse the mainchain tx provided as pegin data.

source

pub fn parse_merkle_proof(&self) -> Result<MerkleBlock, Error>

Parse the merkle inclusion proof provided as pegin data.

Trait Implementations§

source§

impl<'tx> Clone for PeginData<'tx>

source§

fn clone(&self) -> PeginData<'tx>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'tx> Debug for PeginData<'tx>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'tx> Hash for PeginData<'tx>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'tx> PartialEq for PeginData<'tx>

source§

fn eq(&self, other: &PeginData<'tx>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'tx> Copy for PeginData<'tx>

source§

impl<'tx> Eq for PeginData<'tx>

source§

impl<'tx> StructuralPartialEq for PeginData<'tx>

Auto Trait Implementations§

§

impl<'tx> RefUnwindSafe for PeginData<'tx>

§

impl<'tx> Send for PeginData<'tx>

§

impl<'tx> Sync for PeginData<'tx>

§

impl<'tx> Unpin for PeginData<'tx>

§

impl<'tx> UnwindSafe for PeginData<'tx>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V