Skip to content

Commit 4223190

Browse files
committed
Merge #282: Added get_index_info rpc call
da66753 Added get_index_info rpc call (dev7ba) Pull request description: Added get_index_info rpc call for the three known indexes: txindex, coinstatsindex and basic block filter index. ACKs for top commit: apoelstra: ACK da66753 Tree-SHA512: ee085bdd93badfc81f0a8adf4b428d5695d9f0425f61a0763c1a330b42ab2708df7be473f9022e5b0fffe580437bc5f6399e4cb530f915580f1d7fc248abbc79
2 parents b469e3f + da66753 commit 4223190

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

client/src/client.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ pub trait RpcApi: Sized {
237237
self.call("getnetworkinfo", &[])
238238
}
239239

240+
fn get_index_info(&self) -> Result<json::GetIndexInfoResult> {
241+
self.call("getindexinfo", &[])
242+
}
243+
240244
fn version(&self) -> Result<usize> {
241245
#[derive(Deserialize)]
242246
struct Response {

json/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,20 @@ pub struct Utxo {
21172117
pub height: u64,
21182118
}
21192119

2120+
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
2121+
pub struct IndexStatus {
2122+
pub synced: bool,
2123+
pub best_block_height: u32,
2124+
}
2125+
2126+
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
2127+
pub struct GetIndexInfoResult {
2128+
pub txindex: IndexStatus,
2129+
pub coinstatsindex: IndexStatus,
2130+
#[serde(rename = "basic block filter index")]
2131+
pub basic_block_filter_index: IndexStatus,
2132+
}
2133+
21202134
impl<'a> serde::Serialize for PubKeyOrAddress<'a> {
21212135
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
21222136
where

0 commit comments

Comments
 (0)