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:
parent
6a9997583a
commit
be2e4c5860
1 changed files with 11 additions and 0 deletions
|
@ -100,6 +100,17 @@ func (b *BlockChain) checkpointData() *checkpointData {
|
||||||
return nil
|
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
|
// LatestCheckpoint returns the most recent checkpoint (regardless of whether it
|
||||||
// is already known). When checkpoints are disabled or there are no checkpoints
|
// is already known). When checkpoints are disabled or there are no checkpoints
|
||||||
// for the active network, it will return nil.
|
// for the active network, it will return nil.
|
||||||
|
|
Loading…
Reference in a new issue