Skip to content

Commit b469e3f

Browse files
committed
Merge #275: Add getmempoolinfo
0f1c9f8 Add getmempoolinfo (dev7ba) Pull request description: I've added getmempoolinfo to the client. ACKs for top commit: apoelstra: ACK 0f1c9f8 Tree-SHA512: 787b43a705b221d8f48e4313e682d5c0f7255ddf9d0cdf204811341c3d5117d9b3740faa43dc3abad3d6fc47efc3f772d48e2be340bfaaeb070f7566c25dfb36
2 parents 7e141b6 + 0f1c9f8 commit b469e3f

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

client/src/client.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,11 @@ pub trait RpcApi: Sized {
922922
self.call("reconsiderblock", &[into_json(block_hash)?])
923923
}
924924

925+
/// Returns details on the active state of the TX memory pool
926+
fn get_mempool_info(&self) -> Result<json::GetMempoolInfoResult> {
927+
self.call("getmempoolinfo", &[])
928+
}
929+
925930
/// Get txids of all transactions in a memory pool
926931
fn get_raw_mempool(&self) -> Result<Vec<bitcoin::Txid>> {
927932
self.call("getrawmempool", &[])

json/src/lib.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,39 @@ pub enum ImportMultiRequestScriptPubkey<'a> {
10451045
Script(&'a Script),
10461046
}
10471047

1048+
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
1049+
pub struct GetMempoolInfoResult {
1050+
/// True if the mempool is fully loaded
1051+
pub loaded: bool,
1052+
/// Current tx count
1053+
pub size: usize,
1054+
/// Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted
1055+
pub bytes: usize,
1056+
/// Total memory usage for the mempool
1057+
pub usage: usize,
1058+
/// Total fees for the mempool in BTC, ignoring modified fees through prioritisetransaction
1059+
#[serde(with = "bitcoin::util::amount::serde::as_btc")]
1060+
pub total_fee: Amount,
1061+
/// Maximum memory usage for the mempool
1062+
#[serde(rename = "maxmempool")]
1063+
pub max_mempool: usize,
1064+
/// Minimum fee rate in BTC/kvB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee
1065+
#[serde(rename = "mempoolminfee", with = "bitcoin::util::amount::serde::as_btc")]
1066+
pub mempool_min_fee: Amount,
1067+
/// Current minimum relay fee for transactions
1068+
#[serde(rename = "minrelaytxfee", with = "bitcoin::util::amount::serde::as_btc")]
1069+
pub min_relay_tx_fee: Amount,
1070+
/// Minimum fee rate increment for mempool limiting or replacement in BTC/kvB
1071+
#[serde(rename = "incrementalrelayfee", with = "bitcoin::util::amount::serde::as_btc")]
1072+
pub incremental_relay_fee: Amount,
1073+
/// Current number of transactions that haven't passed initial broadcast yet
1074+
#[serde(rename = "unbroadcastcount")]
1075+
pub unbroadcast_count: usize,
1076+
/// True if the mempool accepts RBF without replaceability signaling inspection
1077+
#[serde(rename = "fullrbf")]
1078+
pub full_rbf: bool,
1079+
}
1080+
10481081
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
10491082
pub struct GetMempoolEntryResult {
10501083
/// Virtual transaction size as defined in BIP 141. This is different from actual serialized

0 commit comments

Comments
 (0)