Skip to content

Commit

Permalink
squash
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaytonNorthey92 committed Feb 29, 2024
1 parent bdadebb commit cfe17d3
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions service/popm/popm.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,20 @@ func (r *CircularFifo) MineEach(cb func(ks hemi.L2Keystone) error) {
})

for _, e := range copies {
if e.requiresMine {
if err := cb(e.l2Keystone); err == nil {
r.mtx.Lock()
for i := 0; i < cap(r.buf); i++ {
queued := hemi.L2KeystoneAbbreviate(r.buf[i].l2Keystone).Serialize()
mined := hemi.L2KeystoneAbbreviate(e.l2Keystone).Serialize()
if slices.Equal(queued[:], mined[:]) {
r.buf[i].requiresMine = false
}
if !e.requiresMine {
continue
}

if err := cb(e.l2Keystone); err == nil {
r.mtx.Lock()
for i := 0; i < cap(r.buf); i++ {
queued := hemi.L2KeystoneAbbreviate(r.buf[i].l2Keystone).Serialize()
mined := hemi.L2KeystoneAbbreviate(e.l2Keystone).Serialize()
if slices.Equal(queued[:], mined[:]) {
r.buf[i].requiresMine = false
}
r.mtx.Unlock()
}
r.mtx.Unlock()
}
}
}
Expand Down

0 comments on commit cfe17d3

Please sign in to comment.