config+htlclink+peer: htlc hodl mode!

This commit adds a new debug mode for lnd
  called hodlhtlc. This mode instructs a node
  to refrain from settling incoming HTLCs for
  which it is the exit node. We plan to use
  this in testing to more precisely control
  the states a node can take during
  execution.
This commit is contained in:
Conner Fromknecht authored and Olaoluwa Osuntokun committed 2017-09-19 11:31:52 -07:00
1 parent 8fc14a7308
commit 74322a99be
3 files changed
+16

No files matched your search

+13
View File
@@ -132,6 +132,12 @@ type ChannelLinkConfig struct {
// with the debug htlc R-Hash are immediately settled in the next
// available state transition.
DebugHTLC bool
// HodlHTLC should be active if you want this node to refrain from
// settling all incoming HTLCs with the sender if it finds itself to be
// the exit node.
// NOTE: HodlHTLC should be active in conjunction with DebugHTLC.
HodlHTLC bool
}
// channelLink is the service which drives a channel's commitment update
@@ -1176,6 +1182,13 @@ func (l *channelLink) processLockedInHtlcs(
continue
}
if l.cfg.DebugHTLC && l.cfg.HodlHTLC {
log.Warnf("hodl HTLC mode enabled, " +
"will not attempt to settle " +
"HTLC with sender")
continue
}
preimage := invoice.Terms.PaymentPreimage
logIndex, err := l.channel.SettleHTLC(preimage)
if err != nil {