Skip to content

Commit

Permalink
chore: remove anyhow dev dependency from electrum, esplora, and…
Browse files Browse the repository at this point in the history
… `bitcoind_rpc`
  • Loading branch information
LagginTimes committed May 3, 2024
1 parent fbe1782 commit 0bf05b7
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 24 deletions.
1 change: 0 additions & 1 deletion crates/bitcoind_rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ bdk_chain = { path = "../chain", version = "0.13", default-features = false }

[dev-dependencies]
bdk_testenv = { path = "../testenv", default_features = false }
anyhow = { version = "1" }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion crates/bitcoind_rpc/tests/test_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bdk_chain::{
local_chain::{CheckPoint, LocalChain},
Append, BlockId, IndexedTxGraph, SpkTxOutIndex,
};
use bdk_testenv::TestEnv;
use bdk_testenv::{electrsd::bitcoind::anyhow, TestEnv};
use bitcoin::{hashes::Hash, Block, OutPoint, ScriptBuf, WScriptHash};
use bitcoincore_rpc::RpcApi;

Expand Down
4 changes: 1 addition & 3 deletions crates/electrum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ electrum-client = { version = "0.19" }
#rustls = { version = "=0.21.1", optional = true, features = ["dangerous_configuration"] }

[dev-dependencies]
bdk_testenv = { path = "../testenv", default-features = false }
electrsd = { version= "0.27.1", features = ["bitcoind_25_0", "esplora_a33e97e1", "legacy"] }
anyhow = "1"
bdk_testenv = { path = "../testenv", default-features = false }
7 changes: 4 additions & 3 deletions crates/electrum/tests/test_electrum.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use anyhow::Result;
use bdk_chain::{
bitcoin::{hashes::Hash, Address, Amount, ScriptBuf, WScriptHash},
keychain::Balance,
local_chain::LocalChain,
ConfirmationTimeHeightAnchor, IndexedTxGraph, SpkTxOutIndex,
};
use bdk_electrum::{ElectrumExt, ElectrumUpdate};
use bdk_testenv::TestEnv;
use electrsd::bitcoind::bitcoincore_rpc::RpcApi;
use bdk_testenv::{
electrsd::bitcoind::{anyhow, anyhow::Result, bitcoincore_rpc::RpcApi},
TestEnv,
};

fn get_balance(
recv_chain: &LocalChain,
Expand Down
1 change: 0 additions & 1 deletion crates/esplora/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ miniscript = { version = "11.0.0", optional = true, default-features = false }
bdk_testenv = { path = "../testenv", default_features = false }
electrsd = { version= "0.27.1", features = ["bitcoind_25_0", "esplora_a33e97e1", "legacy"] }
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] }
anyhow = "1"

[features]
default = ["std", "async-https", "blocking-https-rustls"]
Expand Down
16 changes: 9 additions & 7 deletions crates/esplora/src/async_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,10 @@ mod test {
local_chain::LocalChain,
BlockId,
};
use bdk_testenv::TestEnv;
use electrsd::bitcoind::bitcoincore_rpc::RpcApi;
use bdk_testenv::{
electrsd::bitcoind::{anyhow::Result, bitcoincore_rpc::RpcApi},
TestEnv,
};
use esplora_client::Builder;

use crate::async_ext::{chain_update, fetch_latest_blocks};
Expand All @@ -431,7 +433,7 @@ mod test {

/// Ensure that update does not remove heights (from original), and all anchor heights are included.
#[tokio::test]
pub async fn test_finalize_chain_update() -> anyhow::Result<()> {
pub async fn test_finalize_chain_update() -> Result<()> {
struct TestCase<'a> {
name: &'a str,
/// Initial blockchain height to start the env with.
Expand Down Expand Up @@ -494,7 +496,7 @@ mod test {
let anchors = t
.initial_cps
.iter()
.map(|&height| -> anyhow::Result<_> {
.map(|&height| -> Result<_> {
Ok((
BlockId {
height,
Expand All @@ -503,7 +505,7 @@ mod test {
Txid::all_zeros(),
))
})
.collect::<anyhow::Result<BTreeSet<_>>>()?;
.collect::<Result<BTreeSet<_>>>()?;
let update = chain_update(
&client,
&fetch_latest_blocks(&client).await?,
Expand Down Expand Up @@ -532,7 +534,7 @@ mod test {
let anchors = t
.anchors
.iter()
.map(|&(height, txid)| -> anyhow::Result<_> {
.map(|&(height, txid)| -> Result<_> {
Ok((
BlockId {
height,
Expand All @@ -541,7 +543,7 @@ mod test {
txid,
))
})
.collect::<anyhow::Result<_>>()?;
.collect::<Result<_>>()?;
chain_update(
&client,
&fetch_latest_blocks(&client).await?,
Expand Down
18 changes: 10 additions & 8 deletions crates/esplora/src/blocking_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,10 @@ mod test {
use bdk_chain::bitcoin::Txid;
use bdk_chain::local_chain::LocalChain;
use bdk_chain::BlockId;
use bdk_testenv::TestEnv;
use electrsd::bitcoind::bitcoincore_rpc::RpcApi;
use bdk_testenv::{
electrsd::bitcoind::{anyhow::Result, bitcoincore_rpc::RpcApi},
TestEnv,
};
use esplora_client::{BlockHash, Builder};
use std::collections::{BTreeMap, BTreeSet};
use std::time::Duration;
Expand All @@ -429,7 +431,7 @@ mod test {

/// Ensure that update does not remove heights (from original), and all anchor heights are included.
#[test]
pub fn test_finalize_chain_update() -> anyhow::Result<()> {
pub fn test_finalize_chain_update() -> Result<()> {
struct TestCase<'a> {
name: &'a str,
/// Initial blockchain height to start the env with.
Expand Down Expand Up @@ -492,7 +494,7 @@ mod test {
let anchors = t
.initial_cps
.iter()
.map(|&height| -> anyhow::Result<_> {
.map(|&height| -> Result<_> {
Ok((
BlockId {
height,
Expand All @@ -501,7 +503,7 @@ mod test {
Txid::all_zeros(),
))
})
.collect::<anyhow::Result<BTreeSet<_>>>()?;
.collect::<Result<BTreeSet<_>>>()?;
let update = chain_update(
&client,
&fetch_latest_blocks(&client)?,
Expand Down Expand Up @@ -529,7 +531,7 @@ mod test {
let anchors = t
.anchors
.iter()
.map(|&(height, txid)| -> anyhow::Result<_> {
.map(|&(height, txid)| -> Result<_> {
Ok((
BlockId {
height,
Expand All @@ -538,7 +540,7 @@ mod test {
txid,
))
})
.collect::<anyhow::Result<_>>()?;
.collect::<Result<_>>()?;
chain_update(
&client,
&fetch_latest_blocks(&client)?,
Expand Down Expand Up @@ -592,7 +594,7 @@ mod test {
}

#[test]
fn update_local_chain() -> anyhow::Result<()> {
fn update_local_chain() -> Result<()> {
const TIP_HEIGHT: u32 = 50;

let env = TestEnv::new()?;
Expand Down

0 comments on commit 0bf05b7

Please sign in to comment.