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
sourceimpl 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>,
snapshot: Arc<Snapshot>
) -> Result<Result<BlockTemplate, AnyError>, AnyError>
pub fn get_block_template(
&self,
bytes_limit: Option<u64>,
proposals_limit: Option<u64>,
max_version: Option<Version>,
snapshot: Arc<Snapshot>
) -> Result<Result<BlockTemplate, AnyError>, AnyError>
Generate and return block_template
sourcepub fn get_block_template_with_block_assembler_config(
&self,
bytes_limit: Option<u64>,
proposals_limit: Option<u64>,
max_version: Option<Version>,
snapshot: Arc<Snapshot>,
block_assembler_config: Option<BlockAssemblerConfig>
) -> Result<Result<BlockTemplate, AnyError>, AnyError>
pub fn get_block_template_with_block_assembler_config(
&self,
bytes_limit: Option<u64>,
proposals_limit: Option<u64>,
max_version: Option<Version>,
snapshot: Arc<Snapshot>,
block_assembler_config: Option<BlockAssemblerConfig>
) -> Result<Result<BlockTemplate, AnyError>, AnyError>
Generate and return block_template with block_assembler_config
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 plug_entry(
&self,
entries: Vec<TxEntry>,
target: PlugTarget
) -> Result<(), AnyError>
pub fn plug_entry(
&self,
entries: Vec<TxEntry>,
target: PlugTarget
) -> Result<(), AnyError>
Plug tx-pool entry to tx-pool, skip verification. only for test
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 fetch_tx_for_rpc(
&self,
hash: Byte32
) -> Result<Option<(bool, TransactionView)>, AnyError>
pub fn fetch_tx_for_rpc(
&self,
hash: Byte32
) -> Result<Option<(bool, TransactionView)>, AnyError>
Return tx for rpc
sourcepub fn get_tx_status(
&self,
hash: Byte32
) -> Result<Result<TxStatus, AnyError>, AnyError>
pub fn get_tx_status(
&self,
hash: Byte32
) -> Result<Result<TxStatus, 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: Vec<ProposalShortId>
) -> Result<HashMap<ProposalShortId, TransactionView>, AnyError>
pub fn fetch_txs(
&self,
short_ids: Vec<ProposalShortId>
) -> Result<HashMap<ProposalShortId, TransactionView>, AnyError>
Return txs for network
sourcepub fn fetch_txs_with_cycles(
&self,
short_ids: Vec<ProposalShortId>
) -> Result<Vec<(ProposalShortId, (TransactionView, Cycle))>, AnyError>
pub fn fetch_txs_with_cycles(
&self,
short_ids: Vec<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 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
sourceimpl Clone for TxPoolController
impl Clone for TxPoolController
sourcefn clone(&self) -> TxPoolController
fn clone(&self) -> TxPoolController
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl !RefUnwindSafe for TxPoolController
impl Send for TxPoolController
impl Sync for TxPoolController
impl Unpin for TxPoolController
impl !UnwindSafe for TxPoolController
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more