Skip to content

Commit 68c78e4

Browse files
committed
Merge #1782: fix electrum conftime_req filter for needs_block_height
20100aa ci: downgrade all workflows to ubuntu to 20.04 (Steve Myers) 53fb49f ci(clippy): fix disallow ref to static mut (Steve Myers) f2e1632 ci: pin msrv dep version for ureq (Steve Myers) fa53884 ci: pin msrv dep version for rustls and hashbrown (Steve Myers) 6a5b418 ci(clippy): fix missing docs errors for rust 1.83 (Steve Myers) 341b869 ci(clippy): fix updated ptr_arg check for rust 1.83 (Steve Myers) 24ec31b ci(clippy): fix new stricter needless_lifetime errors for rust 1.83 (Steve Myers) 4aa8fba ci: update examples/rpcwallet to use electrds/bitcoind_22_1 (Steve Myers) 8d190ba fix electrum conftime_req filter for needs_block_height (Zoe Faltibà) Pull request description: <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description <!-- Describe the purpose of this PR, what's being adding and/or fixed --> This PR fixes a bug introduced in 04994e4#diff-57bf66f87897e694c5ebfdfe0fd366774dda30b43eab93c1a0fdc802d0eb8c8dR171 In that commit `block_times.get(height).is_none()` was converted to `block_times.contains_key(height)`, inverting the code logic. ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: notmandatory: ACK 20100aa oleonardolima: utACK 20100aa nymius: ACK 20100aa Tree-SHA512: 85b41b4f00273d0936172d7b845d28343b519cf698b4127dba85d45ab4030c69b6696f029bec38a58e3c2b3b17ff77620970d4c8fe20529980b13082299f5241
2 parents 8081006 + 20100aa commit 68c78e4

File tree

14 files changed

+49
-46
lines changed

14 files changed

+49
-46
lines changed

.github/workflows/code_coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
Codecov:
1515
name: Code Coverage
1616
if: false # disabled
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-20.04
1818
env:
1919
RUSTFLAGS: "-Cinstrument-coverage"
2020
RUSTDOCFLAGS: "-Cinstrument-coverage"

.github/workflows/cont_integration.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
build-test:
1616
name: Build and test
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-20.04
1818
strategy:
1919
matrix:
2020
rust:
@@ -64,8 +64,9 @@ jobs:
6464
cargo update -p regex --precise "1.7.3"
6565
cargo update -p security-framework-sys --precise "2.11.1"
6666
cargo update -p url --precise "2.5.0"
67-
cargo update -p [email protected] --precise "0.23.17"
68-
cargo update -p [email protected] --precise "0.15.0"
67+
cargo update -p [email protected] --precise "0.23.19"
68+
cargo update -p [email protected] --precise "0.15.0"
69+
cargo update -p ureq --precise "2.10.1"
6970
- name: Build
7071
run: cargo build --features bitcoin/std,miniscript/std,${{ matrix.features }} --no-default-features
7172
- name: Clippy
@@ -76,7 +77,7 @@ jobs:
7677

7778
test-readme-examples:
7879
name: Test README.md examples
79-
runs-on: ubuntu-latest
80+
runs-on: ubuntu-20.04
8081
steps:
8182
- name: checkout
8283
uses: actions/checkout@v4
@@ -166,7 +167,7 @@ jobs:
166167

167168
fmt:
168169
name: Rust fmt
169-
runs-on: ubuntu-latest
170+
runs-on: ubuntu-20.04
170171
steps:
171172
- name: Checkout
172173
uses: actions/checkout@v4

.github/workflows/nightly_docs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
jobs:
1414
build_docs:
1515
name: Build docs
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-20.04
1717
steps:
1818
- name: Checkout sources
1919
uses: actions/checkout@v4
@@ -28,7 +28,9 @@ jobs:
2828
- name: Install Rust toolchain
2929
uses: dtolnay/rust-toolchain@nightly
3030
with:
31-
components: clippy
31+
components: clippy, rustfmt
32+
- name: Cargo update
33+
run: cargo update
3234
- name: Build docs
3335
run: cargo rustdoc --verbose --features=compiler,electrum,esplora,use-esplora-blocking,compact_filters,rpc,key-value-db,sqlite,all-keys,verify,hardware-signer -- --cfg docsrs -Dwarnings
3436
- name: Upload artifact
@@ -41,7 +43,7 @@ jobs:
4143
name: 'Publish docs'
4244
if: github.ref == 'refs/heads/master'
4345
needs: [build_docs]
44-
runs-on: ubuntu-latest
46+
runs-on: ubuntu-20.04
4547
steps:
4648
- name: Checkout `bitcoindevkit.org`
4749
uses: actions/checkout@v4

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ path = "examples/policy.rs"
130130
[[example]]
131131
name = "rpcwallet"
132132
path = "examples/rpcwallet.rs"
133-
required-features = ["keys-bip39", "key-value-db", "rpc", "electrsd/bitcoind_22_0"]
133+
required-features = ["keys-bip39", "key-value-db", "rpc", "electrsd/bitcoind_22_1"]
134134

