Skip to content

Commit 10baef9

Browse files
committed
fix(tests): on bdk_esplora, bdk_electrum
- add new methods `list_unspent` and `get_raw_transaction_verbose` to `TestEnv`, it's need as they require specific arguments in the call, that are not available in corepc API.
1 parent 3cb1ff1 commit 10baef9

File tree

8 files changed

+324
-289
lines changed

8 files changed

+324
-289
lines changed

crates/electrum/benches/test_sync.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bdk_core::{
1010
CheckPoint,
1111
};
1212
use bdk_electrum::BdkElectrumClient;
13-
use bdk_testenv::{anyhow, bitcoincore_rpc::RpcApi, TestEnv};
13+
use bdk_testenv::{anyhow, TestEnv};
1414
use criterion::{criterion_group, criterion_main, Criterion};
1515
use electrum_client::ElectrumApi;
1616
use std::{collections::BTreeSet, time::Duration};
@@ -77,7 +77,15 @@ pub fn test_sync_performance(c: &mut Criterion) {
7777
);
7878

7979
// Setup receiver.
80-
let genesis_cp = CheckPoint::new(0, env.bitcoind.client.get_block_hash(0).unwrap());
80+
let genesis_cp = CheckPoint::new(
81+
0,
82+
env.bitcoind
83+
.client
84+
.get_block_hash(0)
85+
.unwrap()
86+
.block_hash()
87+
.unwrap(),
88+
);
8189

8290
{
8391
let electrum_client =

crates/electrum/src/bdk_electrum_client.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ mod test {
702702
use bdk_chain::bitcoin::{constants, Network, OutPoint, ScriptBuf, Transaction, TxIn};
703703
use bdk_chain::CheckPoint;
704704
use bdk_core::{collections::BTreeMap, spk_client::SyncRequest};
705-
use bdk_testenv::{anyhow, bitcoincore_rpc::RpcApi, utils::new_tx, TestEnv};
705+
use bdk_testenv::{anyhow, utils::new_tx, TestEnv};
706706
use core::time::Duration;
707707
use electrum_client::Error as ElectrumError;
708708
use std::sync::Arc;
@@ -786,13 +786,14 @@ mod test {
786786
let addr = env
787787
.rpc_client()
788788
.get_new_address(None, None)?
789+
.address()?
789790
.assume_checked();
790791
let txid = env.send(&addr, Amount::from_sat(50_000))?;
791792

792793
// Mine block that confirms transaction.
793794
env.mine_blocks(1, None)?;
794795
env.wait_until_electrum_sees_block(Duration::from_secs(6))?;
795-
let height: u32 = env.rpc_client().get_block_count()? as u32;
796+
let height: u32 = env.rpc_client().get_block_count()?.into_model().0 as u32;
796797

797798
// Add the pre-reorg block that the tx is confirmed in to the header cache.
798799
let header = electrum_client.inner.block_header(height as usize)?;

0 commit comments

Comments
 (0)