mirror of
https://github.com/kaspanet/kaspad.git
synced 2026-03-03 16:00:28 +00:00
Add new function to get the checkpoints.
Previously there was only a function to get the latest checkpoint. This commit exposes a new function named Checkpoints which returns a slice of checkpoints ordered by height for the active network or nil when checkpoints are disabled.
This commit is contained in:
@@ -100,6 +100,17 @@ func (b *BlockChain) checkpointData() *checkpointData {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Checkpoints returns a slice of checkpoints (regardless of whether they are
|
||||
// already known). When checkpoints are disabled or there are no checkpoints
|
||||
// for the active network, it will return nil.
|
||||
func (b *BlockChain) Checkpoints() []Checkpoint {
|
||||
if b.noCheckpoints || b.checkpointData() == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return b.checkpointData().checkpoints
|
||||
}
|
||||
|
||||
// LatestCheckpoint returns the most recent checkpoint (regardless of whether it
|
||||
// is already known). When checkpoints are disabled or there are no checkpoints
|
||||
// for the active network, it will return nil.
|
||||
|
||||
Reference in New Issue
Block a user