Rpc: Add getCirculatingSupply endpoint, redux (#9953) (#9954)

automerge
This commit is contained in:
mergify[bot]
2020-05-09 14:20:58 -07:00
committed by GitHub
parent a7b0fcc21e
commit 15de250c2c
8 changed files with 371 additions and 47 deletions

View File

@@ -567,16 +567,20 @@ impl Bank {
}
}
pub fn clock(&self) -> sysvar::clock::Clock {
sysvar::clock::Clock {
slot: self.slot,
segment: get_segment_from_slot(self.slot, self.slots_per_segment),
epoch: self.epoch_schedule.get_epoch(self.slot),
leader_schedule_epoch: self.epoch_schedule.get_leader_schedule_epoch(self.slot),
unix_timestamp: self.unix_timestamp(),
}
}
fn update_clock(&self) {
self.update_sysvar_account(&sysvar::clock::id(), |account| {
sysvar::clock::Clock {
slot: self.slot,
segment: get_segment_from_slot(self.slot, self.slots_per_segment),
epoch: self.epoch_schedule.get_epoch(self.slot),
leader_schedule_epoch: self.epoch_schedule.get_leader_schedule_epoch(self.slot),
unix_timestamp: self.unix_timestamp(),
}
.create_account(self.inherit_sysvar_account_balance(account))
self.clock()
.create_account(self.inherit_sysvar_account_balance(account))
});
}