Skip to content

Commit 0a58e20

Browse files
committed
chore(store): use native atomic uint64 type
1 parent ead34f2 commit 0a58e20

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

store/heightsub.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var errElapsedHeight = errors.New("elapsed height")
1616
type heightSub[H header.Header] struct {
1717
// height refers to the latest locally available header height
1818
// that has been fully verified and inserted into the subjective chain
19-
height uint64 // atomic
19+
height atomic.Uint64
2020
heightReqsLk sync.Mutex
2121
heightReqs map[uint64][]chan H
2222
}
@@ -30,12 +30,12 @@ func newHeightSub[H header.Header]() *heightSub[H] {
3030

3131
// Height reports current height.
3232
func (hs *heightSub[H]) Height() uint64 {
33-
return atomic.LoadUint64(&hs.height)
33+
return hs.height.Load()
3434
}
3535

3636
// SetHeight sets the new head height for heightSub.
3737
func (hs *heightSub[H]) SetHeight(height uint64) {
38-
atomic.StoreUint64(&hs.height, height)
38+
hs.height.Store(height)
3939
}
4040

4141
// Sub subscribes for a header of a given height.

0 commit comments

Comments
 (0)