diff --git a/client/src/cbf.rs b/client/src/cbf.rs index 8daed5d..2e428f0 100644 --- a/client/src/cbf.rs +++ b/client/src/cbf.rs @@ -11,7 +11,6 @@ use spaces_wallet::bdk_wallet::{KeychainKind, Update}; use spaces_wallet::bitcoin::bip158::BlockFilter; use spaces_wallet::bitcoin::ScriptBuf; use spaces_wallet::SpacesWallet; -use crate::calc_progress; use crate::client::{BlockSource, BlockchainInfo}; use crate::source::BitcoinBlockSource; use crate::wallets::{WalletStatus, WalletProgressUpdate}; diff --git a/client/src/client.rs b/client/src/client.rs index d5ea304..b056343 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -68,6 +68,8 @@ pub struct BlockchainInfo { pub checkpoint: Option, #[serde(rename = "filtersprogress", skip_serializing_if = "Option::is_none")] pub filters_progress: Option, + #[serde(rename = "headerssynced", skip_serializing_if = "Option::is_none")] + pub headers_synced: Option, } diff --git a/client/src/source.rs b/client/src/source.rs index 3366036..76a0d21 100644 --- a/client/src/source.rs +++ b/client/src/source.rs @@ -255,7 +255,10 @@ impl BitcoinRpc { retry_count += 1; } - Err(last_error.expect("an error")) + Err(last_error.unwrap_or(BitcoinRpcError::Rpc(JsonRpcError { + code: -1, + message: "Tx broadcast timed out".to_string(), + }))) } async fn send_request( @@ -323,7 +326,7 @@ impl BitcoinRpc { } } - Err(last_error.expect("an error")) + Err(last_error.unwrap()) } pub async fn clean_rpc_response( diff --git a/client/src/wallets.rs b/client/src/wallets.rs index 951e610..597ed4b 100644 --- a/client/src/wallets.rs +++ b/client/src/wallets.rs @@ -544,7 +544,8 @@ impl RpcWallet { } }; - if info.headers == 0 || + if info.headers_synced.is_some_and(|synced| !synced) || + info.headers == 0 || info.prune_height.is_some_and(|p| p > info.headers) || protocol_tip.height > info.headers { if let Some(p) = progress {