Skip to main content

Mempool

Struct Mempool 

Source
pub struct Mempool { /* private fields */ }
Expand description

未承認のトランザクションの置き場

Implementations§

Source§

impl Mempool

Source

pub fn new(parameters: &'static NetworkParameters, config: Config) -> Self

Source

pub fn len(&self) -> usize

持っている数

Source

pub fn is_empty(&self) -> bool

Source

pub fn bytes(&self) -> usize

持っているバイト数

Source

pub fn contains(&self, hash: &Hash256) -> bool

Source

pub fn short_hashes(&self) -> Vec<u32>

持っているものの短いハッシュ(short_hash)。ピアに Pull_Transactions で頼むとき、持っているものを伝える

Source

pub fn min_fee_multiplier(&self) -> u32

受け付ける手数料の倍率の下限。ピアに頼むときも、これより低いものは要らないと伝える

Source

pub fn deadline(&self, hash: &Hash256) -> Option<u64>

持っていれば、その期限(Nemesis からのミリ秒)

Source

pub fn add( &mut self, bytes: Vec<u8>, now: u64, height: u64, ) -> Result<Hash256, Rejected>

署名したトランザクション bytes を、今(Nemesis からのミリ秒 now)、高さ height のブロックに入れる つもりで受け付ける。いっぱいなら、手数料の倍率がこれより低いものを追い出して空ける。受け付けたらハッシュを返す

Source

pub fn add_completed( &mut self, bytes: Vec<u8>, now: u64, height: u64, ) -> Result<Hash256, Rejected>

連署を待つものの置き場(partial)で、ハッシュロックと連署が揃ったと確かめたアグリゲートボンデッドを受け付ける。 期限が maxTransactionLifetime より先でも(ボンデッドは maxBondedTransactionLifetime まで)受け付ける

Source

pub fn remove(&mut self, hash: &Hash256) -> bool

外す。ブロックに入ったもの、作ってみて弾かれたものなど。持っていたら真

Source

pub fn tip_changed( &mut self, included: &[Hash256], restored: Vec<Vec<u8>>, now: u64, height: u64, )

先端が変わった。新しい先端の枝に入ったトランザクション included を外し、巻き戻した枝から外れたもの restored を受け付け直し、期限の過ぎたものを掃除する。now と height は Mempool::add と同じ

Source

pub fn prune(&mut self, now: u64)

期限が now より前のものを外す

Source

pub fn reject(&mut self, hash: &Hash256) -> bool

ブロックを作ってみて弾かれたので外し、期限まで弾いたものとして覚える。持っていたら真。 catapult は状態に依る確かめを未承認のうちにするので、そこで弾いたものを failed と答える。heika は作るときに 確かめるので、ここで覚えたものを同じく答える

Source

pub fn rejected(&self, hash: &Hash256) -> Option<u64>

ブロックを作ってみて弾いたものなら、その期限

Source

pub fn candidates(&self, timestamp: u64) -> Vec<Candidate>

時刻 timestamp のブロックに入れられる候補。選ぶのは heika_chain::produce::choose

Source

pub fn transactions(&self) -> impl Iterator<Item = (&Hash256, &[u8])>

持っているものを、受け付けた順に(REST の /transactions/unconfirmed)

Source

pub fn get(&self, hash: &Hash256) -> Option<&[u8]>

持っていれば、そのバイト列

Source

pub fn pull( &self, min_deadline: u64, min_fee_multiplier: u32, known: &HashSet<u32>, ) -> Vec<&[u8]>

Pull_Transactions への答え(catapult の unknownTransactions)。期限が min_deadline 以上で、手数料の倍率が min_fee_multiplier 以上で、短いハッシュが known にないものを、受け付けた順に。合わせて max_response_bytes を超えるところで打ち切る

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.