mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
dd73f762ec
* keep track of block being synced * gazelle * use maps * shutup deepsource * change godoc * Radek's review
28 lines
465 B
Go
28 lines
465 B
Go
package blockchain
|
|
|
|
import "sync"
|
|
|
|
type currentlySyncingBlock struct {
|
|
sync.Mutex
|
|
roots map[[32]byte]struct{}
|
|
}
|
|
|
|
func (b *currentlySyncingBlock) set(root [32]byte) {
|
|
b.Lock()
|
|
defer b.Unlock()
|
|
b.roots[root] = struct{}{}
|
|
}
|
|
|
|
func (b *currentlySyncingBlock) unset(root [32]byte) {
|
|
b.Lock()
|
|
defer b.Unlock()
|
|
delete(b.roots, root)
|
|
}
|
|
|
|
func (b *currentlySyncingBlock) isSyncing(root [32]byte) bool {
|
|
b.Lock()
|
|
defer b.Unlock()
|
|
_, ok := b.roots[root]
|
|
return ok
|
|
}
|