Skip to content

Commit a0e1231

Browse files
committed
f: drop is_listening and add test
1 parent ad5408b commit a0e1231

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
@@ -325,7 +325,6 @@ enum NodeError {
325325

326326
dictionary NodeStatus {
327327
boolean is_running;
328-
boolean is_listening;
329328
BestBlock current_best_block;
330329
u64? latest_lightning_wallet_sync_timestamp;
331330
u64? latest_onchain_wallet_sync_timestamp;

src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,6 @@ impl Node {
679679
/// Returns the status of the [`Node`].
680680
pub fn status(&self) -> NodeStatus {
681681
let is_running = *self.is_running.read().unwrap();
682-
let is_listening =
683-
is_running && self.config.listening_addresses.as_ref().map_or(false, |v| !v.is_empty());
684682
let current_best_block = self.channel_manager.current_best_block().into();
685683
let locked_node_metrics = self.node_metrics.read().unwrap();
686684
let latest_lightning_wallet_sync_timestamp =
@@ -698,7 +696,6 @@ impl Node {
698696

699697
NodeStatus {
700698
is_running,
701-
is_listening,
702699
current_best_block,
703700
latest_lightning_wallet_sync_timestamp,
704701
latest_onchain_wallet_sync_timestamp,
@@ -1509,9 +1506,6 @@ impl Drop for Node {
15091506
pub struct NodeStatus {
15101507
/// Indicates whether the [`Node`] is running.
15111508
pub is_running: bool,
1512-
/// Indicates whether the [`Node`] is listening for incoming connections on the addresses
1513-
/// configured via [`Config::listening_addresses`].
1514-
pub is_listening: bool,
15151509
/// The best block to which our Lightning wallet is currently synced.
15161510
pub current_best_block: BestBlock,
15171511
/// 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
@@ -817,6 +817,21 @@ fn sign_verify_msg() {
817817
assert!(node.verify_signature(msg, sig.as_str(), &pkey));
818818
}
819819

820+
#[test]
821+
fn connection_multi_listen() {
822+
let (_bitcoind, electrsd) = setup_bitcoind_and_electrsd();
823+
let chain_source = TestChainSource::Esplora(&electrsd);
824+
let (node_a, node_b) = setup_two_nodes(&chain_source, false, false, false);
825+
826+
let node_id_b = node_b.node_id();
827+
828+
let node_addrs_b = node_b.listening_addresses().unwrap();
829+
for node_addr_b in &node_addrs_b {
830+
node_a.connect(node_id_b, node_addr_b.clone(), false).unwrap();
831+
node_a.disconnect(node_id_b).unwrap();
832+
}
833+
}
834+
820835
#[test]
821836
fn connection_restart_behavior() {
822837
do_connection_restart_behavior(true);
@@ -832,8 +847,6 @@ fn do_connection_restart_behavior(persist: bool) {
832847
let node_id_b = node_b.node_id();
833848

834849
let node_addr_b = node_b.listening_addresses().unwrap().first().unwrap().clone();
835-
assert!(node_b.status().is_listening);
836-
837850
node_a.connect(node_id_b, node_addr_b, persist).unwrap();
838851

839852
let peer_details_a = node_a.list_peers().first().unwrap().clone();
@@ -882,7 +895,6 @@ fn concurrent_connections_succeed() {
882895

883896
let node_id_b = node_b.node_id();
884897
let node_addr_b = node_b.listening_addresses().unwrap().first().unwrap().clone();
885-
assert!(node_b.status().is_listening);
886898

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

0 commit comments

Comments
 (0)