Compare commits
11 Commits
release/0.
...
v0.15.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d7c4bc810 | ||
|
|
98c26a1ad9 | ||
|
|
e82edbb7ac | ||
|
|
57a1185aef | ||
|
|
64e88f0e00 | ||
|
|
f7f9bd2409 | ||
|
|
68a3d2b1cc | ||
|
|
aa13186fb0 | ||
|
|
02980881ac | ||
|
|
084ec036a5 | ||
|
|
7f8103dd76 |
2
.github/ISSUE_TEMPLATE/summer_project.md
vendored
2
.github/ISSUE_TEMPLATE/summer_project.md
vendored
@@ -32,7 +32,7 @@ fundamentals - achievable over 12-weeks. Below are just a few types of ideas:
|
|||||||
create new innovations and new perspectives for your project.
|
create new innovations and new perspectives for your project.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
**Descriptive Title**
|
**Description**
|
||||||
<!-- Description: 3-7 sentences describing the project background and tasks to be done. -->
|
<!-- Description: 3-7 sentences describing the project background and tasks to be done. -->
|
||||||
|
|
||||||
**Expected Outcomes**
|
**Expected Outcomes**
|
||||||
|
|||||||
11
.github/workflows/cont_integration.yml
vendored
11
.github/workflows/cont_integration.yml
vendored
@@ -10,8 +10,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
rust:
|
rust:
|
||||||
- 1.56.0 # STABLE
|
- version: 1.56.0 # STABLE
|
||||||
- 1.46.0 # MSRV
|
clippy: true
|
||||||
|
- version: 1.46.0 # MSRV
|
||||||
features:
|
features:
|
||||||
- default
|
- default
|
||||||
- minimal
|
- minimal
|
||||||
@@ -31,7 +32,7 @@ jobs:
|
|||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Generate cache key
|
- name: Generate cache key
|
||||||
run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key
|
run: echo "${{ matrix.rust.version }} ${{ matrix.features }}" | tee .cache_key
|
||||||
- name: cache
|
- name: cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
@@ -41,16 +42,18 @@ jobs:
|
|||||||
target
|
target
|
||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
||||||
- name: Set default toolchain
|
- name: Set default toolchain
|
||||||
run: rustup default ${{ matrix.rust }}
|
run: rustup default ${{ matrix.rust.version }}
|
||||||
- name: Set profile
|
- name: Set profile
|
||||||
run: rustup set profile minimal
|
run: rustup set profile minimal
|
||||||
- name: Add clippy
|
- name: Add clippy
|
||||||
|
if: ${{ matrix.rust.clippy }}
|
||||||
run: rustup component add clippy
|
run: rustup component add clippy
|
||||||
- name: Update toolchain
|
- name: Update toolchain
|
||||||
run: rustup update
|
run: rustup update
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --features ${{ matrix.features }} --no-default-features
|
run: cargo build --features ${{ matrix.features }} --no-default-features
|
||||||
- name: Clippy
|
- name: Clippy
|
||||||
|
if: ${{ matrix.rust.clippy }}
|
||||||
run: cargo clippy --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings
|
run: cargo clippy --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings
|
||||||
- name: Test
|
- name: Test
|
||||||
run: cargo test --features ${{ matrix.features }} --no-default-features
|
run: cargo test --features ${{ matrix.features }} --no-default-features
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [v0.15.0] - [v0.14.0]
|
||||||
|
|
||||||
- Overhauled sync logic for electrum and esplora.
|
- Overhauled sync logic for electrum and esplora.
|
||||||
- Unify ureq and reqwest esplora backends to have the same configuration parameters. This means reqwest now has a timeout parameter and ureq has a concurrency parameter.
|
- Unify ureq and reqwest esplora backends to have the same configuration parameters. This means reqwest now has a timeout parameter and ureq has a concurrency parameter.
|
||||||
- Fixed esplora fee estimation.
|
- Fixed esplora fee estimation.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bdk"
|
name = "bdk"
|
||||||
version = "0.14.1-dev"
|
version = "0.15.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
authors = ["Alekos Filini <alekos.filini@gmail.com>", "Riccardo Casatta <riccardo@casatta.it>"]
|
authors = ["Alekos Filini <alekos.filini@gmail.com>", "Riccardo Casatta <riccardo@casatta.it>"]
|
||||||
homepage = "https://bitcoindevkit.org"
|
homepage = "https://bitcoindevkit.org"
|
||||||
@@ -94,7 +94,7 @@ test-md-docs = ["electrum"]
|
|||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
env_logger = "0.7"
|
env_logger = "0.7"
|
||||||
clap = "2.33"
|
clap = "2.33"
|
||||||
electrsd = { version= "0.12", features = ["trigger", "bitcoind_22_0"] }
|
electrsd = { version= "0.13", features = ["trigger", "bitcoind_22_0"] }
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "address_validator"
|
name = "address_validator"
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ impl ChainStore<Full> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete full blocks overriden by snapshot
|
// Delete full blocks overridden by snapshot
|
||||||
let from_key = StoreEntry::Block(Some(snaphost.min_height)).get_key();
|
let from_key = StoreEntry::Block(Some(snaphost.min_height)).get_key();
|
||||||
let to_key = StoreEntry::Block(Some(usize::MAX)).get_key();
|
let to_key = StoreEntry::Block(Some(usize::MAX)).get_key();
|
||||||
batch.delete_range(&from_key, &to_key);
|
batch.delete_range(&from_key, &to_key);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ fn after(key: &[u8]) -> Vec<u8> {
|
|||||||
/// Once it's dropped its content will be lost.
|
/// Once it's dropped its content will be lost.
|
||||||
///
|
///
|
||||||
/// If you are looking for a permanent storage solution, you can try with the default key-value
|
/// If you are looking for a permanent storage solution, you can try with the default key-value
|
||||||
/// database called [`sled`]. See the [`database`] module documentation for more defailts.
|
/// database called [`sled`]. See the [`database`] module documentation for more details.
|
||||||
///
|
///
|
||||||
/// [`database`]: crate::database
|
/// [`database`]: crate::database
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ pub trait Database: BatchOperations {
|
|||||||
fn get_raw_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error>;
|
fn get_raw_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error>;
|
||||||
/// Fetch the transaction metadata and optionally also the raw transaction
|
/// Fetch the transaction metadata and optionally also the raw transaction
|
||||||
fn get_tx(&self, txid: &Txid, include_raw: bool) -> Result<Option<TransactionDetails>, Error>;
|
fn get_tx(&self, txid: &Txid, include_raw: bool) -> Result<Option<TransactionDetails>, Error>;
|
||||||
/// Return the last defivation index for a keychain.
|
/// Return the last derivation index for a keychain.
|
||||||
fn get_last_index(&self, keychain: KeychainKind) -> Result<Option<u32>, Error>;
|
fn get_last_index(&self, keychain: KeychainKind) -> Result<Option<u32>, Error>;
|
||||||
/// Return the sync time, if present
|
/// Return the sync time, if present
|
||||||
fn get_sync_time(&self) -> Result<Option<SyncTime>, Error>;
|
fn get_sync_time(&self) -> Result<Option<SyncTime>, Error>;
|
||||||
|
|||||||
@@ -521,7 +521,7 @@ macro_rules! fragment_internal {
|
|||||||
// three operands it's (X, (X, (X, ()))), etc.
|
// three operands it's (X, (X, (X, ()))), etc.
|
||||||
//
|
//
|
||||||
// To check that the right number of arguments has been passed we can "cast" those tuples to
|
// To check that the right number of arguments has been passed we can "cast" those tuples to
|
||||||
// more convenient structures like `TupleTwo`. If the conversion succedes, the right number of
|
// more convenient structures like `TupleTwo`. If the conversion succeeds, the right number of
|
||||||
// args was passed. Otherwise the compilation fails entirely.
|
// args was passed. Otherwise the compilation fails entirely.
|
||||||
( @t $op:ident ( $( $args:tt )* ) $( $tail:tt )* ) => ({
|
( @t $op:ident ( $( $args:tt )* ) $( $tail:tt )* ) => ({
|
||||||
($crate::fragment!( $op ( $( $args )* ) ), $crate::fragment_internal!( @t $( $tail )* ))
|
($crate::fragment!( $op ( $( $args )* ) ), $crate::fragment_internal!( @t $( $tail )* ))
|
||||||
|
|||||||
@@ -667,7 +667,7 @@ mod test {
|
|||||||
|
|
||||||
// make a descriptor out of it
|
// make a descriptor out of it
|
||||||
let desc = crate::descriptor!(wpkh(key)).unwrap();
|
let desc = crate::descriptor!(wpkh(key)).unwrap();
|
||||||
// this should conver the key that supports "any_network" to the right network (testnet)
|
// this should convert the key that supports "any_network" to the right network (testnet)
|
||||||
let (wallet_desc, _) = desc
|
let (wallet_desc, _) = desc
|
||||||
.into_wallet_descriptor(&secp, Network::Testnet)
|
.into_wallet_descriptor(&secp, Network::Testnet)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|||||||
@@ -354,9 +354,9 @@ impl Satisfaction {
|
|||||||
indexes
|
indexes
|
||||||
.into_iter()
|
.into_iter()
|
||||||
// .inspect(|x| println!("--- orig --- {:?}", x))
|
// .inspect(|x| println!("--- orig --- {:?}", x))
|
||||||
// we map each of the combinations of elements into a tuple of ([choosen items], [conditions]). unfortunately, those items have potentially more than one
|
// we map each of the combinations of elements into a tuple of ([chosen items], [conditions]). unfortunately, those items have potentially more than one
|
||||||
// condition (think about ORs), so we also use `mix` to expand those, i.e. [[0], [1, 2]] becomes [[0, 1], [0, 2]]. This is necessary to make sure that we
|
// condition (think about ORs), so we also use `mix` to expand those, i.e. [[0], [1, 2]] becomes [[0, 1], [0, 2]]. This is necessary to make sure that we
|
||||||
// consider every possibile options and check whether or not they are compatible.
|
// consider every possible options and check whether or not they are compatible.
|
||||||
.map(|i_vec| {
|
.map(|i_vec| {
|
||||||
mix(i_vec
|
mix(i_vec
|
||||||
.iter()
|
.iter()
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ pub enum Error {
|
|||||||
Hex(bitcoin::hashes::hex::Error),
|
Hex(bitcoin::hashes::hex::Error),
|
||||||
/// Partially signed bitcoin transaction error
|
/// Partially signed bitcoin transaction error
|
||||||
Psbt(bitcoin::util::psbt::Error),
|
Psbt(bitcoin::util::psbt::Error),
|
||||||
/// Partially signed bitcoin transaction parseerror
|
/// Partially signed bitcoin transaction parse error
|
||||||
PsbtParse(bitcoin::util::psbt::PsbtParseError),
|
PsbtParse(bitcoin::util::psbt::PsbtParseError),
|
||||||
|
|
||||||
//KeyMismatch(bitcoin::secp256k1::PublicKey, bitcoin::secp256k1::PublicKey),
|
//KeyMismatch(bitcoin::secp256k1::PublicKey, bitcoin::secp256k1::PublicKey),
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ impl<Ctx: ScriptContext> From<bip32::ExtendedPrivKey> for ExtendedKey<Ctx> {
|
|||||||
|
|
||||||
/// Trait for keys that can be derived.
|
/// Trait for keys that can be derived.
|
||||||
///
|
///
|
||||||
/// When extra metadata are provided, a [`DerivableKey`] can be transofrmed into a
|
/// When extra metadata are provided, a [`DerivableKey`] can be transformed into a
|
||||||
/// [`DescriptorKey`]: the trait [`IntoDescriptorKey`] is automatically implemented
|
/// [`DescriptorKey`]: the trait [`IntoDescriptorKey`] is automatically implemented
|
||||||
/// for `(DerivableKey, DerivationPath)` and
|
/// for `(DerivableKey, DerivationPath)` and
|
||||||
/// `(DerivableKey, KeySource, DerivationPath)` tuples.
|
/// `(DerivableKey, KeySource, DerivationPath)` tuples.
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
//! interact with the bitcoin P2P network.
|
//! interact with the bitcoin P2P network.
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! bdk = "0.14.0"
|
//! bdk = "0.15.0"
|
||||||
//! ```
|
//! ```
|
||||||
# backend can't trick the
|
/// ensure an unstrusted [`Blockchain`](crate::blockchain::Blockchain) backend can't trick the
|
||||||
/// wallet into using an invalid tx as an RBF template.
|
/// wallet into using an invalid tx as an RBF template.
|
||||||
///
|
///
|
||||||
/// The check is only perfomed when the `verify` feature is enabled.
|
/// The check is only performed when the `verify` feature is enabled.
|
||||||
#[serde(default = "bool::default")] // default to `false` if not specified
|
#[serde(default = "bool::default")] // default to `false` if not specified
|
||||||
pub verified: bool,
|
pub verified: bool,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ impl<D: Database> CoinSelectionAlgorithm<D> for BranchAndBoundCoinSelection {
|
|||||||
|
|
||||||
impl BranchAndBoundCoinSelection {
|
impl BranchAndBoundCoinSelection {
|
||||||
// TODO: make this more Rust-onic :)
|
// TODO: make this more Rust-onic :)
|
||||||
// (And perhpaps refactor with less arguments?)
|
// (And perhaps refactor with less arguments?)
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn bnb(
|
fn bnb(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ where
|
|||||||
/// Bump the fee of a transaction previously created with this wallet.
|
/// Bump the fee of a transaction previously created with this wallet.
|
||||||
///
|
///
|
||||||
/// Returns an error if the transaction is already confirmed or doesn't explicitly signal
|
/// Returns an error if the transaction is already confirmed or doesn't explicitly signal
|
||||||
/// *repalce by fee* (RBF). If the transaction can be fee bumped then it returns a [`TxBuilder`]
|
/// *replace by fee* (RBF). If the transaction can be fee bumped then it returns a [`TxBuilder`]
|
||||||
/// pre-populated with the inputs and outputs of the original transaction.
|
/// pre-populated with the inputs and outputs of the original transaction.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
@@ -1059,7 +1059,7 @@ where
|
|||||||
&self.secp
|
&self.secp
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the descriptor used to create adddresses for a particular `keychain`.
|
/// Returns the descriptor used to create addresses for a particular `keychain`.
|
||||||
pub fn get_descriptor_for_keychain(&self, keychain: KeychainKind) -> &ExtendedDescriptor {
|
pub fn get_descriptor_for_keychain(&self, keychain: KeychainKind) -> &ExtendedDescriptor {
|
||||||
let (descriptor, _) = self._get_descriptor_for_keychain(keychain);
|
let (descriptor, _) = self._get_descriptor_for_keychain(keychain);
|
||||||
descriptor
|
descriptor
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ pub enum SignerError {
|
|||||||
InvalidNonWitnessUtxo,
|
InvalidNonWitnessUtxo,
|
||||||
/// The `witness_utxo` field of the transaction is required to sign this input
|
/// The `witness_utxo` field of the transaction is required to sign this input
|
||||||
MissingWitnessUtxo,
|
MissingWitnessUtxo,
|
||||||
/// The `witness_script` field of the transaction is requied to sign this input
|
/// The `witness_script` field of the transaction is required to sign this input
|
||||||
MissingWitnessScript,
|
MissingWitnessScript,
|
||||||
/// The fingerprint and derivation path are missing from the psbt input
|
/// The fingerprint and derivation path are missing from the psbt input
|
||||||
MissingHdKeypath,
|
MissingHdKeypath,
|
||||||
@@ -289,7 +289,7 @@ impl Signer for PrivateKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: use the presence of `witness_utxo` as an indication that we should make a bip143
|
// FIXME: use the presence of `witness_utxo` as an indication that we should make a bip143
|
||||||
// sig. Does this make sense? Should we add an extra argument to explicitly swith between
|
// sig. Does this make sense? Should we add an extra argument to explicitly switch between
|
||||||
// these? The original idea was to declare sign() as sign<Ctx: ScriptContex>() and use Ctx,
|
// these? The original idea was to declare sign() as sign<Ctx: ScriptContex>() and use Ctx,
|
||||||
// but that violates the rules for trait-objects, so we can't do it.
|
// but that violates the rules for trait-objects, so we can't do it.
|
||||||
let (hash, sighash) = match psbt.inputs[input_index].witness_utxo {
|
let (hash, sighash) = match psbt.inputs[input_index].witness_utxo {
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ impl<'a, B, D: BatchDatabase, Cs: CoinSelectionAlgorithm<D>, Ctx: TxBuilderConte
|
|||||||
/// 2. `psbt_input`: To know the value.
|
/// 2. `psbt_input`: To know the value.
|
||||||
/// 3. `satisfaction_weight`: To know how much weight/vbytes the input will add to the transaction for fee calculation.
|
/// 3. `satisfaction_weight`: To know how much weight/vbytes the input will add to the transaction for fee calculation.
|
||||||
///
|
///
|
||||||
/// There are several security concerns about adding foregin UTXOs that application
|
/// There are several security concerns about adding foreign UTXOs that application
|
||||||
/// developers should consider. First, how do you know the value of the input is correct? If a
|
/// developers should consider. First, how do you know the value of the input is correct? If a
|
||||||
/// `non_witness_utxo` is provided in the `psbt_input` then this method implicitly verifies the
|
/// `non_witness_utxo` is provided in the `psbt_input` then this method implicitly verifies the
|
||||||
/// value by checking it against the transaction. If only a `witness_utxo` is provided then this
|
/// value by checking it against the transaction. If only a `witness_utxo` is provided then this
|
||||||
|
|||||||
Reference in New Issue
Block a user