Skip to content

Commit 4249cb9

Browse files
experimental: hide the jamming_endorsement under an experimetal flag
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent a94dfe5 commit 4249cb9

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

doc/lightningd-config.5.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,11 @@ don't have to use a worst-case fee, but can bump the commitment transaction
803803
if it's needed. Note that this means that we need to keep
804804
some funds aside: see `min-emergency-msat`.
805805

806+
* **experimental-jamming-endorsement**
807+
808+
Specifying this option turn on part of the Channel Jamming mitigation
809+
to forward the `endorsed` inside `update_add_htl` lightning message.
810+
806811
BUGS
807812
----
808813

lightningd/lightningd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ struct lightningd {
388388
/* --invoices-onchain-fallback */
389389
bool unified_invoices;
390390

391+
/* --experimental-jamming */
392+
bool experimental_jamming_endorsement;
393+
391394
/* For anchors: how much do we keep for spending close txs? */
392395
struct amount_sat emergency_sat;
393396

lightningd/options.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,10 @@ static void register_opts(struct lightningd *ld)
16221622
opt_register_noarg("--invoices-onchain-fallback",
16231623
opt_set_bool, &ld->unified_invoices,
16241624
"Include an onchain address in invoices and mark them as paid if payment is received on-chain");
1625+
opt_register_noarg("--experimental-jamming-endorsement",
1626+
opt_set_bool, &ld->experimental_jamming_endorsement,
1627+
"experimental: allow htlc endorsement to mitigate channel jamming (incomplete)");
1628+
16251629
clnopt_witharg("--database-upgrade", OPT_SHOWBOOL,
16261630
opt_set_db_upgrade, NULL,
16271631
ld,

lightningd/peer_htlcs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,10 @@ static bool peer_accepted_htlc(const tal_t *ctx,
14561456
* we're in hook */
14571457
hook_payload->fwd_channel_id
14581458
= calc_forwarding_channel(ld, hook_payload);
1459-
1459+
// FIXME(vincenzopalazzo): ok this do not looks right, the value of
1460+
// hook_payload->endorsed should came from the prious pear of from us
1461+
// if we are the sender.
1462+
hook_payload->endorsed = ld->experimental_jamming_endorsement ? false : NULL;
14601463
plugin_hook_call_htlc_accepted(ld, NULL, hook_payload);
14611464

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

0 commit comments

Comments
 (0)