Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

htlcswitch+config+server: adding RejectHTLC flag #2203

Merged
merged 1 commit into from Aug 26, 2019

Conversation

@ccdle12
Copy link
Contributor

commented Nov 20, 2018

In this PR, we add a flag to the command line config --rejecthtlc and a
field in the HTLC Switch config RejectHTLC bool.

The user should be able to start lnd with the --rejecthtlc flag which will
mean that lnd will reject any onward HTLCs. The switch will still allow receiving
HTLCs meant for the node and can still send HTLCs.

fixes #1298 and #2109

@halseth

This comment has been minimized.

Copy link
Collaborator

commented Jul 18, 2019

Needs rebase

@ccdle12 ccdle12 force-pushed the ccdle12:reject-htlc-option branch from f0181f5 to 5a02c95 Jul 18, 2019

@ccdle12 ccdle12 requested review from cfromknecht and Roasbeef as code owners Jul 18, 2019

@halseth halseth removed the needs rebase label Jul 19, 2019

@ccdle12

This comment has been minimized.

Copy link
Contributor Author

commented Jul 19, 2019

@halseth thanks,

There's a bit for me to do with refactoring the itest both in fixing the failing test and some general formatting.

@cfromknecht
Copy link
Collaborator

left a comment

@ccdle12 great fix! code changes look pretty good to me, just some minor comments on the commits themselves

lntest/itest/lnd_test.go Outdated Show resolved Hide resolved
server.go Outdated Show resolved Hide resolved
test_utils.go Outdated Show resolved Hide resolved

@ccdle12 ccdle12 force-pushed the ccdle12:reject-htlc-option branch 2 times, most recently from e5676cb to 6e0a186 Jul 26, 2019

@halseth
Copy link
Collaborator

left a comment

Mostly LGTM after sqash and rebase!

lntest/itest/lnd_test.go Outdated Show resolved Hide resolved

@ccdle12 ccdle12 force-pushed the ccdle12:reject-htlc-option branch 2 times, most recently from 9bc5492 to d268df5 Aug 5, 2019

@Roasbeef Roasbeef removed their request for review Aug 7, 2019

@ccdle12 ccdle12 force-pushed the ccdle12:reject-htlc-option branch 2 times, most recently from c9eeaa4 to 9411d7a Aug 9, 2019

htlcswitch+config+server: Adds a rejecthtlc flag that disables forwarded
htlcs

config: Adding RejectHTLC field in config struct

This commit adds a RejectHTLC field in the config struct in config.go.
This allows the user to run lnd as a node that does not accept onward
HTLCs.

htlcswitch/switch: Adding a field RejectHTLC to the switch config

This commit adds a field RejectHTLC to the switch config. When the
switch receives an HTLC it will check this flag and if the HTLC is not
from the source hop, the HTLC will be rejected.

htlcswitch/switch: adding check for RejectHTLC flag and incomingChanID

This commit adds a check when receiving UpdateAddHTLC. The check looks
for the RejectHTLC flag set and whether the HTLC is from the sourceHop
(the local switch). If the HTLC is not from the sourceHop, then we
reject the HTLC and return a FailChannelDisabled error.

server: adding RejectHTLC field to initialization of switch

lnd_test: adding test for RejectHTLC

This commit adds a test which tests that a node with the --rejecthtlc
flag will reject any onward HTLCs but still can receive direct HTLCs and
can send HTLCs.

@ccdle12 ccdle12 force-pushed the ccdle12:reject-htlc-option branch from 9411d7a to 05d0d02 Aug 20, 2019

@cfromknecht
Copy link
Collaborator

left a comment

LGTM!

@halseth
Copy link
Collaborator

left a comment

LGTM 🏁

@halseth halseth merged commit 9ef66f5 into lightningnetwork:master Aug 26, 2019

1 of 2 checks passed

coverage/coveralls Coverage decreased (-0.03%) to 60.928%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.