bank: get hash and fee rate from the same source when storing accounts
This commit is contained in:
parent
308d7d40d0
commit
91c6a10cda
|
@ -3168,6 +3168,15 @@ impl Bank {
|
||||||
self.blockhash_queue.read().unwrap().last_hash()
|
self.blockhash_queue.read().unwrap().last_hash()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn last_blockhash_and_lamports_per_signature(&self) -> (Hash, u64) {
|
||||||
|
let blockhash_queue = self.blockhash_queue.read().unwrap();
|
||||||
|
let last_hash = blockhash_queue.last_hash();
|
||||||
|
let last_lamports_per_signature = blockhash_queue
|
||||||
|
.get_lamports_per_signature(&last_hash)
|
||||||
|
.unwrap(); // safe so long as the BlockhashQueue is consistent
|
||||||
|
(last_hash, last_lamports_per_signature)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_blockhash_valid(&self, hash: &Hash) -> bool {
|
pub fn is_blockhash_valid(&self, hash: &Hash) -> bool {
|
||||||
let blockhash_queue = self.blockhash_queue.read().unwrap();
|
let blockhash_queue = self.blockhash_queue.read().unwrap();
|
||||||
blockhash_queue.check_hash(hash)
|
blockhash_queue.check_hash(hash)
|
||||||
|
@ -4164,6 +4173,7 @@ impl Bank {
|
||||||
self.is_delta.store(true, Relaxed);
|
self.is_delta.store(true, Relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let (blockhash, lamports_per_signature) = self.last_blockhash_and_lamports_per_signature();
|
||||||
let mut write_time = Measure::start("write_time");
|
let mut write_time = Measure::start("write_time");
|
||||||
self.rc.accounts.store_cached(
|
self.rc.accounts.store_cached(
|
||||||
self.slot(),
|
self.slot(),
|
||||||
|
@ -4171,8 +4181,8 @@ impl Bank {
|
||||||
executed_results,
|
executed_results,
|
||||||
loaded_txs,
|
loaded_txs,
|
||||||
&self.rent_collector,
|
&self.rent_collector,
|
||||||
&self.last_blockhash(),
|
&blockhash,
|
||||||
self.get_lamports_per_signature(),
|
lamports_per_signature,
|
||||||
self.rent_for_sysvars(),
|
self.rent_for_sysvars(),
|
||||||
self.merge_nonce_error_into_system_error(),
|
self.merge_nonce_error_into_system_error(),
|
||||||
self.demote_program_write_locks(),
|
self.demote_program_write_locks(),
|
||||||
|
|
Loading…
Reference in New Issue