diff --git a/Cargo.1.48.0.toml b/Cargo.1.48.0.toml new file mode 100644 index 000000000..07ae482c6 --- /dev/null +++ b/Cargo.1.48.0.toml @@ -0,0 +1,5 @@ +[workspace] +members = [ + "crates/chain", + "crates/file_store", +] diff --git a/Cargo.toml b/Cargo.toml index 2104196be..a02151330 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,5 +14,5 @@ members = [ "nursery/coin_select" ] -[workspace.package] -authors = ["Bitcoin Dev Kit Developers"] +# [workspace.package] +# authors = ["Bitcoin Dev Kit Developers"] diff --git a/build-msrv-crates.sh b/build-msrv-crates.sh new file mode 100755 index 000000000..aed07a59a --- /dev/null +++ b/build-msrv-crates.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env sh +trap ' + signal=$?; + cleanup + exit $signal; +' INT + +cleanup() { + mv Cargo.tmp.toml Cargo.toml 2>/dev/null +} + +cp Cargo.toml Cargo.tmp.toml +cp Cargo.1.48.0.toml Cargo.toml +cat Cargo.toml +cargo +1.48.0 build --release +cleanup diff --git a/crates/bdk/Cargo.toml b/crates/bdk/Cargo.toml index cc95099da..4cddd113e 100644 --- a/crates/bdk/Cargo.toml +++ b/crates/bdk/Cargo.toml @@ -9,8 +9,8 @@ keywords = ["bitcoin", "wallet", "descriptor", "psbt"] readme = "README.md" license = "MIT OR Apache-2.0" authors = ["Bitcoin Dev Kit Developers"] -edition = "2021" -rust-version = "1.57" +edition = "2018" +# rust-version = "1.57" [dependencies] log = "^0.4" diff --git a/crates/bdk/tests/wallet.rs b/crates/bdk/tests/wallet.rs index 0ada20d39..3cf3ef457 100644 --- a/crates/bdk/tests/wallet.rs +++ b/crates/bdk/tests/wallet.rs @@ -3050,7 +3050,7 @@ fn test_spend_coinbase() { builder.finish(), Err(Error::InsufficientFunds { needed: _, - available: 0 + available: 0, }) )); @@ -3063,7 +3063,7 @@ fn test_spend_coinbase() { builder.finish(), Err(Error::InsufficientFunds { needed: _, - available: 0 + available: 0, }) ); diff --git a/crates/chain/Cargo.toml b/crates/chain/Cargo.toml index bb4786675..98e8c285b 100644 --- a/crates/chain/Cargo.toml +++ b/crates/chain/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "bdk_chain" version = "0.4.0" -edition = "2021" -rust-version = "1.57" +edition = "2018" +# rust-version = "1.48" homepage = "https://bitcoindevkit.org" repository = "https://github.com/bitcoindevkit/bdk" documentation = "https://docs.rs/bdk_chain" @@ -28,3 +28,4 @@ rand = "0.8" default = ["std", "miniscript"] std = [] serde = ["serde_crate", "bitcoin/serde" ] +doc_include_readme = [] diff --git a/crates/chain/README.md b/crates/chain/README.md index 02b333505..1cee1cf38 100644 --- a/crates/chain/README.md +++ b/crates/chain/README.md @@ -1,3 +1,21 @@ # BDK Chain -BDK keychain tracker, tools for storing and indexing chain data. +This crate is a collection of core structures for [Bitcoin Dev Kit] (alpha release). + +The goal of this crate is to give wallets the mechanisms needed to: + +1. Figure out what data they need to fetch. +2. Process the data in a way that never leads to inconsistent states. +3. Fully index that data and expose it to be consumed without friction. + +Our design goals for these mechanisms are: + +1. Data source agnostic -- nothing in `bdk_chain` cares about where you get data from or whether + you do it synchronously or asynchronously. If you know a fact about the blockchain, you can just + tell `bdk_chain`'s APIs about it, and that information will be integrated, if it can be done + consistently. +2. Error-free APIs. +3. Data persistence agnostic -- `bdk_chain` does not care where you cache on-chain data, what you + cache or how you fetch it. + +[Bitcoin Dev Kit]: https://bitcoindevkit.org/ diff --git a/crates/chain/src/chain_graph.rs b/crates/chain/src/chain_graph.rs index 47845c5a0..6b65fca85 100644 --- a/crates/chain/src/chain_graph.rs +++ b/crates/chain/src/chain_graph.rs @@ -30,7 +30,7 @@ pub struct ChainGraph
{ graph: TxGraph, } -impl
Default for ChainGraph
{
+impl {
fn default() -> Self {
Self {
chain: Default::default(),
diff --git a/crates/chain/src/indexed_tx_graph.rs b/crates/chain/src/indexed_tx_graph.rs
index f69b227a2..3e69b7c2a 100644
--- a/crates/chain/src/indexed_tx_graph.rs
+++ b/crates/chain/src/indexed_tx_graph.rs
@@ -16,7 +16,7 @@ pub struct IndexedTxGraph {
graph: TxGraph,
}
-impl Default for IndexedTxGraph {
+impl ) -> Self {
KeychainScan {
update,
@@ -152,7 +152,7 @@ pub struct KeychainChangeSet ,
}
-impl ) -> Self {
Self {
chain_graph: changeset,
@@ -191,7 +191,7 @@ impl > {
// TODO: `KeychainTxOutIndex::determine_additions`
- let mut derivation_indices = scan.last_active_indices.clone();
- derivation_indices.retain(|keychain, index| {
- match self.txout_index.last_revealed_index(keychain) {
- Some(existing) => *index > existing,
- None => true,
- }
- });
+ let derivation_indices = scan
+ .last_active_indices
+ .iter()
+ .filter_map(
+ |(keychain, index)| match self.txout_index.last_revealed_index(keychain) {
+ Some(existing) if *index <= existing => None,
+ _ => Some((keychain.clone(), *index)),
+ },
+ )
+ .collect:: AsRef {
}
}
-impl Default for SparseChain {
+impl {
fn default() -> Self {
Self {
checkpoints: Default::default(),
diff --git a/crates/chain/src/spk_iter.rs b/crates/chain/src/spk_iter.rs
index 97c814417..838aa0d86 100644
--- a/crates/chain/src/spk_iter.rs
+++ b/crates/chain/src/spk_iter.rs
@@ -110,7 +110,7 @@ where
fn nth(&mut self, n: usize) -> Option