From ddcd9b0463a923c16768e8a4c51ace83b0524ad3 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Mon, 14 Nov 2022 13:36:52 -0500 Subject: [PATCH] Add config knob for forwarding intercept payments --- lightning/src/ln/channelmanager.rs | 15 +++++++++------ lightning/src/ln/payment_tests.rs | 10 +++++++--- lightning/src/util/config.rs | 12 ++++++++++++ lightning/src/util/events.rs | 3 ++- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index c4d90480e..3b1bf7432 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -2233,8 +2233,9 @@ impl ChannelManager { // unknown_next_peer // Note that this is likely a timing oracle for detecting whether an scid is a // phantom or an intercept. - if fake_scid::is_valid_phantom(&self.fake_scid_rand_bytes, *short_channel_id, &self.genesis_hash) || - fake_scid::is_valid_intercept(&self.fake_scid_rand_bytes, *short_channel_id, &self.genesis_hash) + if (self.default_configuration.accept_intercept_htlcs && + fake_scid::is_valid_intercept(&self.fake_scid_rand_bytes, *short_channel_id, &self.genesis_hash)) || + fake_scid::is_valid_phantom(&self.fake_scid_rand_bytes, *short_channel_id, &self.genesis_hash) { None } else { @@ -3057,14 +3058,16 @@ impl ChannelManager