Skip to content

Commit 168be27

Browse files
committed
fixup! Handle conditional NodeEntropy types for UniFFI
1 parent 295b2ce commit 168be27

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

tests/common/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,18 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
12881288
println!("\nB stopped");
12891289
}
12901290

1291+
// Helper to unify entropy creation
1292+
pub(crate) fn create_test_entropy(seed: [u8; 64]) -> NodeEntropy {
1293+
#[cfg(feature = "uniffi")]
1294+
{
1295+
NodeEntropy::from_seed_bytes(seed.to_vec()).unwrap()
1296+
}
1297+
#[cfg(not(feature = "uniffi"))]
1298+
{
1299+
NodeEntropy::from_seed_bytes(seed)
1300+
}
1301+
}
1302+
12911303
// A `KVStore` impl for testing purposes that wraps all our `KVStore`s and asserts their synchronicity.
12921304
#[derive(Clone)]
12931305
pub(crate) struct TestSyncStore {

tests/integration_tests_rust.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use bitcoin::hashes::Hash;
1717
use bitcoin::{Address, Amount, ScriptBuf};
1818
use common::logging::{init_log_logger, validate_log_entry, MultiNodeLogger, TestLogWriter};
1919
use common::{
20-
bump_fee_and_broadcast, distribute_funds_unconfirmed, do_channel_full_cycle,
21-
expect_channel_pending_event, expect_channel_ready_event, expect_event,
20+
bump_fee_and_broadcast, create_test_entropy, distribute_funds_unconfirmed,
21+
do_channel_full_cycle, expect_channel_pending_event, expect_channel_ready_event, expect_event,
2222
expect_payment_claimable_event, expect_payment_received_event, expect_payment_successful_event,
2323
expect_splice_pending_event, generate_blocks_and_wait, open_channel, open_channel_push_amt,
2424
premine_and_distribute_funds, premine_blocks, prepare_rbf, random_config,
@@ -27,7 +27,6 @@ use common::{
2727
TestSyncStore,
2828
};
2929
use ldk_node::config::{AsyncPaymentsRole, EsploraSyncConfig};
30-
use ldk_node::entropy::NodeEntropy;
3130
use ldk_node::liquidity::LSPS2ServiceConfig;
3231
use ldk_node::payment::{
3332
ConfirmationStatus, PaymentDetails, PaymentDirection, PaymentKind, PaymentStatus,
@@ -2445,10 +2444,8 @@ async fn persistence_backwards_compatibility() {
24452444

24462445
let storage_path = common::random_storage_path().to_str().unwrap().to_owned();
24472446
let seed_bytes = [42u8; 64];
2448-
#[cfg(feature = "uniffi")]
2449-
let node_entropy = Arc::new(NodeEntropy::from_seed_bytes(seed_bytes.to_vec()).unwrap());
2450-
#[cfg(not(feature = "uniffi"))]
2451-
let node_entropy = NodeEntropy::from_seed_bytes(seed_bytes);
2447+
2448+
let node_entropy = create_test_entropy(seed_bytes);
24522449

24532450
// Setup a v0.6.2 `Node`
24542451
let (old_balance, old_node_id) = {
@@ -2485,7 +2482,7 @@ async fn persistence_backwards_compatibility() {
24852482
builder_new.set_storage_dir_path(storage_path);
24862483
builder_new.set_chain_source_esplora(esplora_url, None);
24872484

2488-
let node_new = builder_new.build(node_entropy).unwrap();
2485+
let node_new = builder_new.build(node_entropy.into()).unwrap();
24892486

24902487
node_new.start().unwrap();
24912488
node_new.sync_wallets().unwrap();

0 commit comments

Comments
 (0)