Allow duplicate-payment_hash HTLCs for HTLC forwards
authorMatt Corallo <git@bluematt.me>
Tue, 11 Sep 2018 18:20:40 +0000 (14:20 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 12 Sep 2018 15:15:47 +0000 (11:15 -0400)
commitda5d707f496d61ec731828e29876660402236b36
treed0383c04e0ba74e93d9f44a957bf4987c6f37167
parent3b498378620d4294f188804c97497112e3693297
Allow duplicate-payment_hash HTLCs for HTLC forwards

This is required by BOLT 2 to ensure that no attacker can simply
relay every public node a duplicate-payment_hash HTLC for each HTLC
it receives to deduce where an HTLC came from.

Note that this makes the claim logic much less incentive-compatible
as we will not claim all available HTLCs with the same payment_hash
even if we know the preimage! This is OK because, most likely, any
attackers trying to map the network will use small-value payments
and, hopefully, we will move away from constant hashes across an
entire payment at some point in the near future.

This further simplifies the payment transition state a bit, so
hopefully at least we got some readability out of all of this
fuzz/fuzz_targets/channel_target.rs
src/ln/channel.rs
src/ln/channelmanager.rs