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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bdk_kyoto"
version = "0.16.0"
version = "0.17.0"
authors = ["Rob rob@2140.dev", "Bitcoin Dev Kit Developers"]
description = "BDK blockchain integration using P2P light client Kyoto"
license = "MIT OR Apache-2.0"
Expand All @@ -13,7 +13,7 @@ rust-version = "1.85.0"

[dependencies]
bdk_wallet = "3"
bip157 = { version = "0.5.0" }
bip157 = { version = "0.6.0" }

[dev-dependencies]
tokio = { version = "1", features = ["full"], default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions examples/example.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bdk_kyoto::builder::{Builder, BuilderExt};
use bdk_kyoto::{HeaderCheckpoint, Info, Receiver, ScanType, UnboundedReceiver, Warning};
use bdk_kyoto::{HashCheckpoint, Info, Receiver, ScanType, UnboundedReceiver, Warning};
use bdk_wallet::bitcoin::Network;
use bdk_wallet::{KeychainKind, Wallet};
use tokio::select;
Expand Down Expand Up @@ -50,7 +50,7 @@ async fn main() -> anyhow::Result<()> {

let scan_type = ScanType::Recovery {
used_script_index: USER_SCRIPTS_USED,
checkpoint: HeaderCheckpoint::from_genesis(NETWORK),
checkpoint: HashCheckpoint::from_genesis(NETWORK),
};

// The light client builder handles the logic of inserting the SPKs
Expand Down
8 changes: 4 additions & 4 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use bdk_wallet::{
KeychainKind, Wallet,
};
pub use bip157::Builder;
use bip157::{chain::ChainState, HeaderCheckpoint};
use bip157::{chain::ChainState, HashCheckpoint};

use crate::{state::Idle, LightClient, LoggingSubscribers, ScanType, UpdateSubscriber};

Expand Down Expand Up @@ -192,14 +192,14 @@ impl BuilderExt for Builder {
}

/// Walk back 7 blocks in case the last sync was an orphan block.
fn walk_back_max_reorg(checkpoint: CheckPoint) -> HeaderCheckpoint {
let mut ret_cp = HeaderCheckpoint::new(checkpoint.height(), checkpoint.hash());
fn walk_back_max_reorg(checkpoint: CheckPoint) -> HashCheckpoint {
let mut ret_cp = HashCheckpoint::new(checkpoint.height(), checkpoint.hash());
let cp_iter = checkpoint.iter();
for (index, next) in cp_iter.enumerate() {
if index > IMPOSSIBLE_REORG_DEPTH {
return ret_cp;
}
ret_cp = HeaderCheckpoint::new(next.height(), next.hash());
ret_cp = HashCheckpoint::new(next.height(), next.hash());
}
ret_cp
}
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use bip157::IndexedBlock;
use bip157::ScriptBuf;
#[doc(inline)]
pub use bip157::{
BlockHash, ClientError, FeeRate, HeaderCheckpoint, Info, Node, RejectPayload, RejectReason,
BlockHash, ClientError, FeeRate, HashCheckpoint, Info, Node, RejectPayload, RejectReason,
Requester, TrustedPeer, Warning, Wtxid,
};
use bip157::{Event, SyncUpdate};
Expand Down Expand Up @@ -324,7 +324,7 @@ impl<W: Wallets> UpdateSubscriber<W> {
single.apply_chain_event(&changeset);
}
if let Some(multiple) = self.multiple_updates_builder.as_mut() {
for (_id, builder) in multiple.iter_mut() {
for builder in multiple.values_mut() {
builder.apply_chain_event(&changeset);
}
}
Expand All @@ -343,7 +343,7 @@ impl<W: Wallets> UpdateSubscriber<W> {
single.apply_block_event(&block);
}
if let Some(multiple) = self.multiple_updates_builder.as_mut() {
for (_id, builder) in multiple.iter_mut() {
for builder in multiple.values_mut() {
builder.apply_block_event(&block);
}
}
Expand All @@ -353,7 +353,7 @@ impl<W: Wallets> UpdateSubscriber<W> {
.extend(single.peek_script_to_keychain_lookahead());
}
if let Some(multiple) = self.multiple_updates_builder.as_mut() {
for (_id, builder) in multiple.iter() {
for builder in multiple.values() {
self.spk_cache
.extend(builder.peek_script_to_keychain_lookahead());
}
Expand Down Expand Up @@ -535,6 +535,6 @@ pub enum ScanType {
/// The amount of scripts used by the wallet that is being recovered.
used_script_index: u32,
/// The height in the block chain to begin searching for transactions.
checkpoint: HeaderCheckpoint,
checkpoint: HashCheckpoint,
},
}
Loading