Skip to content

Commit 7c50ff4

Browse files
committed
Merge branch 'master' of https://github.com/bitcoindevkit/bdk into feature/proof_of_reserves
2 parents ea9746b + 474620e commit 7c50ff4

22 files changed

+393
-689
lines changed

.github/workflows/cont_integration.yml

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,14 @@ jobs:
7878

7979
test-blockchains:
8080
name: Test ${{ matrix.blockchain.name }}
81-
runs-on: ubuntu-16.04
81+
runs-on: ubuntu-20.04
8282
strategy:
8383
fail-fast: false
8484
matrix:
8585
blockchain:
8686
- name: electrum
87-
container: bitcoindevkit/electrs:0.4.0
88-
start: /root/electrs --network regtest --cookie-file $GITHUB_WORKSPACE/.bitcoin/regtest/.cookie --jsonrpc-import
89-
- name: esplora
90-
container: bitcoindevkit/esplora:0.4.0
91-
start: /root/electrs --network regtest -vvv --daemon-dir $GITHUB_WORKSPACE/.bitcoin --jsonrpc-import --electrum-rpc-addr=0.0.0.0:60401 --http-addr 0.0.0.0:3002
9287
- name: rpc
93-
container: bitcoindevkit/electrs:0.4.0
94-
start: /root/electrs --network regtest --cookie-file $GITHUB_WORKSPACE/.bitcoin/regtest/.cookie --jsonrpc-import
95-
container: ${{ matrix.blockchain.container }}
96-
env:
97-
BDK_RPC_AUTH: COOKIEFILE
98-
BDK_RPC_COOKIEFILE: ${{ github.workspace }}/.bitcoin/regtest/.cookie
99-
BDK_RPC_URL: 127.0.0.1:18443
100-
BDK_RPC_WALLET: bdk-test
101-
BDK_ELECTRUM_URL: tcp://127.0.0.1:60401
102-
BDK_ESPLORA_URL: http://127.0.0.1:3002
88+
- name: esplora
10389
steps:
10490
- name: Checkout
10591
uses: actions/checkout@v2
@@ -108,25 +94,18 @@ jobs:
10894
with:
10995
path: |
11096
~/.cargo/registry
97+
~/.cargo/bitcoin
98+
~/.cargo/electrs
11199
~/.cargo/git
112100
target
113101
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
114-
- name: get pkg-config # running esplora tests seems to need this
115-
run: apt update && apt install -y --fix-missing pkg-config libssl-dev
116-
- name: Install rustup
117-
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
118-
- name: Set default toolchain
119-
run: $HOME/.cargo/bin/rustup default 1.53.0 # STABLE
120-
- name: Set profile
121-
run: $HOME/.cargo/bin/rustup set profile minimal
122-
- name: Update toolchain
123-
run: $HOME/.cargo/bin/rustup update
124-
- name: Start core
125-
run: ./ci/start-core.sh
126-
- name: start ${{ matrix.blockchain.name }}
127-
run: nohup ${{ matrix.blockchain.start }} & sleep 5
102+
- name: Setup rust toolchain
103+
uses: actions-rs/toolchain@v1
104+
with:
105+
toolchain: stable
106+
override: true
128107
- name: Test
129-
run: $HOME/.cargo/bin/cargo test --features test-${{ matrix.blockchain.name }},test-blockchains --no-default-features ${{ matrix.blockchain.name }}::bdk_blockchain_tests
108+
run: cargo test --features test-${{ matrix.blockchain.name }} ${{ matrix.blockchain.name }}::bdk_blockchain_tests
130109

131110
check-wasm:
132111
name: Check WASM

CHANGELOG.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88

99
### Wallet
10-
#### Added
11-
- Bitcoin core RPC added as blockchain backend
12-
- Add a `verify` feature that can be enable to verify the unconfirmed txs we download against the consensus rules
10+
11+
- Removed and replaced `set_single_recipient` with more general `drain_to` and replaced `maintain_single_recipient` with `allow_shrinking`.
12+
13+
### Blockchain
14+
15+
- Removed `stop_gap` from `Blockchain` trait and added it to only `ElectrumBlockchain` and `EsploraBlockchain` structs
16+
17+
## [v0.9.0] - [v0.8.0]
18+
19+
### Wallet
20+
21+
- Added Bitcoin core RPC added as blockchain backend
22+
- Added a `verify` feature that can be enable to verify the unconfirmed txs we download against the consensus rules
1323

