Skip to content

Minor fixes & add headers synced for the compact node #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion client/src/cbf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 2 additions & 0 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ pub struct BlockchainInfo {
pub checkpoint: Option<ChainAnchor>,
#[serde(rename = "filtersprogress", skip_serializing_if = "Option::is_none")]
pub filters_progress: Option<f32>,
#[serde(rename = "headerssynced", skip_serializing_if = "Option::is_none")]
pub headers_synced: Option<bool>,
}


Expand Down
7 changes: 5 additions & 2 deletions client/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -323,7 +326,7 @@ impl BitcoinRpc {
}
}

Err(last_error.expect("an error"))
Err(last_error.unwrap())
}

pub async fn clean_rpc_response(
Expand Down
3 changes: 2 additions & 1 deletion client/src/wallets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading