Skip to content

Commit db4dc8c

Browse files
committed
refactor: move testing utilities to a common location
This allows them to be used in tests in stackslib/ or testnet/.
1 parent 3709e96 commit db4dc8c

File tree

20 files changed

+586
-576
lines changed

20 files changed

+586
-576
lines changed

stackslib/src/chainstate/stacks/tests/block_construction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5034,7 +5034,7 @@ fn paramaterized_mempool_walk_test(
50345034
fn mempool_walk_test_next_nonce_with_highest_fee_rate_strategy() {
50355035
let key_address_pairs: Vec<(Secp256k1PrivateKey, StacksAddress)> = (0..7)
50365036
.map(|_user_index| {
5037-
let privk = StacksPrivateKey::new();
5037+
let privk = StacksPrivateKey::random();
50385038
let addr = StacksAddress::from_public_keys(
50395039
C32_ADDRESS_VERSION_TESTNET_SINGLESIG,
50405040
&AddressHashMode::SerializeP2PKH,

stackslib/src/core/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub mod nonce_cache;
3434

3535
#[cfg(test)]
3636
pub mod tests;
37+
#[cfg(any(test, feature = "testing"))]
38+
pub mod util;
3739

3840
use std::cmp::Ordering;
3941
pub type StacksEpoch = GenericStacksEpoch<ExecutionCost>;

stackslib/src/core/tests/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ use crate::core::mempool::{
6464
db_get_all_nonces, MemPoolSyncData, MemPoolWalkSettings, MemPoolWalkTxTypes, TxTag,
6565
BLOOM_COUNTER_DEPTH, BLOOM_COUNTER_ERROR_RATE, MAX_BLOOM_COUNTER_TXS,
6666
};
67+
use crate::core::util::{insert_tx_in_mempool, make_stacks_transfer, to_addr};
6768
use crate::core::{FIRST_BURNCHAIN_CONSENSUS_HASH, FIRST_STACKS_BLOCK_HASH};
6869
use crate::net::Error as NetError;
6970
use crate::util_lib::bloom::test::setup_bloom_counter;

0 commit comments

Comments
 (0)