Skip to content

Commit 8b28c7a

Browse files
committed
lnwallet: add noop updateType to paymendDescriptor
We add a new update type to the payment descriptor to describe this new type of htlc. This type of HTLC will only end up being set if explicitly signalled by external software.
1 parent 1881cb8 commit 8b28c7a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lnwallet/payment_descriptor.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ const (
4242
// FeeUpdate is an update type sent by the channel initiator that
4343
// updates the fee rate used when signing the commitment transaction.
4444
FeeUpdate
45+
46+
// NoopAdd is an update type that adds a new HTLC entry into the log.
47+
// This differs from the normal Add type, in that when settled the
48+
// balance will go back to the sender, rather than be credited for the
49+
// receiver.
50+
NoopAdd
4551
)
4652

4753
// String returns a human readable string that uniquely identifies the target
@@ -58,6 +64,8 @@ func (u updateType) String() string {
5864
return "Settle"
5965
case FeeUpdate:
6066
return "FeeUpdate"
67+
case NoopAdd:
68+
return "NoopAdd"
6169
default:
6270
return "<unknown type>"
6371
}
@@ -238,7 +246,7 @@ type paymentDescriptor struct {
238246
func (pd *paymentDescriptor) toLogUpdate() channeldb.LogUpdate {
239247
var msg lnwire.Message
240248
switch pd.EntryType {
241-
case Add:
249+
case Add, NoopAdd:
242250
msg = &lnwire.UpdateAddHTLC{
243251
ChanID: pd.ChanID,
244252
ID: pd.HtlcIndex,
@@ -290,7 +298,7 @@ func (pd *paymentDescriptor) setCommitHeight(
290298
whoseCommitChain lntypes.ChannelParty, nextHeight uint64) {
291299

292300
switch pd.EntryType {
293-
case Add:
301+
case Add, NoopAdd:
294302
pd.addCommitHeights.SetForParty(
295303
whoseCommitChain, nextHeight,
296304
)

0 commit comments

Comments
 (0)