lnd/htlcswitch
eugene 13c15e8038
server+htlcswitch: prevent privacy leaks, allow alias routing
This intent of this change is to prevent privacy leaks when routing
with aliases and also to allow routing when using an alias. The
aliases are our aliases.

Introduces are two maps:

* aliasToReal:
  This is an N->1 mapping for a channel. The keys are the set of
  aliases and the value is the confirmed, on-chain SCID.

* baseIndex:
  This is also an N->1 mapping for a channel. The keys are the set
  of aliases and the value is the "base" SCID (whatever is in the
  OpenChannel.ShortChannelID field). There is also a base->base
  mapping, so not all keys are aliases.

The above maps are populated when a link is added to the switch and
when the channel has confirmed on-chain. The maps are not removed
from if the link is removed, but this is fine since forwarding won't
occur.

* getLinkByMapping
  This function is introduced to adhere to the spec requirements that
  using the confirmed SCID of a private, scid-alias-feature-bit
  channel does not work. Lnd implements a stricter version of the spec
  and disallows this behavior if the feature-bit was negotiated, rather
  than just the channel type. The old, privacy-leak behavior is
  preserved.

The spec also requires that if we must fail back an HTLC, the
ChannelUpdate must use the SCID of whatever was in the onion, to avoid
a privacy leak. This is also done by passing in the relevant SCID to
the mailbox and link. Lnd will also cancel back on the "incoming" side
if the InterceptableSwitch was used or if the link failed to decrypt
the onion. In this case, we are cautious and replace the SCID if an
alias exists.
2022-07-07 17:10:28 -04:00
..
hodl multi: add golang 1.17 compatible build tags 2021-09-29 17:31:37 -07:00
hop multi: move many t.Fatalf calls to require.NoError 2022-06-17 04:26:55 +00:00
circuit_map_test.go htlcswitch+lntest: modify Switch to persist resolution messages 2022-04-29 16:40:19 -04:00
circuit_map.go htlcswitch+lntest: modify Switch to persist resolution messages 2022-04-29 16:40:19 -04:00
circuit_test.go multi: move many t.Fatalf calls to require.NoError 2022-06-17 04:26:55 +00:00
circuit.go htlcswitch: move hop iterator into htlcswitch/hop package 2019-09-05 15:30:31 +02:00
decayedlog_test.go multi: move many t.Fatalf calls to require.NoError 2022-06-17 04:26:55 +00:00
decayedlog.go htlcswitch: fix duplicate close 2022-01-10 08:42:32 +01:00
failure_detail.go htlcswitch: add linkError field to htlcpacket 2020-02-06 19:43:29 +02:00
failure.go htlcswitch: add linkError field to htlcpacket 2020-02-06 19:43:29 +02:00
htlcnotifier.go multi: add logs when subservers are starting 2022-02-11 21:17:03 +08:00
interceptable_switch.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
interfaces.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
link_isolated_test.go htlcswitch: introduce and embed packetHandler interface in ChannelLink 2021-08-10 17:15:51 -04:00
link_test.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
link.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
linkfailure.go htlcswitch: remove synchronous link handoff, special-case keystone err 2022-05-11 13:49:37 -04:00
log.go htlcswitch/hop: fix logging 2019-09-09 13:52:35 +02:00
mailbox_test.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
mailbox.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
mock.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
packet.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
payment_result_test.go multi: move many t.Fatalf calls to require.NoError 2022-06-17 04:26:55 +00:00
payment_result.go multi: move all channelstate operations to ChannelStateDB 2021-09-29 17:00:03 +02:00
resolution_store_test.go htlcswitch: introduce resolutionStore to persist cnct messages 2022-04-29 16:40:16 -04:00
resolution_store.go htlcswitch: introduce resolutionStore to persist cnct messages 2022-04-29 16:40:16 -04:00
sequencer.go kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
switch_test.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
switch.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
test_utils.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00