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 test_accept_tx(
&self,
tx: TransactionView,
) -> Result<Result<EntryCompleted, Reject>, AnyError>
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
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 async fn notify_txs_async(
&self,
txs: Vec<TransactionView>,
) -> Result<(), AnyError>
pub async fn notify_txs_async( &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 get_live_cell(
&self,
out_point: OutPoint,
with_data: bool,
) -> Result<CellStatus, AnyError>
pub fn get_live_cell( &self, out_point: OutPoint, with_data: bool, ) -> Result<CellStatus, AnyError>
Return tx-pool information
Sourcepub async fn fresh_proposals_filter(
&self,
proposals: Vec<ProposalShortId>,
) -> Result<Vec<ProposalShortId>, AnyError>
pub async 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 async fn fetch_txs(
&self,
short_ids: HashSet<ProposalShortId>,
) -> Result<HashMap<ProposalShortId, TransactionView>, AnyError>
pub async 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.
Sourcepub async fn fetch_txs_with_cycles(
&self,
short_ids: HashSet<ProposalShortId>,
) -> Result<Vec<(ProposalShortId, (TransactionView, Cycle))>, AnyError>
pub async fn fetch_txs_with_cycles( &self, short_ids: HashSet<ProposalShortId>, ) -> Result<Vec<(ProposalShortId, (TransactionView, Cycle))>, AnyError>
Return txs with cycles Mainly for relay transactions
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 clear_verify_queue(&self) -> Result<(), AnyError>
pub fn clear_verify_queue(&self) -> Result<(), AnyError>
Clears the tx-verify-queue.
Sourcepub fn get_all_entry_info(&self) -> Result<TxPoolEntryInfo, AnyError>
pub fn get_all_entry_info(&self) -> Result<TxPoolEntryInfo, AnyError>
Returns information about all transactions in the pool.
Sourcepub fn get_all_ids(&self) -> Result<TxPoolIds, AnyError>
pub fn get_all_ids(&self) -> Result<TxPoolIds, AnyError>
Returns the IDs of all transactions in the pool.
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 estimate_fee_rate(
&self,
estimate_mode: EstimateMode,
enable_fallback: bool,
) -> Result<Result<FeeRate, AnyError>, AnyError>
pub fn estimate_fee_rate( &self, estimate_mode: EstimateMode, enable_fallback: bool, ) -> Result<Result<FeeRate, AnyError>, AnyError>
Estimates fee rate.
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
Sourcepub fn submit_local_test_tx(
&self,
tx: TransactionView,
) -> Result<Result<(), Reject>, AnyError>
pub fn submit_local_test_tx( &self, tx: TransactionView, ) -> Result<Result<(), Reject>, AnyError>
Submit local test tx to tx-pool, this tx will be put into verify queue directly.
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 moreAuto Trait Implementations§
impl Freeze for TxPoolController
impl RefUnwindSafe for TxPoolController
impl Send for TxPoolController
impl Sync for TxPoolController
impl Unpin for TxPoolController
impl UnsafeUnpin for TxPoolController
impl UnwindSafe for TxPoolController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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