feat: get_epoch_schedule rpc (#536)

This commit is contained in:
Sunny Gleason
2019-10-23 09:48:24 -04:00
committed by Michael Vines
parent 0d582c180f
commit 67c9b50249
3 changed files with 107 additions and 10 deletions

View File

@ -170,6 +170,43 @@ test('get inflation', async () => {
}
});
test('get epoch schedule', async () => {
const connection = new Connection(url);
mockRpc.push([
url,
{
method: 'getEpochSchedule',
params: [],
},
{
error: null,
result: {
first_normal_epoch: 8,
first_normal_slot: 8160,
leader_schedule_slot_offset: 8192,
slots_per_epoch: 8192,
warmup: true,
},
},
]);
const epochSchedule = await connection.getEpochSchedule();
for (const key of [
'first_normal_epoch',
'first_normal_slot',
'leader_schedule_slot_offset',
'slots_per_epoch',
]) {
expect(epochSchedule).toHaveProperty(key);
expect(epochSchedule[key]).toBeGreaterThan(0);
}
expect(epochSchedule).toHaveProperty('warmup');
expect(epochSchedule.warmup).toBeTruthy();
});
test('get slot', async () => {
const connection = new Connection(url);