Skip to content

Commit ccba00e

Browse files
authored
Merge pull request #94 from buffrr/minor-fixes
Minor fixes & add headers synced for the compact node
2 parents bb58d72 + 8ffd3c4 commit ccba00e

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

client/src/cbf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use spaces_wallet::bdk_wallet::{KeychainKind, Update};
1111
use spaces_wallet::bitcoin::bip158::BlockFilter;
1212
use spaces_wallet::bitcoin::ScriptBuf;
1313
use spaces_wallet::SpacesWallet;
14-
use crate::calc_progress;
1514
use crate::client::{BlockSource, BlockchainInfo};
1615
use crate::source::BitcoinBlockSource;
1716
use crate::wallets::{WalletStatus, WalletProgressUpdate};

client/src/client.rs

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ pub struct BlockchainInfo {
6868
pub checkpoint: Option<ChainAnchor>,
6969
#[serde(rename = "filtersprogress", skip_serializing_if = "Option::is_none")]
7070
pub filters_progress: Option<f32>,
71+
#[serde(rename = "headerssynced", skip_serializing_if = "Option::is_none")]
72+
pub headers_synced: Option<bool>,
7173
}
7274

7375

client/src/source.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ impl BitcoinRpc {
255255
retry_count += 1;
256256
}
257257

258-
Err(last_error.expect("an error"))
258+
Err(last_error.unwrap_or(BitcoinRpcError::Rpc(JsonRpcError {
259+
code: -1,
260+
message: "Tx broadcast timed out".to_string(),
261+
})))
259262
}
260263

261264
async fn send_request(
@@ -323,7 +326,7 @@ impl BitcoinRpc {
323326
}
324327
}
325328

326-
Err(last_error.expect("an error"))
329+
Err(last_error.unwrap())
327330
}
328331

329332
pub async fn clean_rpc_response(

client/src/wallets.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,8 @@ impl RpcWallet {
544544
}
545545
};
546546

547-
if info.headers == 0 ||
547+
if info.headers_synced.is_some_and(|synced| !synced) ||
548+
info.headers == 0 ||
548549
info.prune_height.is_some_and(|p| p > info.headers) ||
549550
protocol_tip.height > info.headers {
550551
if let Some(p) = progress {

0 commit comments

Comments
 (0)