Skip to content

Commit

Permalink
experimental: hide the jamming_endorsement under an experimetal flag
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Oct 24, 2023
1 parent 19244c4 commit 3982077
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions doc/lightningd-config.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,11 @@ don't have to use a worst-case fee, but can bump the commitment transaction
if it's needed. Note that this means that we need to keep
some funds aside: see `min-emergency-msat`.

* **experimental-jamming-endorsement**

Specifying this option turn on part of the Channel Jamming mitigation
to forward the `endorsed` inside `update_add_htl` lightning message.

BUGS
----

Expand Down
3 changes: 3 additions & 0 deletions lightningd/lightningd.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ struct lightningd {
/* --experimental-upgrade-protocol */
bool experimental_upgrade_protocol;

/* --experimental-jamming */
bool experimental_jamming_endorsement;

/* For anchors: how much do we keep for spending close txs? */
struct amount_sat emergency_sat;

Expand Down
4 changes: 4 additions & 0 deletions lightningd/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,10 @@ static void register_opts(struct lightningd *ld)
opt_register_noarg("--experimental-upgrade-protocol",
opt_set_bool, &ld->experimental_upgrade_protocol,
"experimental: allow channel types to be upgraded on reconnect");

opt_register_noarg("--experimental-jamming-endorsement",
opt_set_bool, &ld->experimental_jamming_endorsement,
"experimental: allow htlc endorsement to mitigate channel jamming (incomplete)");
clnopt_witharg("--database-upgrade", OPT_SHOWBOOL,
opt_set_db_upgrade, NULL,
ld,
Expand Down
5 changes: 4 additions & 1 deletion lightningd/peer_htlcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,10 @@ static bool peer_accepted_htlc(const tal_t *ctx,
* we're in hook */
hook_payload->fwd_channel_id
= calc_forwarding_channel(ld, hook_payload);

// FIXME(vincenzopalazzo): ok this do not looks right, the value of
// hook_payload->endorsed should came from the prious pear of from us
// if we are the sender.
hook_payload->endorsed = ld->experimental_jamming_endorsement ? false : NULL;
plugin_hook_call_htlc_accepted(ld, NULL, hook_payload);

/* Falling through here is ok, after all the HTLC locked */
Expand Down

0 comments on commit 3982077

Please sign in to comment.