forked from kaspanet/kaspad
-
Notifications
You must be signed in to change notification settings - Fork 25
/
sync.go
36 lines (29 loc) · 768 Bytes
/
sync.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package externalapi
// SyncInfo holds info about the current sync state of the consensus
type SyncInfo struct {
HeaderCount uint64
BlockCount uint64
}
// Clone returns a clone of SyncInfo
func (si *SyncInfo) Clone() *SyncInfo {
return &SyncInfo{
HeaderCount: si.HeaderCount,
BlockCount: si.BlockCount,
}
}
// If this doesn't compile, it means the type definition has been changed, so it's
// an indication to update Equal and Clone accordingly.
var _ = SyncInfo{0, 0}
// Equal returns whether si equals to other
func (si *SyncInfo) Equal(other *SyncInfo) bool {
if si == nil || other == nil {
return si == other
}
if si.HeaderCount != other.HeaderCount {
return false
}
if si.BlockCount != other.BlockCount {
return false
}
return true
}