Skip to content

Commit e305ff1

Browse files
committed
f add empty channel data test
1 parent 46d9480 commit e305ff1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lightning-rapid-gossip-sync/src/processing.rs

+18
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ mod tests {
431431
use lightning::ln::msgs::DecodeError;
432432

433433
use lightning::routing::gossip::{NetworkGraph, NodeId};
434+
use lightning::util::logger::Level;
434435
use lightning::util::test_utils::TestLogger;
435436

436437
use crate::processing::STALE_RGS_UPDATE_AGE_LIMIT_SECS;
@@ -535,6 +536,23 @@ mod tests {
535536
}
536537
}
537538

539+
#[test]
540+
fn node_date_update_succeeds_without_channels() {
541+
let mut logger = TestLogger::new();
542+
logger.enable(Level::Gossip);
543+
let network_graph = NetworkGraph::new(Network::Bitcoin, &logger);
544+
let rapid_sync = RapidGossipSync::new(&network_graph, &logger);
545+
546+
let example_input = vec![
547+
76, 68, 75, 2, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, 79, 147, 30, 131, 101, 225, 90, 8, 156, 104, 214, 25, 0, 0, 0, 0, 0, 102, 105, 183, 240, 0, 0, 0, 0, 1, 63, 27, 132, 197, 86, 123, 18, 100, 64, 153, 93, 62, 213, 170, 186, 5, 101, 215, 30, 24, 52, 96, 72, 25, 255, 156, 23, 245, 233, 213, 221, 7, 143, 5, 13, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 7, 1, 127, 0, 0, 1, 37, 163, 19, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 57, 38, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 3, 0, 4, 14, 5, 10, 103, 111, 111, 103, 108, 101, 46, 99, 111, 109, 1, 187, 0, 2, 23, 48, 0, 0, 0, 0, 0, 0, 0, 0,
548+
];
549+
550+
let update_result = rapid_sync.update_network_graph_no_std(&example_input[..], None);
551+
assert!(update_result.is_ok());
552+
553+
logger.assert_log_contains("lightning_rapid_gossip_sync::processing", "Failed to apply node announcement: \"No existing channels for node_announcement\"", 1);
554+
}
555+
538556
#[test]
539557
fn update_ignores_v2_additional_data() {
540558
let logger = TestLogger::new();

0 commit comments

Comments
 (0)