pub trait IServerBitcoinRpc:
Debug
+ Send
+ Sync
+ 'static {
Show 13 methods
// Required methods
fn get_bitcoin_rpc_config(&self) -> BitcoinRpcConfig;
fn get_url(&self) -> SafeUrl;
fn get_block_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_block_hash<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockHash>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block_hash: &'life1 BlockHash,
) -> Pin<Box<dyn Future<Output = Result<Block>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_feerate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Feerate>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn submit_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_sync_progress<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<f64>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_chain_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ChainId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn get_block_count_and_initial_block_download<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(u64, bool)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_mempool_txids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Txid>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_mempool_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
txid: &'life1 Txid,
) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn into_dyn(self) -> DynServerBitcoinRpc
where Self: Sized { ... }
}Required Methods§
Sourcefn get_bitcoin_rpc_config(&self) -> BitcoinRpcConfig
fn get_bitcoin_rpc_config(&self) -> BitcoinRpcConfig
Returns the Bitcoin RPC config
Sourcefn get_block_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the current block count
Sourcefn get_block_hash<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockHash>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_hash<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockHash>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the block hash at a given height
§Panics
If the node does not know a block for that height. Make sure to only
query blocks of a height less to the one returned by
Self::get_block_count.
While there is a corner case that the blockchain shrinks between these two calls (through on average heavier blocks on a fork) this is prevented by only querying hashes for blocks tailing the chain tip by a certain number of blocks.
fn get_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block_hash: &'life1 BlockHash,
) -> Pin<Box<dyn Future<Output = Result<Block>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn get_feerate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Feerate>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_feerate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Feerate>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Estimates the fee rate for a given confirmation target. Make sure that
all federation members use the same algorithm to avoid widely
diverging results. If the node is not ready yet to return a fee rate
estimation this function returns None.
Sourcefn submit_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Submits a transaction to the Bitcoin network
It is never OK to consider the success of this call as final, as the
caller should be retrying broadcast periodically until it confirms the
transaction was actually accepted via other means or decides that it is
no longer relevant. The returned Result is therefore purely
informational and callers are expected to log and ignore any error.
Also - most backends considers brodcasting a tx that is already included in the blockchain as an error, which breaks idempotency and requires brittle workarounds just to reliably ignore… just to retry on the higher level anyway.
Sourcefn get_sync_progress<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<f64>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_sync_progress<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<f64>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the node’s estimated chain sync percentage as a float between
0.0 and 1.0, or None if the node doesn’t support this feature.
Sourcefn get_chain_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ChainId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_chain_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ChainId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the chain ID (block hash at height 1)
The chain ID uniquely identifies which Bitcoin network this node is
connected to. Use network_from_chain_id to derive the Network
enum from the chain ID.
Provided Methods§
Sourcefn get_block_count_and_initial_block_download<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(u64, bool)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_count_and_initial_block_download<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(u64, bool)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the current block count and whether initial block download is still active.
Backends without an explicit IBD flag are assumed ready. Full nodes should override this method when both values come from one status call.
Sourcefn get_mempool_txids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Txid>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_mempool_txids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Txid>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the ids of every transaction in the node’s mempool, or None
if the backend cannot enumerate it.
Enumerating the mempool is only possible on backends that expose the
whole of it. Esplora deliberately returns None: its mempool APIs are
per-address, and resolving a full mempool through them would take one
request per transaction.
Callers must treat None as “this backend has no mempool visibility”,
never as “the mempool is empty”.
Sourcefn get_mempool_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
txid: &'life1 Txid,
) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_mempool_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
txid: &'life1 Txid,
) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns a transaction from the node’s mempool.
None means either that the backend cannot serve mempool transactions
or that this transaction is no longer in the mempool, which is expected
when it is mined or evicted between listing and fetching it.