Struct ckb_tx_pool::service::TxPoolController

source ·
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 test_accept_tx( &self, tx: TransactionView, ) -> Result<Result<EntryCompleted, Reject>, AnyError>

test if a tx can be accepted by tx-pool Won’t be broadcasted to network won’t be insert 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 get_live_cell( &self, out_point: OutPoint, with_data: bool, ) -> Result<CellStatus, 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>

Mainly used for compact block reconstruction and block proposal pre-broadcasting Orphan/conflicted/etc transactions that are returned for compact block reconstruction.

source

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

Return txs with cycles Mainly for relay transactions

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 get_tx_detail( &self, tx_hash: Byte32, ) -> Result<PoolTxDetailInfo, AnyError>

query the details of a transaction in the pool

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for T
where T: Any,

source§

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

Cast to trait Any
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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

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

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

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

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

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 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
source§

impl<T> Same for T

§

type Output = T

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

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

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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