Add a new `NodeCounters` utility to track counters when routing
authorMatt Corallo <git@bluematt.me>
Tue, 19 Mar 2024 19:29:06 +0000 (19:29 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 20 Mar 2024 00:51:20 +0000 (00:51 +0000)
commit7fa6e89765f49fca741994f5ba9b2e1658bb3679
treea8333cfb5db60b0ea145dfab31b5285a8804a970
parente00aeef95545f5487a0d75ea107d83c0e4b472ee
Add a new `NodeCounters` utility to track counters when routing

In the next commit we'll stop using `NodeId`s to look up nodes when
routing, instead using the new per-node counters. Here we take the
first step, adding a local struct which tracks temporary counters
for route hints/source/destination nodes.

Because we must ensure we have a 1-to-1 mapping from node ids to
`node_counter`s, even across first-hop and last-hop hints, we have
to be careful to check the network graph first, then a new
`private_node_id_to_node_counter` map to ensure we only ever end up
with one counter per node id.
lightning/src/routing/gossip.rs
lightning/src/routing/router.rs