Skip to content

Commit ae07195

Browse files
committed
Allow to specify seed bytes in setup_node test util
1 parent 9d6a63f commit ae07195

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

tests/common/mod.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ pub(crate) fn setup_two_nodes(
264264
) -> (TestNode, TestNode) {
265265
println!("== Node A ==");
266266
let config_a = random_config(anchor_channels);
267-
let node_a = setup_node(chain_source, config_a);
267+
let node_a = setup_node(chain_source, config_a, None);
268268

269269
println!("\n== Node B ==");
270270
let mut config_b = random_config(anchor_channels);
@@ -279,11 +279,13 @@ pub(crate) fn setup_two_nodes(
279279
.trusted_peers_no_reserve
280280
.push(node_a.node_id());
281281
}
282-
let node_b = setup_node(chain_source, config_b);
282+
let node_b = setup_node(chain_source, config_b, None);
283283
(node_a, node_b)
284284
}
285285

286-
pub(crate) fn setup_node(chain_source: &TestChainSource, config: Config) -> TestNode {
286+
pub(crate) fn setup_node(
287+
chain_source: &TestChainSource, config: Config, seed_bytes: Option<Vec<u8>>,
288+
) -> TestNode {
287289
setup_builder!(builder, config);
288290
match chain_source {
289291
TestChainSource::Esplora(electrsd) => {
@@ -302,6 +304,11 @@ pub(crate) fn setup_node(chain_source: &TestChainSource, config: Config) -> Test
302304
builder.set_chain_source_bitcoind_rpc(rpc_host, rpc_port, rpc_user, rpc_password);
303305
},
304306
}
307+
308+
if let Some(seed) = seed_bytes {
309+
builder.set_entropy_seed_bytes(seed).unwrap();
310+
}
311+
305312
let test_sync_store = Arc::new(TestSyncStore::new(config.storage_dir_path.into()));
306313
let node = builder.build_with_store(test_sync_store).unwrap();
307314
node.start().unwrap();

tests/integration_tests_rust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ fn sign_verify_msg() {
320320
let (_bitcoind, electrsd) = setup_bitcoind_and_electrsd();
321321
let config = random_config(true);
322322
let chain_source = TestChainSource::Esplora(&electrsd);
323-
let node = setup_node(&chain_source, config);
323+
let node = setup_node(&chain_source, config, None);
324324

325325
// Tests arbitrary message signing and later verification
326326
let msg = "OK computer".as_bytes();

0 commit comments

Comments
 (0)