pub struct TxPoolController { /* private fields */ }
Expand description

Controller to the tx-pool service.

The Controller is internally reference-counted and can be freely cloned. A Controller can be obtained when tx-pool service construct.

Implementations§

source§

impl TxPoolController

source

pub fn service_started(&self) -> bool

Return whether tx-pool service is started

source

pub fn handle(&self) -> &Handle

Return reference of tokio runtime handle

source

pub fn get_block_template( &self, bytes_limit: Option<u64>, proposals_limit: Option<u64>, max_version: Option<Version> ) -> Result<Result<BlockTemplate, AnyError>, AnyError>

Generate and return block_template

source

pub fn notify_new_uncle(&self, uncle: UncleBlockView) -> Result<(), AnyError>

Notify new uncle

source

pub fn update_tx_pool_for_reorg( &self, detached_blocks: VecDeque<BlockView>, attached_blocks: VecDeque<BlockView>, detached_proposal_id: HashSet<ProposalShortId>, snapshot: Arc<Snapshot> ) -> Result<(), AnyError>

Make tx-pool consistent after a reorg, by re-adding or recursively erasing detached block transactions from the tx-pool, and also removing any other transactions from the tx-pool that are no longer valid given the new tip/height.

source

pub fn submit_local_tx( &self, tx: TransactionView ) -> Result<Result<(), Reject>, AnyError>

Submit local tx to tx-pool

source

pub fn remove_local_tx(&self, tx_hash: Byte32) -> Result<bool, AnyError>

Remove tx from tx-pool

source

pub async fn submit_remote_tx( &self, tx: TransactionView, declared_cycles: Cycle, peer: PeerIndex ) -> Result<(), AnyError>

Submit remote tx with declared cycles and origin to tx-pool

source

pub fn notify_txs(&self, txs: Vec<TransactionView>) -> Result<(), AnyError>

Receive txs from network, try to add txs to tx-pool

source

pub fn get_tx_pool_info(&self) -> Result<TxPoolInfo, AnyError>

Return tx-pool information

source

pub fn fresh_proposals_filter( &self, proposals: Vec<ProposalShortId> ) -> Result<Vec<ProposalShortId>, AnyError>

Return fresh proposals

source

pub fn get_tx_status( &self, hash: Byte32 ) -> Result<Result<(TxStatus, Option<Cycle>), AnyError>, AnyError>

Return tx_status for rpc (get_transaction verbosity = 1)

source

pub fn get_transaction_with_status( &self, hash: Byte32 ) -> Result<Result<TransactionWithStatus, AnyError>, AnyError>

Return transaction_with_status for rpc (get_transaction verbosity = 2)

source

pub fn fetch_txs( &self, short_ids: HashSet<ProposalShortId> ) -> Result<HashMap<ProposalShortId, TransactionView>, AnyError>

Return txs for network

source

pub fn fetch_txs_with_cycles( &self, short_ids: HashSet<ProposalShortId> ) -> Result<Vec<(ProposalShortId, (TransactionView, Cycle))>, AnyError>

Return txs with cycles

source

pub fn clear_pool(&self, new_snapshot: Arc<Snapshot>) -> Result<(), AnyError>

Clears the tx-pool, removing all txs, update snapshot.

source

pub fn get_all_entry_info(&self) -> Result<TxPoolEntryInfo, AnyError>

TODO(doc): @zhangsoledad

source

pub fn get_all_ids(&self) -> Result<TxPoolIds, AnyError>

TODO(doc): @zhangsoledad

source

pub fn save_pool(&self) -> Result<(), AnyError>

Saves tx pool into disk.

source

pub fn suspend_chunk_process(&self) -> Result<(), AnyError>

Sends suspend chunk process cmd

source

pub fn continue_chunk_process(&self) -> Result<(), AnyError>

Sends continue chunk process cmd

Trait Implementations§

source§

impl Clone for TxPoolController

source§

fn clone(&self) -> TxPoolController

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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsAny for Twhere T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

Cast to trait Any
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more