135135
[[example]]
136136
name = "psbt_signer"

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ cargo update -p home --precise "0.5.5"
215215
cargo update -p regex --precise "1.7.3"
216216
cargo update -p security-framework-sys --precise "2.11.1"
217217
cargo update -p url --precise "2.5.0"
218-
cargo update -p [email protected] --precise "0.23.17"
219-
cargo update -p [email protected] --precise "0.15.0"
218+
cargo update -p [email protected] --precise "0.23.19"
219+
cargo update -p [email protected] --precise "0.15.0"
220+
cargo update -p ureq --precise "2.10.1"
220221
```

examples/compiler.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use bdk::{KeychainKind, Wallet};
3535
/// can be derived from the policy.
3636
///
3737
/// This example demonstrates the interaction between a bdk wallet and miniscript policy.
38-
3938
fn main() -> Result<(), Box<dyn Error>> {
4039
env_logger::init_from_env(
4140
env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"),

examples/policy.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use bdk::wallet::signer::SignersContainer;
2727
///
2828
/// This example demos a Policy output for a 2of2 multisig between between 2 parties, where the wallet holds
2929
/// one of the Extend Private key.
30-
3130
fn main() -> Result<(), Box<dyn Error>> {
3231
env_logger::init_from_env(
3332
env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"),

src/blockchain/electrum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl WalletSync for ElectrumBlockchain {
168168
let needs_block_height = conftime_req
169169
.request()
170170
.filter_map(|txid| txid_to_height.get(txid).cloned())
171-
.filter(|height| block_times.contains_key(height))
171+
.filter(|height| !block_times.contains_key(height))
172172
.take(chunk_size)
173173
.collect::<HashSet<u32>>();
174174

src/database/keyvalue.rs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,13 @@ impl BatchDatabase for Tree {
405405
#[cfg(test)]
406406
mod test {
407407
use lazy_static::lazy_static;
408+
use std::sync::atomic::{AtomicUsize, Ordering};
408409
use std::sync::{Arc, Condvar, Mutex, Once};
409410
use std::time::{SystemTime, UNIX_EPOCH};
410411

411412
use sled::{Db, Tree};
412413

413-
static mut COUNT: usize = 0;
414+
static COUNT: AtomicUsize = AtomicUsize::new(0);
414415

415416
lazy_static! {
416417
static ref DB: Arc<(Mutex<Option<Db>>, Condvar)> =
@@ -419,33 +420,31 @@ mod test {
419420
}
420421

421422
fn get_tree() -> Tree {
422-
unsafe {
423-
let cloned = DB.clone();
424-
let (mutex, cvar) = &*cloned;
423+
let cloned = DB.clone();
424+
let (mutex, cvar) = &*cloned;
425425

426-
INIT.call_once(|| {
427-
let mut db = mutex.lock().unwrap();
426+
INIT.call_once(|| {
427+
let mut db = mutex.lock().unwrap();
428428

429-
let time = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
430-
let mut dir = std::env::temp_dir();
431-
dir.push(format!("mbw_{}", time.as_nanos()));
429+
let time = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
430+
let mut dir = std::env::temp_dir();
431+
dir.push(format!("mbw_{}", time.as_nanos()));
432432

433-
*db = Some(sled::open(dir).unwrap());
434-
cvar.notify_all();
435-
});
433+
*db = Some(sled::open(dir).unwrap());
434+
cvar.notify_all();
435+
});
436436

437-
let mut db = mutex.lock().unwrap();
438-
while !db.is_some() {
439-
db = cvar.wait(db).unwrap();
440-
}
437+
let mut db = mutex.lock().unwrap();
438+
while !db.is_some() {
439+
db = cvar.wait(db).unwrap();
440+
}
441441

442-
COUNT += 1;
442+
COUNT.fetch_add(1, Ordering::Relaxed);
443443

444-
db.as_ref()
445-
.unwrap()
446-
.open_tree(format!("tree_{}", COUNT))
447-
.unwrap()
448-
}
444+
db.as_ref()
445+
.unwrap()
446+
.open_tree(format!("tree_{}", COUNT.load(Ordering::Relaxed)))
447+
.unwrap()
449448
}
450449

451450
#[test]

src/database/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ pub(crate) trait DatabaseUtils: Database {
214214
impl<T: Database> DatabaseUtils for T {}
215215

216216
#[cfg(test)]
217+
#[allow(missing_docs)]
217218
pub mod test {
218219
use bitcoin::consensus::encode::deserialize;
219220
use bitcoin::consensus::serialize;

0 commit comments

Comments
 (0)