Add last valid block height to rpc Fees (#17506)

* Add last_valid_block_height to fees rpc

* Add getBlockHeight rpc

* Update docs
This commit is contained in:
Tyera Eulberg
2021-05-26 01:26:19 -06:00
committed by GitHub
parent 7ce910f459
commit e9bc1c6b07
7 changed files with 106 additions and 3 deletions

View File

@ -2415,6 +2415,7 @@ impl Bank {
&self.fee_rate_governor
}
// DEPRECATED
pub fn get_blockhash_last_valid_slot(&self, blockhash: &Hash) -> Option<Slot> {
let blockhash_queue = self.blockhash_queue.read().unwrap();
// This calculation will need to be updated to consider epoch boundaries if BlockhashQueue
@ -2424,6 +2425,15 @@ impl Bank {
.map(|age| self.slot + blockhash_queue.len() as u64 - age)
}
pub fn get_blockhash_last_valid_block_height(&self, blockhash: &Hash) -> Option<Slot> {
let blockhash_queue = self.blockhash_queue.read().unwrap();
// This calculation will need to be updated to consider epoch boundaries if BlockhashQueue
// length is made variable by epoch
blockhash_queue
.get_hash_age(blockhash)
.map(|age| self.block_height + blockhash_queue.len() as u64 - age)
}
pub fn confirmed_last_blockhash(&self) -> (Hash, FeeCalculator) {
const NUM_BLOCKHASH_CONFIRMATIONS: usize = 3;