Skip to content
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ lightning-dns-resolver = { git = "https://github.com/lightningdevkit/rust-lightn
bdk_chain = { version = "0.23.0", default-features = false, features = ["std"] }
bdk_esplora = { version = "0.22.0", default-features = false, features = ["async-https-rustls", "tokio"]}
bdk_electrum = { version = "0.23.0", default-features = false, features = ["use-rustls-ring"]}
bip157 = { version = "0.5.0", default-features = false }
bip157 = { version = "0.6.0", default-features = false }
bdk_wallet = { version = "2.3.0", default-features = false, features = ["std", "keys-bip39"]}

bitreq = { version = "0.3", default-features = false, features = ["async-https", "json-using-serde"] }
Expand Down
13 changes: 10 additions & 3 deletions src/chain/cbf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use bdk_wallet::{KeychainKind, Update};
use bip157::chain::{BlockHeaderChanges, ChainState};
use bip157::error::FetchBlockError;
use bip157::{
BlockHash, Builder, Client, Event, HeaderCheckpoint, Info, Node as CbfNode, Requester,
BlockHash, Builder, Client, Event, HashCheckpoint, Info, Node as CbfNode, Requester,
SyncUpdate, TrustedPeer, Warning,
};
use bitcoin::constants::SUBSIDY_HALVING_INTERVAL;
Expand Down Expand Up @@ -242,7 +242,7 @@ impl CbfChainSource {
}
}
if cursor.height() > 0 {
let header_cp = HeaderCheckpoint::new(cursor.height(), cursor.hash());
let header_cp = HashCheckpoint::new(cursor.height(), cursor.hash());
builder = builder.chain_state(ChainState::Checkpoint(header_cp));
log_debug!(
logger,
Expand Down Expand Up @@ -548,7 +548,14 @@ impl CbfChainSource {
let (tx, rx) = oneshot::channel();
*self.sync_completion_tx.lock().expect("lock") = Some(tx);

if let Err(e) = requester.rescan().map_err(|e| {
// Delegate the skip to kyoto so it doesn't re-stream filters we would discard
// client-side via filter_skip_height. Without `_from`, kyoto replays from its
// build-time checkpoint (potentially genesis on a fresh wallet) every tick.
let rescan_res = match skip_before_height {
Some(h) => requester.rescan_from(h),
None => requester.rescan(),
};
if let Err(e) = rescan_res.map_err(|e| {
log_error!(self.logger, "Failed to trigger CBF rescan: {:?}", e);
Error::WalletOperationFailed
}) {
Expand Down
Loading