Skip to content

Commit 8387fa5

Browse files
committed
add ServerInfo ready flag
1 parent 646c312 commit 8387fa5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

client/src/rpc.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub struct ServerInfo {
6161
pub network: String,
6262
pub tip: ChainAnchor,
6363
pub chain: ChainInfo,
64+
pub ready: bool,
6465
pub progress: f32,
6566
}
6667

@@ -1593,12 +1594,17 @@ fn get_space_key(space_or_hash: &str) -> Result<SpaceKey, ErrorObjectOwned> {
15931594
}
15941595

15951596

1596-
async fn get_server_info(client: &reqwest::Client, rpc: &BitcoinRpc, tip: ChainAnchor) -> anyhow::Result<ServerInfo> {
1597+
async fn get_server_info(
1598+
client: &reqwest::Client,
1599+
rpc: &BitcoinRpc,
1600+
tip: ChainAnchor,
1601+
) -> anyhow::Result<ServerInfo> {
15971602
#[derive(Deserialize)]
15981603
struct Info {
15991604
pub chain: String,
16001605
pub headers: u32,
16011606
pub blocks: u32,
1607+
pub headerssynced: Option<bool>,
16021608
}
16031609

16041610
let info: Info = rpc
@@ -1621,6 +1627,7 @@ async fn get_server_info(client: &reqwest::Client, rpc: &BitcoinRpc, tip: ChainA
16211627
blocks: info.blocks,
16221628
headers: info.headers,
16231629
},
1630+
ready: info.headerssynced.unwrap_or(true),
16241631
progress: calc_progress(start_block, tip.height, info.headers),
16251632
})
16261633
}

0 commit comments

Comments
 (0)