Skip to content

Commit f8f2cef

Browse files
committed
add: getrawmempool RPC verbose = true
This adds support for the verbose version of the getrawmempool RPC.
1 parent 27dd8be commit f8f2cef

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

client/src/client.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,13 @@ pub trait RpcApi: Sized {
867867
self.call("getrawmempool", &[])
868868
}
869869

870+
/// Get details for the transactions in a memory pool
871+
fn get_raw_mempool_verbose(
872+
&self,
873+
) -> Result<HashMap<bitcoin::Txid, json::GetMempoolEntryResult>> {
874+
self.call("getrawmempool", &[into_json(true)?])
875+
}
876+
870877
/// Get mempool data for given transaction
871878
fn get_mempool_entry(&self, txid: &bitcoin::Txid) -> Result<json::GetMempoolEntryResult> {
872879
self.call("getmempoolentry", &[into_json(txid)?])

integration_test/src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ fn main() {
156156
test_get_connection_count(&cl);
157157
test_get_raw_transaction(&cl);
158158
test_get_raw_mempool(&cl);
159+
test_get_raw_mempool_verbose(&cl);
159160
test_get_transaction(&cl);
160161
test_list_transactions(&cl);
161162
test_list_since_block(&cl);
@@ -428,6 +429,14 @@ fn test_get_raw_mempool(cl: &Client) {
428429
let _ = cl.get_raw_mempool().unwrap();
429430
}
430431

432+
fn test_get_raw_mempool_verbose(cl: &Client) {
433+
cl.send_to_address(&RANDOM_ADDRESS, btc(1), None, None, None, None, None, None).unwrap();
434+
let _ = cl.get_raw_mempool_verbose().unwrap();
435+
436+
// cleanup mempool transaction
437+
cl.generate_to_address(2, &RANDOM_ADDRESS).unwrap();
438+
}
439+
431440
fn test_get_transaction(cl: &Client) {
432441
let txid =
433442
cl.send_to_address(&RANDOM_ADDRESS, btc(1), None, None, None, None, None, None).unwrap();

0 commit comments

Comments
 (0)