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
impl TxPoolController
sourcepub fn service_started(&self) -> bool
pub fn service_started(&self) -> bool
Return whether tx-pool service is started
sourcepub fn get_block_template(
&self,
bytes_limit: Option<u64>,
proposals_limit: Option<u64>,
max_version: Option<Version>
) -> Result<Result<BlockTemplate, AnyError>, AnyError>
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
sourcepub fn notify_new_uncle(&self, uncle: UncleBlockView) -> Result<(), AnyError>
pub fn notify_new_uncle(&self, uncle: UncleBlockView) -> Result<(), AnyError>
Notify new uncle
sourcepub 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>
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.
sourcepub fn submit_local_tx(
&self,
tx: TransactionView
) -> Result<Result<(), Reject>, AnyError>
pub fn submit_local_tx( &self, tx: TransactionView ) -> Result<Result<(), Reject>, AnyError>
Submit local tx to tx-pool
sourcepub fn remove_local_tx(&self, tx_hash: Byte32) -> Result<bool, AnyError>
pub fn remove_local_tx(&self, tx_hash: Byte32) -> Result<bool, AnyError>
Remove tx from tx-pool
sourcepub async fn submit_remote_tx(
&self,
tx: TransactionView,
declared_cycles: Cycle,
peer: PeerIndex
) -> Result<(), AnyError>
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
sourcepub fn notify_txs(&self, txs: Vec<TransactionView>) -> Result<(), AnyError>
pub fn notify_txs(&self, txs: Vec<TransactionView>) -> Result<(), AnyError>
Receive txs from network, try to add txs to tx-pool
sourcepub fn get_tx_pool_info(&self) -> Result<TxPoolInfo, AnyError>
pub fn get_tx_pool_info(&self) -> Result<TxPoolInfo, AnyError>
Return tx-pool information
sourcepub fn fresh_proposals_filter(
&self,
proposals: Vec<ProposalShortId>
) -> Result<Vec<ProposalShortId>, AnyError>
pub fn fresh_proposals_filter( &self, proposals: Vec<ProposalShortId> ) -> Result<Vec<ProposalShortId>, AnyError>
Return fresh proposals
sourcepub fn get_tx_status(
&self,
hash: Byte32
) -> Result<Result<(TxStatus, Option<Cycle>), AnyError>, AnyError>
pub fn get_tx_status( &self, hash: Byte32 ) -> Result<Result<(TxStatus, Option<Cycle>), AnyError>, AnyError>
Return tx_status for rpc (get_transaction verbosity = 1)
sourcepub fn get_transaction_with_status(
&self,
hash: Byte32
) -> Result<Result<TransactionWithStatus, AnyError>, AnyError>
pub fn get_transaction_with_status( &self, hash: Byte32 ) -> Result<Result<TransactionWithStatus, AnyError>, AnyError>
Return transaction_with_status for rpc (get_transaction verbosity = 2)
sourcepub fn fetch_txs(
&self,
short_ids: HashSet<ProposalShortId>
) -> Result<HashMap<ProposalShortId, TransactionView>, AnyError>
pub fn fetch_txs( &self, short_ids: HashSet<ProposalShortId> ) -> Result<HashMap<ProposalShortId, TransactionView>, AnyError>
Return txs for network
sourcepub fn fetch_txs_with_cycles(
&self,
short_ids: HashSet<ProposalShortId>
) -> Result<Vec<(ProposalShortId, (TransactionView, Cycle))>, AnyError>
pub fn fetch_txs_with_cycles( &self, short_ids: HashSet<ProposalShortId> ) -> Result<Vec<(ProposalShortId, (TransactionView, Cycle))>, AnyError>
Return txs with cycles
sourcepub fn clear_pool(&self, new_snapshot: Arc<Snapshot>) -> Result<(), AnyError>
pub fn clear_pool(&self, new_snapshot: Arc<Snapshot>) -> Result<(), AnyError>
Clears the tx-pool, removing all txs, update snapshot.
sourcepub fn get_all_entry_info(&self) -> Result<TxPoolEntryInfo, AnyError>
pub fn get_all_entry_info(&self) -> Result<TxPoolEntryInfo, AnyError>
TODO(doc): @zhangsoledad
sourcepub fn get_all_ids(&self) -> Result<TxPoolIds, AnyError>
pub fn get_all_ids(&self) -> Result<TxPoolIds, AnyError>
TODO(doc): @zhangsoledad
sourcepub fn get_tx_detail(
&self,
tx_hash: Byte32
) -> Result<PoolTxDetailInfo, AnyError>
pub fn get_tx_detail( &self, tx_hash: Byte32 ) -> Result<PoolTxDetailInfo, AnyError>
query the details of a transaction in the pool
sourcepub fn suspend_chunk_process(&self) -> Result<(), AnyError>
pub fn suspend_chunk_process(&self) -> Result<(), AnyError>
Sends suspend chunk process cmd
sourcepub fn continue_chunk_process(&self) -> Result<(), AnyError>
pub fn continue_chunk_process(&self) -> Result<(), AnyError>
Sends continue chunk process cmd
Trait Implementations§
source§impl Clone for TxPoolController
impl Clone for TxPoolController
source§fn clone(&self) -> TxPoolController
fn clone(&self) -> TxPoolController
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more