Skip to content

Commit 83f103a

Browse files
committed
tapchannel: detect both HTLC add types
Since we now have two different candidate types for adding HTLCs, we use the helper method that checks against both of them.
1 parent 972a3f7 commit 83f103a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tapchannel/commitment.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ func ComputeView(ourBalance, theirBalance uint64,
9898
remoteHtlcIndex := make(map[uint64]lnwallet.AuxHtlcDescriptor)
9999

100100
for _, entry := range original.Updates.Local {
101-
if entry.EntryType == lnwallet.Add {
101+
if entry.IsAdd() {
102102
localHtlcIndex[entry.HtlcIndex] = entry
103103
}
104104
}
105105
for _, entry := range original.Updates.Remote {
106-
if entry.EntryType == lnwallet.Add {
106+
if entry.IsAdd() {
107107
remoteHtlcIndex[entry.HtlcIndex] = entry
108108
}
109109
}
@@ -115,6 +115,9 @@ func ComputeView(ourBalance, theirBalance uint64,
115115
case lnwallet.Add:
116116
continue
117117

118+
case lnwallet.NoopAdd:
119+
continue
120+
118121
// Fee updates don't concern us at the asset level.
119122
case lnwallet.FeeUpdate:
120123
continue
@@ -162,6 +165,9 @@ func ComputeView(ourBalance, theirBalance uint64,
162165
case lnwallet.Add:
163166
continue
164167

168+
case lnwallet.NoopAdd:
169+
continue
170+
165171
// Fee updates don't concern us at the asset level.
166172
case lnwallet.FeeUpdate:
167173
continue
@@ -207,7 +213,7 @@ func ComputeView(ourBalance, theirBalance uint64,
207213
// settled HTLCs, and debiting the chain state balance due to any newly
208214
// added HTLCs.
209215
for _, entry := range original.Updates.Local {
210-
isAdd := entry.EntryType == lnwallet.Add
216+
isAdd := entry.IsAdd()
211217

212218
// Skip any entries that aren't adds or adds that were already
213219
// settled or failed by a child HTLC entry we processed above.
@@ -249,7 +255,7 @@ func ComputeView(ourBalance, theirBalance uint64,
249255
newView.OurUpdates = append(newView.OurUpdates, decodedEntry)
250256
}
251257
for _, entry := range original.Updates.Remote {
252-
isAdd := entry.EntryType == lnwallet.Add
258+
isAdd := entry.IsAdd()
253259

254260
// Skip any entries that aren't adds or adds that were already
255261
// settled or failed by a child HTLC entry we processed above.

0 commit comments

Comments
 (0)