Skip to content

Commit 19f76e1

Browse files
rustyrussellendothermicdev
authored andcommitted
lightningd: fix anchorspend HTLC deadline logic.
It's not the *outgoing* HTLC which sets the deadline, it's the incoming. Reported-by: @whitslack Signed-off-by: Rusty Russell <[email protected]> Changelog-Fixed: Protocol: Egregious anchor fee paid for unilateral close txs due to HTLC timeouts; it's not as urgent as our code made out!
1 parent 1f05063 commit 19f76e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lightningd/anchorspend.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,12 @@ struct anchor_details *create_anchor_details(const tal_t *ctx,
204204
continue;
205205

206206
v.msat = hout->msat;
207-
v.block = hout->cltv_expiry;
207+
/* Our real deadline here is the INCOMING htlc. If it's us, use the default so we don't leak
208+
* too much information about it. */
209+
if (hout->in)
210+
v.block = hout->in->cltv_expiry;
211+
else
212+
v.block = hout->cltv_expiry + ld->config.cltv_expiry_delta;
208213
v.important = true;
209214
tal_arr_expand(&adet->vals, v);
210215
}

0 commit comments

Comments
 (0)