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:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user