htlcswitch: restore the ability to properly handle debughtlc recv's

This commit fixes a regression introduce in the prior commit which
added full verification of the per-hop payloads to the ChannelLink
interface. When this was initially implemented, the added checks
weren’t guarded on the existence of debughtlc’s. As a result,
debughtlc’s would be rejected as they don’t match the expected invoice
value.

This commit fixes that issue by only checking the hop payload if debug
HTLC mode isn’t on.
This commit is contained in:
Olaoluwa Osuntokun 2017-07-04 15:58:14 -07:00
parent a824a2a855
commit 01d54c29af
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
2 changed files with 7 additions and 3 deletions

@ -928,7 +928,9 @@ func (l *channelLink) processLockedInHtlcs(
// extended. Additionally, we'll ensure that // extended. Additionally, we'll ensure that
// our time-lock value has been computed // our time-lock value has been computed
// correctly. // correctly.
if fwdInfo.AmountToForward != invoice.Terms.Value { if !l.cfg.DebugHTLC &&
fwdInfo.AmountToForward != invoice.Terms.Value {
log.Errorf("Onion payload of incoming "+ log.Errorf("Onion payload of incoming "+
"htlc(%x) has incorrect value: "+ "htlc(%x) has incorrect value: "+
"expected %v, got %v", pd.RHash, "expected %v, got %v", pd.RHash,
@ -940,7 +942,9 @@ func (l *channelLink) processLockedInHtlcs(
needUpdate = true needUpdate = true
continue continue
} }
if fwdInfo.OutgoingCTLV != l.cfg.FwrdingPolicy.TimeLockDelta { if !l.cfg.DebugHTLC &&
fwdInfo.OutgoingCTLV != l.cfg.FwrdingPolicy.TimeLockDelta {
log.Errorf("Onion payload of incoming "+ log.Errorf("Onion payload of incoming "+
"htlc(%x) has incorrect time-lock: "+ "htlc(%x) has incorrect time-lock: "+
"expected %v, got %v", "expected %v, got %v",