Skip to main content

TransactionInfo

Struct TransactionInfo 

Source
pub struct TransactionInfo {
    pub id: Option<String>,
    pub meta: TransactionMeta,
    pub transaction: TransactionJson,
}
Expand description

TransactionInfoDTO。

Fields§

§id: Option<String>

検索のページ送り(offset)に渡す位置。catapult の REST では MongoDB の ID、heika では高さとブロックの中の 番号と、アグリゲートの中の番号(transaction_position)。1件ずつ引く口では返さない

§meta: TransactionMeta§transaction: TransactionJson

Implementations§

Source§

impl TransactionInfo

Source

pub fn verify(&self) -> Result<Transaction, RestError>

トランザクションを組み直し、REST が一緒に返した値と、組み直したものから求めた値が合うかを確かめる。

確かめるのは、署名と連署、ハッシュ(meta.hash)、承認されていれば Merkle の葉 (meta.merkleComponentHash)。アグリゲートなら、中のトランザクションから求めた TransactionsHash と、 その高さで使えるバージョンかどうかも確かめる(高さはここにある meta.height を信じる)。 ブロックに入っていることは、Merkle の経路で別に確かめる。

Source§

impl TransactionInfo

Source

pub fn verify_aggregate_header(&self) -> Result<AggregateHeader, RestError>

検索で返る、中のトランザクションの入っていないアグリゲートを確かめる。

署名とハッシュは中のトランザクションに掛からず、TransactionsHash(バージョン 3 は中のトランザクションの 長さも)までに掛かるので、外側だけで確かめられる。長さは、REST が返す全体の size から求める。 確かめるのは、署名と連署、meta.hash、承認されていれば meta.merkleComponentHash とバージョン。 中のトランザクションが TransactionsHash と合うかは、集めてから TransactionInfo::with_embedded で確かめる。

Source

pub fn with_embedded( &self, entries: &[TransactionInfo], ) -> Result<TransactionInfo, RestError>

embedded=true の検索で平たく並んで返った中のトランザクションから、このアグリゲートのものを (meta.aggregateHash で)集め、meta.index の順に transactions に入れたものを返す。 返したものを TransactionInfo::verify にかければ、中のトランザクションまで確かめられる。

集めたものの meta.index が0から抜けなく続いていなければ弾く。

Trait Implementations§

Source§

impl Clone for TransactionInfo

Source§

fn clone(&self) -> TransactionInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TransactionInfo

Source§

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

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

impl<'de> Deserialize<'de> for TransactionInfo

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for TransactionInfo

Source§

impl PartialEq for TransactionInfo

Source§

fn eq(&self, other: &TransactionInfo) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for TransactionInfo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TransactionInfo

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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.