Skip to content

Commit

Permalink
Update bdk-reserves to 0.17 and re-enable ci tests
Browse files Browse the repository at this point in the history
  • Loading branch information
notmandatory committed Apr 1, 2022
1 parent 7becf6f commit 14cbbd1
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 52 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- esplora-reqwest
- compiler
- compact_filters
# - reserves
# - reserves,electrum
# - reserves,esplora-ureq
# - reserves,compact_filters
# - reserves,rpc
- reserves
- reserves,electrum
- reserves,esplora-ureq
- reserves,compact_filters
- reserves,rpc
- rpc
- electrum,verify
steps:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

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

## [0.4.0]
Expand Down
61 changes: 28 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dirs-next = { version = "2.0", optional = true }
env_logger = { version = "0.7", optional = true }
clap = { version = "2.33", optional = true }
regex = { version = "1", optional = true }
bdk-reserves = { version = "0.16", optional = true}
bdk-reserves = { version = "0.17", optional = true}

[features]
default = ["cli", "repl"]
Expand Down
31 changes: 19 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,15 @@ use bdk::bitcoin::secp256k1::Secp256k1;
use bdk::bitcoin::util::bip32::{DerivationPath, ExtendedPrivKey, KeySource};
use bdk::bitcoin::util::psbt::PartiallySignedTransaction;
use bdk::bitcoin::{Address, Network, OutPoint, Script, Txid};
#[cfg(feature = "reserves")]
#[cfg(all(
feature = "reserves",
any(
feature = "electrum",
feature = "esplora",
feature = "compact_filters",
feature = "rpc"
)
))]
use bdk::blockchain::Capability;
#[cfg(any(
feature = "electrum",
Expand Down Expand Up @@ -1136,12 +1144,11 @@ where
} => {
let psbt = base64::decode(&psbt).unwrap();
let psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();
let current_height = wallet.client().get_height()?;
let current_height = blockchain.get_height()?;
let max_confirmation_height = if confirmations == 0 {
None
} else {
if !wallet
.client()
if !blockchain
.get_capabilities()
.contains(&Capability::GetAnyTx)
{
Expand Down Expand Up @@ -1421,14 +1428,14 @@ mod test {
use bdk::miniscript::bitcoin::network::constants::Network::Testnet;
#[cfg(all(feature = "reserves", feature = "electrum"))]
use bdk::{
blockchain::{noop_progress, ElectrumBlockchain},
database::MemoryDatabase,
electrum_client::Client,
Wallet,
blockchain::ElectrumBlockchain, database::MemoryDatabase, electrum_client::Client, Wallet,
};
use std::str::{self, FromStr};
use structopt::StructOpt;

#[cfg(all(feature = "reserves", feature = "electrum",))]
use crate::bdk::SyncOptions;

#[test]
fn test_parse_wallet_get_new_address() {
let cli_args = vec!["bdk-cli", "--network", "bitcoin", "wallet",
Expand Down Expand Up @@ -2279,16 +2286,16 @@ mod test {
let message = "Those coins belong to Satoshi Nakamoto";

let client = Client::new("ssl://electrum.blockstream.info:60002").unwrap();
let blockchain = ElectrumBlockchain::from(client);
let wallet = Wallet::new(
&descriptor,
None,
Network::Testnet,
MemoryDatabase::default(),
ElectrumBlockchain::from(client),
)
.unwrap();

wallet.sync(noop_progress(), None).unwrap();
wallet.sync(&blockchain, SyncOptions::default()).unwrap();
let balance = wallet.get_balance().unwrap();

let addr = wallet.get_address(bdk::wallet::AddressIndex::New).unwrap();
Expand Down Expand Up @@ -2317,7 +2324,7 @@ mod test {
} => online_subcommand,
_ => panic!("unexpected subcommand"),
};
let result = handle_online_wallet_subcommand(&wallet, wallet_subcmd).unwrap();
let result = handle_online_wallet_subcommand(&wallet, &blockchain, wallet_subcmd).unwrap();
let psbt: PartiallySignedTransaction =
serde_json::from_str(&result.as_object().unwrap().get("psbt").unwrap().to_string())
.unwrap();
Expand Down Expand Up @@ -2355,7 +2362,7 @@ mod test {
} => online_subcommand,
_ => panic!("unexpected subcommand"),
};
let result = handle_online_wallet_subcommand(&wallet, wallet_subcmd).unwrap();
let result = handle_online_wallet_subcommand(&wallet, &blockchain, wallet_subcmd).unwrap();
let spendable = result
.as_object()
.unwrap()
Expand Down

0 comments on commit 14cbbd1

Please sign in to comment.