Rename bank height to block_height and expose method (#6199)

* Rename bank bank_height to block_height

* Expose block_height method
This commit is contained in:
Justin Starry 2019-10-01 14:55:39 -04:00 committed by GitHub
parent 774e9df2e5
commit 8d0236e3f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -8617,7 +8617,7 @@
],
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT last(\"bank_height\") as \"bank_height\" FROM \"$testnet\".\"autogen\".\"bank-new_from_parent-heights\" WHERE host_id::tag =~ /$hostid/ AND $timeFilter GROUP BY time($__interval)",
"query": "SELECT last(\"block_height\") as \"block_height\" FROM \"$testnet\".\"autogen\".\"bank-new_from_parent-heights\" WHERE host_id::tag =~ /$hostid/ AND $timeFilter GROUP BY time($__interval)",
"rawQuery": true,
"refId": "B",
"resultFormat": "time_series",

View File

@ -214,8 +214,8 @@ pub struct Bank {
/// Bank epoch
epoch: Epoch,
/// Bank height in term of banks
bank_height: u64,
/// Bank block_height
block_height: u64,
/// The pubkey to send transactions fees to.
collector_id: Pubkey,
@ -320,7 +320,7 @@ impl Bank {
epoch_schedule,
rent_collector: parent.rent_collector.clone_with_epoch(epoch),
max_tick_height: (slot + 1) * parent.ticks_per_slot - 1,
bank_height: parent.bank_height + 1,
block_height: parent.block_height + 1,
fee_calculator: FeeCalculator::new_derived(
&parent.fee_calculator,
parent.signature_count(),
@ -345,7 +345,7 @@ impl Bank {
datapoint_info!(
"bank-new_from_parent-heights",
("slot_height", slot, i64),
("bank_height", new.bank_height, i64)
("block_height", new.block_height, i64)
);
let stakers_epoch = epoch_schedule.get_stakers_epoch(slot);
@ -1423,6 +1423,11 @@ impl Bank {
self.max_tick_height
}
/// Return the block_height of this bank
pub fn block_height(&self) -> u64 {
self.block_height
}
/// Return the number of slots per epoch for the given epoch
pub fn get_slots_in_epoch(&self, epoch: Epoch) -> u64 {
self.epoch_schedule.get_slots_in_epoch(epoch)