Skip to content

Commit 28046d0

Browse files
committed
add ServerInfo ready flag
1 parent e268db5 commit 28046d0

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

client/src/rpc.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use crate::wallets::WalletInfoWithProgress;
5353
use crate::{
5454
calc_progress,
5555
checker::TxChecker,
56-
client::{BlockMeta, TxEntry},
56+
client::{BlockMeta, TxEntry, BlockchainInfo},
5757
config::ExtendedNetwork,
5858
deserialize_base64, serialize_base64,
5959
source::BitcoinRpc,
@@ -72,6 +72,7 @@ pub struct ServerInfo {
7272
pub network: String,
7373
pub tip: ChainAnchor,
7474
pub chain: ChainInfo,
75+
pub ready: bool,
7576
pub progress: f32,
7677
}
7778

@@ -1626,14 +1627,7 @@ async fn get_server_info(
16261627
rpc: &BitcoinRpc,
16271628
tip: ChainAnchor,
16281629
) -> anyhow::Result<ServerInfo> {
1629-
#[derive(Deserialize)]
1630-
struct Info {
1631-
pub chain: String,
1632-
pub headers: u32,
1633-
pub blocks: u32,
1634-
}
1635-
1636-
let info: Info = rpc
1630+
let info: BlockchainInfo = rpc
16371631
.send_json(client, &rpc.get_blockchain_info())
16381632
.await
16391633
.map_err(|e| anyhow!("Could not retrieve blockchain info ({})", e))?;
@@ -1653,6 +1647,7 @@ async fn get_server_info(
16531647
blocks: info.blocks,
16541648
headers: info.headers,
16551649
},
1650+
ready: info.headers_synced.unwrap_or(true),
16561651
progress: calc_progress(start_block, tip.height, info.headers),
16571652
})
16581653
}

0 commit comments

Comments
 (0)