Ori Newman 729e3db145
Pruning calculation changes (#1250)
* 1) Calculate pruning point incrementally
2) Add IsValidPruningPoint to pruning manager and consensus
3) Use reachability children for selected child iterator

* Add request IBD root hash flow

* Fix UpdatePruningPointByVirtual and IsValidPruningPoint

* Regenerate messages.pb.go

* Make the pruning point the earliest chain block with finality interval higher than the previous pruning point

* Fix merge errors
2020-12-23 11:37:39 +02:00

37 lines
768 B
Go

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
}