Skip to content

Commit 14cbbd1

Browse files
committed
Update bdk-reserves to 0.17 and re-enable ci tests
1 parent 7becf6f commit 14cbbd1

File tree

5 files changed

+54
-52
lines changed

5 files changed

+54
-52
lines changed

.github/workflows/cont_integration.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
- esplora-reqwest
2020
- compiler
2121
- compact_filters
22-
# - reserves
23-
# - reserves,electrum
24-
# - reserves,esplora-ureq
25-
# - reserves,compact_filters
26-
# - reserves,rpc
22+
- reserves
23+
- reserves,electrum
24+
- reserves,esplora-ureq
25+
- reserves,compact_filters
26+
- reserves,rpc
2727
- rpc
2828
- electrum,verify
2929
steps:

CHANGELOG.md

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

99
- Re-license to dual MIT and Apache 2.0 and update project name to "Bitcoin Dev Kit"
10-
- Update to bdk `0.17.0`
10+
- Update to bdk and bdk-reserves to `0.17.0`
1111
- Add 'verify' feature flag which enables transaction verification against consensus rules during sync.
1212

1313
## [0.4.0]

Cargo.lock

Lines changed: 28 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dirs-next = { version = "2.0", optional = true }
2727
env_logger = { version = "0.7", optional = true }
2828
clap = { version = "2.33", optional = true }
2929
regex = { version = "1", optional = true }
30-
bdk-reserves = { version = "0.16", optional = true}
30+
bdk-reserves = { version = "0.17", optional = true}
3131

3232
[features]
3333
default = ["cli", "repl"]

src/lib.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,15 @@ use bdk::bitcoin::secp256k1::Secp256k1;
124124
use bdk::bitcoin::util::bip32::{DerivationPath, ExtendedPrivKey, KeySource};
125125
use bdk::bitcoin::util::psbt::PartiallySignedTransaction;
126126
use bdk::bitcoin::{Address, Network, OutPoint, Script, Txid};
127-
#[cfg(feature = "reserves")]
127+
#[cfg(all(
128+
feature = "reserves",
129+
any(
130+
feature = "electrum",
131+
feature = "esplora",
132+
feature = "compact_filters",
133+
feature = "rpc"
134+
)
135+
))]
128136
use bdk::blockchain::Capability;
129137
#[cfg(any(
130138
feature = "electrum",
@@ -1136,12 +1144,11 @@ where
11361144
} => {
11371145
let psbt = base64::decode(&psbt).unwrap();
11381146
let psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();
1139-
let current_height = wallet.client().get_height()?;
1147+
let current_height = blockchain.get_height()?;
11401148
let max_confirmation_height = if confirmations == 0 {
11411149
None
11421150
} else {
1143-
if !wallet
1144-
.client()
1151+
if !blockchain
11451152
.get_capabilities()
11461153
.contains(&Capability::GetAnyTx)
11471154
{
@@ -1421,14 +1428,14 @@ mod test {
14211428
use bdk::miniscript::bitcoin::network::constants::Network::Testnet;
14221429
#[cfg(all(feature = "reserves", feature = "electrum"))]
14231430
use bdk::{
1424-
blockchain::{noop_progress, ElectrumBlockchain},
1425-
database::MemoryDatabase,
1426-
electrum_client::Client,
1427-
Wallet,
1431+
blockchain::ElectrumBlockchain, database::MemoryDatabase, electrum_client::Client, Wallet,
14281432
};
14291433
use std::str::{self, FromStr};
14301434
use structopt::StructOpt;
14311435

1436+
#[cfg(all(feature = "reserves", feature = "electrum",))]
1437+
use crate::bdk::SyncOptions;
1438+
14321439
#[test]
14331440
fn test_parse_wallet_get_new_address() {
14341441
let cli_args = vec!["bdk-cli", "--network", "bitcoin", "wallet",
@@ -2279,16 +2286,16 @@ mod test {
22792286
let message = "Those coins belong to Satoshi Nakamoto";
22802287

22812288
let client = Client::new("ssl://electrum.blockstream.info:60002").unwrap();
2289+
let blockchain = ElectrumBlockchain::from(client);
22822290
let wallet = Wallet::new(
22832291
&descriptor,
22842292
None,
22852293
Network::Testnet,
22862294
MemoryDatabase::default(),
2287-
ElectrumBlockchain::from(client),
22882295
)
22892296
.unwrap();
22902297

2291-
wallet.sync(noop_progress(), None).unwrap();
2298+
wallet.sync(&blockchain, SyncOptions::default()).unwrap();
22922299
let balance = wallet.get_balance().unwrap();
22932300

22942301
let addr = wallet.get_address(bdk::wallet::AddressIndex::New).unwrap();
@@ -2317,7 +2324,7 @@ mod test {
23172324
} => online_subcommand,
23182325
_ => panic!("unexpected subcommand"),
23192326
};
2320-
let result = handle_online_wallet_subcommand(&wallet, wallet_subcmd).unwrap();
2327+
let result = handle_online_wallet_subcommand(&wallet, &blockchain, wallet_subcmd).unwrap();
23212328
let psbt: PartiallySignedTransaction =
23222329
serde_json::from_str(&result.as_object().unwrap().get("psbt").unwrap().to_string())
23232330
.unwrap();
@@ -2355,7 +2362,7 @@ mod test {
23552362
} => online_subcommand,
23562363
_ => panic!("unexpected subcommand"),
23572364
};
2358-
let result = handle_online_wallet_subcommand(&wallet, wallet_subcmd).unwrap();
2365+
let result = handle_online_wallet_subcommand(&wallet, &blockchain, wallet_subcmd).unwrap();
23592366
let spendable = result
23602367
.as_object()
23612368
.unwrap()

0 commit comments

Comments
 (0)