Privatise `CandidateRouteHop::short_channel_id` as its a footgun
authorMatt Corallo <git@bluematt.me>
Wed, 6 Dec 2023 01:13:33 +0000 (01:13 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 8 Dec 2023 20:45:06 +0000 (20:45 +0000)
commit99e4a1fbb63ce05c9923f5645c05d9faf2387238
tree5a347c7e7d6cdf79fa883a5c002d2febc5440f9c
parent2caccc5cd6e9a64c115d86f1109415ecaa23bc06
Privatise `CandidateRouteHop::short_channel_id` as its a footgun

Short channel "ID"s are not globally unique when they come from a
BOLT 11 route hint or a first hop (which can be an outbound SCID
alias). In those cases, its rather confusing that we have a
`short_channel_id` method which mixes them all together, and even
more confusing that we have a `CandidateHopId` which is not, in
fact returning a unique identifier.

In our routing logic this is mostly fine - the cost of a collision
isn't super high and we should still do just fine finding a route,
however the same can't be true for downstream users, as they may or
may not rely on the apparent guarantees.

Thus, here, we privatise the SCID and id accessors.
lightning/src/routing/router.rs
lightning/src/routing/scoring.rs
lightning/src/util/test_utils.rs