Skip to content

Commit 54bed69

Browse files
committed
f: drop is_listening and add test
1 parent d8f967c commit 54bed69

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

bindings/ldk_node.udl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ enum NodeError {
324324

325325
dictionary NodeStatus {
326326
boolean is_running;
327-
boolean is_listening;
328327
BestBlock current_best_block;
329328
u64? latest_lightning_wallet_sync_timestamp;
330329
u64? latest_onchain_wallet_sync_timestamp;

src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,6 @@ impl Node {
688688
/// Returns the status of the [`Node`].
689689
pub fn status(&self) -> NodeStatus {
690690
let is_running = *self.is_running.read().unwrap();
691-
let is_listening =
692-
is_running && self.config.listening_addresses.as_ref().map_or(false, |v| !v.is_empty());
693691
let current_best_block = self.channel_manager.current_best_block().into();
694692
let locked_node_metrics = self.node_metrics.read().unwrap();
695693
let latest_lightning_wallet_sync_timestamp =
@@ -707,7 +705,6 @@ impl Node {
707705

708706
NodeStatus {
709707
is_running,
710-
is_listening,
711708
current_best_block,
712709
latest_lightning_wallet_sync_timestamp,
713710
latest_onchain_wallet_sync_timestamp,
@@ -1518,9 +1515,6 @@ impl Drop for Node {
15181515
pub struct NodeStatus {
15191516
/// Indicates whether the [`Node`] is running.
15201517
pub is_running: bool,
1521-
/// Indicates whether the [`Node`] is listening for incoming connections on the addresses
1522-
/// configured via [`Config::listening_addresses`].
1523-
pub is_listening: bool,
15241518
/// The best block to which our Lightning wallet is currently synced.
15251519
pub current_best_block: BestBlock,
15261520
/// The timestamp, in seconds since start of the UNIX epoch, when we last successfully synced

tests/integration_tests_rust.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,21 @@ fn sign_verify_msg() {
822822
assert!(node.verify_signature(msg, sig.as_str(), &pkey));
823823
}
824824

825+
#[test]
826+
fn connection_multi_listen() {
827+
let (_bitcoind, electrsd) = setup_bitcoind_and_electrsd();
828+
let chain_source = TestChainSource::Esplora(&electrsd);
829+
let (node_a, node_b) = setup_two_nodes(&chain_source, false, false, false);
830+
831+
let node_id_b = node_b.node_id();
832+
833+
let node_addrs_b = node_b.listening_addresses().unwrap();
834+
for node_addr_b in &node_addrs_b {
835+
node_a.connect(node_id_b, node_addr_b.clone(), false).unwrap();
836+
node_a.disconnect(node_id_b).unwrap();
837+
}
838+
}
839+
825840
#[test]
826841
fn connection_restart_behavior() {
827842
do_connection_restart_behavior(true);
@@ -837,8 +852,6 @@ fn do_connection_restart_behavior(persist: bool) {
837852
let node_id_b = node_b.node_id();
838853

839854
let node_addr_b = node_b.listening_addresses().unwrap().first().unwrap().clone();
840-
assert!(node_b.status().is_listening);
841-
842855
node_a.connect(node_id_b, node_addr_b, persist).unwrap();
843856

844857
let peer_details_a = node_a.list_peers().first().unwrap().clone();
@@ -887,7 +900,6 @@ fn concurrent_connections_succeed() {
887900

888901
let node_id_b = node_b.node_id();
889902
let node_addr_b = node_b.listening_addresses().unwrap().first().unwrap().clone();
890-
assert!(node_b.status().is_listening);
891903

892904
let mut handles = Vec::new();
893905
for _ in 0..10 {

0 commit comments

Comments
 (0)