Skip to content

Commit 1364d2c

Browse files
committed
move tx_template from chain to testenv
- update chain to use tx_template from testenv - update imports in cargo.toml files - update imports in test files - update imports in testenv/src/lib.rs - delete chain/tests/common/mod.rs file [Issue: 1754]
1 parent 82a2423 commit 1364d2c

File tree

8 files changed

+25
-30
lines changed

8 files changed

+25
-30
lines changed

crates/chain/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rusqlite = { version = "0.31.0", features = ["bundled"], optional = true }
2727
[dev-dependencies]
2828
rand = "0.8"
2929
proptest = "1.2.0"
30-
bdk_testenv = { path = "../testenv", default-features = false }
30+
bdk_testenv = { path = "../testenv", default-features = false, features = ["miniscript"] }
3131
criterion = { version = "0.2" }
3232

3333
[features]

crates/chain/tests/common/mod.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

crates/chain/tests/test_indexed_tx_graph.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#![cfg(feature = "miniscript")]
22

3-
#[macro_use]
4-
mod common;
5-
63
use std::{collections::BTreeSet, sync::Arc};
74

85
use bdk_chain::{

crates/chain/tests/test_tx_graph.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
#![cfg(feature = "miniscript")]
22

3-
#[macro_use]
4-
mod common;
53
use bdk_chain::{collections::*, BlockId, ConfirmationBlockTime};
64
use bdk_chain::{
75
local_chain::LocalChain,
86
tx_graph::{self, CalculateFeeError},
97
tx_graph::{ChangeSet, TxGraph},
108
Anchor, ChainOracle, ChainPosition, Merge,
119
};
12-
use bdk_testenv::{block_id, hash, utils::new_tx};
10+
use bdk_testenv::{
11+
block_id, hash,
12+
tx_template::{init_graph, TxInTemplate, TxOutTemplate, TxTemplate},
13+
utils::new_tx,
14+
};
1315
use bitcoin::{
1416
absolute, hashes::Hash, transaction, Amount, BlockHash, OutPoint, ScriptBuf, SignedAmount,
1517
Transaction, TxIn, TxOut, Txid,
1618
};
17-
use common::*;
1819
use core::iter;
1920
use rand::RngCore;
2021
use std::sync::Arc;

crates/chain/tests/test_tx_graph_conflicts.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#![cfg(feature = "miniscript")]
22

3-
#[macro_use]
4-
mod common;
5-
63
use bdk_chain::{Balance, BlockId};
7-
use bdk_testenv::{block_id, hash, local_chain};
4+
use bdk_testenv::{
5+
block_id, hash, local_chain,
6+
tx_template::{init_graph, TxInTemplate, TxOutTemplate, TxTemplate},
7+
};
88
use bitcoin::{Amount, OutPoint, ScriptBuf};
9-
use common::*;
109
use std::collections::{BTreeSet, HashSet};
1110

1211
#[allow(dead_code)]

crates/testenv/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ workspace = true
1818
[dependencies]
1919
bdk_chain = { path = "../chain", version = "0.21.1", default-features = false }
2020
electrsd = { version = "0.28.0", features = [ "legacy" ], default-features = false }
21-
22-
[dev-dependencies]
23-
bdk_testenv = { path = "." }
21+
rand = "0.8"
2422

2523
[features]
2624
default = ["std", "download"]
2725
download = ["electrsd/bitcoind_25_0", "electrsd/esplora_a33e97e1"]
2826
std = ["bdk_chain/std"]
2927
serde = ["bdk_chain/serde"]
28+
miniscript = ["bdk_chain/miniscript"]
3029

3130
[package.metadata.docs.rs]
32-
no-default-features = true
31+
no-default-features = true

crates/testenv/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
pub mod tx_template;
12
pub mod utils;
23

34
use bdk_chain::{

crates/chain/tests/common/tx_template.rs renamed to crates/testenv/src/tx_template.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
#![cfg(feature = "miniscript")]
22

3-
use bdk_testenv::utils::DESCRIPTORS;
3+
use crate::utils::DESCRIPTORS;
4+
use bdk_chain::{
5+
bitcoin::{
6+
self, locktime::absolute::LockTime, secp256k1::Secp256k1, transaction, Amount, OutPoint,
7+
ScriptBuf, Sequence, Transaction, TxIn, TxOut, Txid, Witness,
8+
},
9+
miniscript::Descriptor,
10+
spk_txout::SpkTxOutIndex,
11+
tx_graph::TxGraph,
12+
Anchor,
13+
};
414
use rand::distributions::{Alphanumeric, DistString};
515
use std::collections::HashMap;
616

7-
use bdk_chain::{spk_txout::SpkTxOutIndex, tx_graph::TxGraph, Anchor};
8-
use bitcoin::{
9-
locktime::absolute::LockTime, secp256k1::Secp256k1, transaction, Amount, OutPoint, ScriptBuf,
10-
Sequence, Transaction, TxIn, TxOut, Txid, Witness,
11-
};
12-
use miniscript::Descriptor;
13-
1417
/// Template for creating a transaction in `TxGraph`.
1518
///
1619
/// The incentive for transaction templates is to create a transaction history in a simple manner to

0 commit comments

Comments
 (0)