@@ -44,7 +44,7 @@ type updateLog struct {
4444 // htlcs, hence update types `Fail|MalformedFail|Settle`. A modified
4545 // HTLC is one that's present in the log, and has as a pending fail or
4646 // settle that's attempting to consume it.
47- modifiedHtlcs map [uint64 ]struct {}
47+ modifiedHtlcs fn. Set [uint64 ]
4848}
4949
5050// newUpdateLog creates a new updateLog instance.
@@ -55,7 +55,7 @@ func newUpdateLog(logIndex, htlcCounter uint64) *updateLog {
5555 htlcIndex : make (map [uint64 ]* fn.Node [* PaymentDescriptor ]),
5656 logIndex : logIndex ,
5757 htlcCounter : htlcCounter ,
58- modifiedHtlcs : make ( map [uint64 ]struct {} ),
58+ modifiedHtlcs : fn . NewSet [uint64 ]( ),
5959 }
6060}
6161
@@ -122,21 +122,20 @@ func (u *updateLog) removeHtlc(i uint64) {
122122 u .Remove (entry )
123123 delete (u .htlcIndex , i )
124124
125- delete ( u .modifiedHtlcs , i )
125+ u .modifiedHtlcs . Remove ( i )
126126}
127127
128128// htlcHasModification returns true if the HTLC identified by the passed index
129129// has a pending modification within the log.
130130func (u * updateLog ) htlcHasModification (i uint64 ) bool {
131- _ , o := u .modifiedHtlcs [i ]
132- return o
131+ return u .modifiedHtlcs .Contains (i )
133132}
134133
135134// markHtlcModified marks an HTLC as modified based on its HTLC index. After a
136135// call to this method, htlcHasModification will return true until the HTLC is
137136// removed.
138137func (u * updateLog ) markHtlcModified (i uint64 ) {
139- u .modifiedHtlcs [ i ] = struct {}{}
138+ u .modifiedHtlcs . Add ( i )
140139}
141140
142141// compactLogs performs garbage collection within the log removing HTLCs which
0 commit comments