1424
### Proof of reserves
1525
- Added a separate module to construct "proof of reserve" PSBTs, and verify them.
@@ -347,7 +357,7 @@ final transaction is created by calling `finish` on the builder.
347357
- Use `MemoryDatabase` in the compiler example
348358
- Make the REPL return JSON
349359

350-
[unreleased]: https://github.com/bitcoindevkit/bdk/compare/v0.8.0...HEAD
360+
[unreleased]: https://github.com/bitcoindevkit/bdk/compare/v0.9.0...HEAD
351361
[0.1.0-beta.1]: https://github.com/bitcoindevkit/bdk/compare/96c87ea5...0.1.0-beta.1
352362
[v0.2.0]: https://github.com/bitcoindevkit/bdk/compare/0.1.0-beta.1...v0.2.0
353363
[v0.3.0]: https://github.com/bitcoindevkit/bdk/compare/v0.2.0...v0.3.0
@@ -357,3 +367,4 @@ final transaction is created by calling `finish` on the builder.
357367
[v0.6.0]: https://github.com/bitcoindevkit/bdk/compare/v0.5.1...v0.6.0
358368
[v0.7.0]: https://github.com/bitcoindevkit/bdk/compare/v0.6.0...v0.7.0
359369
[v0.8.0]: https://github.com/bitcoindevkit/bdk/compare/v0.7.0...v0.8.0
370+
[v0.9.0]: https://github.com/bitcoindevkit/bdk/compare/v0.8.0...v0.9.0

Cargo.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bdk"
3-
version = "0.8.1-dev"
3+
version = "0.9.1-dev"
44
edition = "2018"
55
authors = ["Alekos Filini <[email protected]>", "Riccardo Casatta <[email protected]>"]
66
homepage = "https://bitcoindevkit.org"
@@ -31,12 +31,12 @@ cc = { version = ">=1.0.64", optional = true }
3131
socks = { version = "0.3", optional = true }
3232
lazy_static = { version = "1.4", optional = true }
3333
tiny-bip39 = { version = "^0.8", optional = true }
34+
zeroize = { version = "<1.4.0", optional = true }
3435
bitcoinconsensus = { version = "0.19.0-3", optional = true }
3536
base64 = { version = "^0.13", optional = true }
3637

3738
# Needed by bdk_blockchain_tests macro
3839
bitcoincore-rpc = { version = "0.13", optional = true }
39-
serial_test = { version = "0.4", optional = true }
4040

4141
# Platform-specific dependencies
4242
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
@@ -58,24 +58,25 @@ compact_filters = ["rocksdb", "socks", "lazy_static", "cc"]
5858
key-value-db = ["sled"]
5959
async-interface = ["async-trait"]
6060
all-keys = ["keys-bip39"]
61-
keys-bip39 = ["tiny-bip39"]
61+
keys-bip39 = ["tiny-bip39", "zeroize"]
6262
rpc = ["bitcoincore-rpc"]
6363
reserves = ["bitcoinconsensus", "base64", "electrum"]
6464

6565
# Debug/Test features
6666
test-blockchains = ["bitcoincore-rpc", "electrum-client"]
67-
test-electrum = ["electrum"]
68-
test-rpc = ["rpc"]
69-
test-esplora = ["esplora"]
67+
test-electrum = ["electrum", "electrsd/electrs_0_8_10", "test-blockchains"]
68+
test-rpc = ["rpc", "electrsd/electrs_0_8_10", "test-blockchains"]
69+
test-esplora = ["esplora", "electrsd/legacy", "electrsd/esplora_a33e97e1", "test-blockchains"]
7070
test-md-docs = ["electrum"]
7171

