We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fdabe11 commit c9dc38fCopy full SHA for c9dc38f
lightning/src/routing/gossip.rs
@@ -1474,6 +1474,8 @@ impl<L: Deref> ReadableArgs<L> for NetworkGraph<L> where L::Target: Logger {
1474
channels.insert(chan_id, chan_info);
1475
}
1476
let nodes_count: u64 = Readable::read(reader)?;
1477
+ // There shouln't be any where near `u32::MAX` nodes, and we need some headroom to insert
1478
+ // new nodes during sync, so reject any graphs claiming more than `u32::MAX / 2` nodes.
1479
if nodes_count > u32::max_value() as u64 / 2 { return Err(DecodeError::InvalidValue); }
1480
// In Nov, 2023 there were about 69K channels; we cap allocations to 1.5x that.
1481
let mut nodes = IndexedMap::with_capacity(cmp::min(nodes_count as usize, 103500));
0 commit comments