diff --git a/Cargo.toml b/Cargo.toml index 8e15c59..51b0e88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" @@ -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 } diff --git a/examples/example.rs b/examples/example.rs index cacb9f7..2e33355 100644 --- a/examples/example.rs +++ b/examples/example.rs @@ -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; @@ -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 diff --git a/src/builder.rs b/src/builder.rs index 26d4bd8..ad85410 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -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}; @@ -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 } diff --git a/src/lib.rs b/src/lib.rs index 34d8297..4ca940c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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}; @@ -324,7 +324,7 @@ impl UpdateSubscriber { 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); } } @@ -343,7 +343,7 @@ impl UpdateSubscriber { 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); } } @@ -353,7 +353,7 @@ impl UpdateSubscriber { .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()); } @@ -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, }, }