lightningd: Allow in excess of ctlv_expiry.

We add a test which both overpays and over-sets the delta on the
intermediate and final nodes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-10-23 14:46:57 +10:30
committed by Christian Decker
parent 71e794a046
commit 0000dc5908
2 changed files with 54 additions and 2 deletions

View File

@@ -243,7 +243,7 @@ static bool check_amount(struct htlc_in *hin,
* * `outgoing_cltv_value` - The CLTV value that the _outgoing_ HTLC carrying
* the packet should have.
*
* cltv_expiry - cltv_expiry_delta = outgoing_cltv_value
* cltv_expiry - cltv_expiry_delta >= outgoing_cltv_value
*
* Inclusion of this field allows a node to both authenticate the information
* specified by the original sender and the parameters of the HTLC forwarded,
@@ -259,7 +259,7 @@ static bool check_amount(struct htlc_in *hin,
static bool check_cltv(struct htlc_in *hin,
u32 cltv_expiry, u32 outgoing_cltv_value, u32 delta)
{
if (cltv_expiry - delta == outgoing_cltv_value)
if (cltv_expiry - delta >= outgoing_cltv_value)
return true;
log_debug(hin->key.peer->ld->log, "HTLC %"PRIu64" incorrect CLTV:"
" %u in, %u out, delta reqd %u",