@ -418,7 +418,7 @@ impl BankingStage {
|
||||
// the likelihood of any single thread getting starved and processing old ids.
|
||||
// TODO: Banking stage threads should be prioritized to complete faster then this queue
|
||||
// expires.
|
||||
let (loaded_accounts, results) =
|
||||
let (loaded_accounts, results, tx_count, signature_count) =
|
||||
bank.load_and_execute_transactions(txs, lock_results, MAX_RECENT_BLOCKHASHES / 2);
|
||||
let load_execute_time = now.elapsed();
|
||||
|
||||
@ -432,7 +432,7 @@ impl BankingStage {
|
||||
|
||||
let commit_time = {
|
||||
let now = Instant::now();
|
||||
bank.commit_transactions(txs, &loaded_accounts, &results);
|
||||
bank.commit_transactions(txs, &loaded_accounts, &results, tx_count, signature_count);
|
||||
now.elapsed()
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,8 @@ use crate::stakes::Stakes;
|
||||
use crate::status_cache::StatusCache;
|
||||
use crate::storage_utils;
|
||||
use crate::storage_utils::StorageAccounts;
|
||||
use bincode::{deserialize_from, serialize, serialize_into, serialized_size};
|
||||
use bincode::{deserialize_from, serialize_into, serialized_size};
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
use log::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use solana_metrics::{
|
||||
@ -27,7 +28,7 @@ use solana_metrics::{
|
||||
use solana_sdk::account::Account;
|
||||
use solana_sdk::fee_calculator::FeeCalculator;
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::hash::{extend_and_hash, Hash};
|
||||
use solana_sdk::hash::{hashv, Hash};
|
||||
use solana_sdk::inflation::Inflation;
|
||||
use solana_sdk::native_loader;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
@ -918,6 +919,8 @@ impl Bank {
|
||||
) -> (
|
||||
Vec<Result<(InstructionAccounts, InstructionLoaders, InstructionCredits)>>,
|
||||
Vec<Result<()>>,
|
||||
usize,
|
||||
usize,
|
||||
) {
|
||||
debug!("processing transactions: {}", txs.len());
|
||||
let mut error_counters = ErrorCounters::default();
|
||||
@ -977,13 +980,8 @@ impl Bank {
|
||||
inc_new_counter_error!("bank-process_transactions-error_count", err_count, 0, 1000);
|
||||
}
|
||||
|
||||
self.increment_transaction_count(tx_count);
|
||||
self.increment_signature_count(signature_count);
|
||||
|
||||
inc_new_counter_info!("bank-process_transactions-txs", tx_count, 0, 1000);
|
||||
inc_new_counter_info!("bank-process_transactions-sigs", signature_count, 0, 1000);
|
||||
Self::update_error_counters(&error_counters);
|
||||
(loaded_accounts, executed)
|
||||
(loaded_accounts, executed, tx_count, signature_count)
|
||||
}
|
||||
|
||||
fn filter_program_errors_and_collect_fee(
|
||||
@ -1031,11 +1029,19 @@ impl Bank {
|
||||
txs: &[Transaction],
|
||||
loaded_accounts: &[Result<(InstructionAccounts, InstructionLoaders, InstructionCredits)>],
|
||||
executed: &[Result<()>],
|
||||
tx_count: usize,
|
||||
signature_count: usize,
|
||||
) -> Vec<Result<()>> {
|
||||
if self.is_frozen() {
|
||||
warn!("=========== FIXME: commit_transactions() working on a frozen bank! ================");
|
||||
}
|
||||
|
||||
self.increment_transaction_count(tx_count);
|
||||
self.increment_signature_count(signature_count);
|
||||
|
||||
inc_new_counter_info!("bank-process_transactions-txs", tx_count, 0, 1000);
|
||||
inc_new_counter_info!("bank-process_transactions-sigs", signature_count, 0, 1000);
|
||||
|
||||
if executed.iter().any(|res| Self::can_commit(res)) {
|
||||
self.is_delta.store(true, Ordering::Relaxed);
|
||||
}
|
||||
@ -1068,10 +1074,10 @@ impl Bank {
|
||||
lock_results: &LockedAccountsResults,
|
||||
max_age: usize,
|
||||
) -> Vec<Result<()>> {
|
||||
let (loaded_accounts, executed) =
|
||||
let (loaded_accounts, executed, tx_count, signature_count) =
|
||||
self.load_and_execute_transactions(txs, lock_results, max_age);
|
||||
|
||||
self.commit_transactions(txs, &loaded_accounts, &executed)
|
||||
self.commit_transactions(txs, &loaded_accounts, &executed, tx_count, signature_count)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
@ -1227,7 +1233,14 @@ impl Bank {
|
||||
// If there are no accounts, return the same hash as we did before
|
||||
// checkpointing.
|
||||
if let Some(accounts_delta_hash) = self.rc.accounts.hash_internal_state(self.slot()) {
|
||||
extend_and_hash(&self.parent_hash, &serialize(&accounts_delta_hash).unwrap())
|
||||
let mut signature_count_buf = [0u8; 8];
|
||||
LittleEndian::write_u64(&mut signature_count_buf[..], self.signature_count() as u64);
|
||||
|
||||
hashv(&[
|
||||
&self.parent_hash.as_ref(),
|
||||
&accounts_delta_hash.as_ref(),
|
||||
&signature_count_buf,
|
||||
])
|
||||
} else {
|
||||
self.parent_hash
|
||||
}
|
||||
@ -1720,7 +1733,7 @@ mod tests {
|
||||
fn goto_end_of_slot(bank: &mut Bank) {
|
||||
let mut tick_hash = bank.last_blockhash();
|
||||
loop {
|
||||
tick_hash = extend_and_hash(&tick_hash, &[42]);
|
||||
tick_hash = hashv(&[&tick_hash.as_ref(), &[42]]);
|
||||
bank.register_tick(&tick_hash);
|
||||
if tick_hash == bank.last_blockhash() {
|
||||
bank.freeze();
|
||||
|
Reference in New Issue
Block a user