Add RPC/getEpochSchedule

This commit is contained in:
Slavomir 2021-07-01 14:34:33 +02:00
parent 0764db71c7
commit 2b6f37bdbc
1 changed files with 22 additions and 0 deletions

22
rpc/getEpochSchedule.go Normal file
View File

@ -0,0 +1,22 @@
package rpc
import (
"context"
bin "github.com/dfuse-io/binary"
)
type GetEpochScheduleResult struct {
SlotsPerEpoch bin.Uint64 `json:"slotsPerEpoch"` // the maximum number of slots in each epoch
LeaderScheduleSlotOffset bin.Uint64 `json:"leaderScheduleSlotOffset"` // the number of slots before beginning of an epoch to calculate a leader schedule for that epoch
Warmup bool `json:"warmup"` // whether epochs start short and grow
FirstNormalEpoch bin.Uint64 `json:"firstNormalEpoch"` // first normal-length epoch, log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH)
FirstNormalSlot bin.Uint64 `json:"firstNormalSlot"` // MINIMUM_SLOTS_PER_EPOCH * (2.pow(firstNormalEpoch) - 1)
}
// GetEpochSchedule returns epoch schedule information from this cluster's genesis config.
func (cl *Client) GetEpochSchedule(ctx context.Context) (out *GetEpochScheduleResult, err error) {
params := []interface{}{}
err = cl.rpcClient.CallFor(&out, "getEpochSchedule", params...)
return
}