Skip to content

Commit

Permalink
add getmempoolancestors & getmempooldescendants
Browse files Browse the repository at this point in the history
  • Loading branch information
0xB10C committed Jan 12, 2024
1 parent 6a504fa commit 0866b40
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,38 @@ pub trait RpcApi: Sized {
self.call("getrawmempool", &[into_json(true)?])
}

/// Get in-mempool descendants of the [txid]
fn get_mempool_descendants(
&self,
txid: &bitcoin::Txid,
) -> Result<Vec::<bitcoin::Txid>> {
self.call("getmempooldescendants", &[into_json(txid)?])
}

/// Get in-mempool descendants details of the [txid]
fn get_mempool_descendants_verbose(
&self,
txid: &bitcoin::Txid,
) -> Result<HashMap<bitcoin::Txid, json::GetMempoolEntryResult>> {
self.call("getmempooldescendants", &[into_json(txid)?, into_json(true)?])
}

/// Get in-mempool ancestors of the [txid]
fn get_mempool_anchestors(
&self,
txid: &bitcoin::Txid,
) -> Result<Vec::<bitcoin::Txid>> {
self.call("getmempoolancestors", &[into_json(txid)?])
}

/// Get in-mempool ancestors details of the [txid]
fn get_mempool_anchestors_verbose(
&self,
txid: &bitcoin::Txid,
) -> Result<HashMap<bitcoin::Txid, json::GetMempoolEntryResult>> {
self.call("getmempoolancestors", &[into_json(txid)?, into_json(true)?])
}

/// Get mempool data for given transaction
fn get_mempool_entry(&self, txid: &bitcoin::Txid) -> Result<json::GetMempoolEntryResult> {
self.call("getmempoolentry", &[into_json(txid)?])
Expand Down

0 comments on commit 0866b40

Please sign in to comment.