7272
[dev-dependencies]
7373
lazy_static = "1.4"
7474
env_logger = "0.7"
7575
clap = "2.33"
76-
serial_test = "0.4"
77-
bitcoind = "0.10.0"
76+
#serial_test = "0.4"
77+
#bitcoind = "0.10.0"
7878
rstest = "^0.10"
79+
electrsd = { version= "0.6", features = ["trigger", "bitcoind_0_21_1"] }
7980

8081
[[example]]
8182
name = "address_validator"

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,25 @@ fn main() -> Result<(), bdk::Error> {
151151
}
152152
```
153153

154+
## Testing
155+
156+
### Unit testing
157+
158+
```
159+
cargo test
160+
```
161+
162+
### Integration testing
163+
164+
Integration testing require testing features, for example:
165+
166+
```
167+
cargo test --features test-electrum
168+
```
169+
170+
The other options are `test-esplora` or `test-rpc`.
171+
Note that `electrs` and `bitcoind` binaries are automatically downloaded (on mac and linux), to specify you already have installed binaries you must use `--no-default-features` and provide `BITCOIND_EXE` and `ELECTRS_EXE` as environment variables.
172+
154173
## License
155174

156175
Licensed under either of

run_blockchain_tests.sh

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/blockchain/any.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
//!
4040
//! # #[cfg(feature = "esplora")]
4141
//! # {
42-
//! let esplora_blockchain = EsploraBlockchain::new("...", None);
42+
//! let esplora_blockchain = EsploraBlockchain::new("...", None, 20);
4343
//! let wallet_esplora: Wallet<AnyBlockchain, _> = Wallet::new(
4444
//! "...",
4545
//! None,
@@ -126,31 +126,17 @@ impl Blockchain for AnyBlockchain {
126126

127127
fn setup<D: BatchDatabase, P: 'static + Progress>(
128128
&self,
129-
stop_gap: Option<usize>,
130129
database: &mut D,
131130
progress_update: P,
132131
) -> Result<(), Error> {
133-
maybe_await!(impl_inner_method!(
134-
self,
135-
setup,
136-
stop_gap,
137-
database,
138-
progress_update
139-
))
132+
maybe_await!(impl_inner_method!(self, setup, database, progress_update))
140133
}
141134
fn sync<D: BatchDatabase, P: 'static + Progress>(
142135
&self,
143-
stop_gap: Option<usize>,
144136
database: &mut D,
145137
progress_update: P,
146138
) -> Result<(), Error> {
147-
maybe_await!(impl_inner_method!(
148-
self,
149-
sync,
150-
stop_gap,
151-
database,
152-
progress_update
153-
))
139+
maybe_await!(impl_inner_method!(self, sync, database, progress_update))
154140
}
155141

156142
fn get_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error> {
@@ -188,7 +174,8 @@ impl_from!(compact_filters::CompactFiltersBlockchain, AnyBlockchain, CompactFilt
188174
/// r#"{
189175
/// "type" : "electrum",
190176
/// "url" : "ssl://electrum.blockstream.info:50002",
191-
/// "retry": 2
177+
/// "retry": 2,
178+
/// "stop_gap": 20
192179
/// }"#,
193180
/// )
194181
/// .unwrap();
@@ -198,7 +185,8 @@ impl_from!(compact_filters::CompactFiltersBlockchain, AnyBlockchain, CompactFilt
198185
/// url: "ssl://electrum.blockstream.info:50002".into(),
199186
/// retry: 2,
200187
/// socks5: None,
201-
/// timeout: None
188+
/// timeout: None,
189+
/// stop_gap: 20,
202190
/// })
203191
/// );
204192
/// # }

src/blockchain/compact_filters/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ impl Blockchain for CompactFiltersBlockchain {
229229
#[allow(clippy::mutex_atomic)] // Mutex is easier to understand than a CAS loop.
230230
fn setup<D: BatchDatabase, P: 'static + Progress>(
231231
&self,
232-
_stop_gap: Option<usize>, // TODO: move to electrum and esplora only
233232
database: &mut D,
234233
progress_update: P,
235234
) -> Result<(), Error> {

0 commit comments

Comments
 (0)