Move entry/poh to own crate to speed up poh bench build (#18225)
This commit is contained in:
@ -44,7 +44,6 @@ use crate::{
|
||||
blockhash_queue::BlockhashQueue,
|
||||
builtins::{self, ActivationType},
|
||||
epoch_stakes::{EpochStakes, NodeVoteAccounts},
|
||||
hashed_transaction::{HashedTransaction, HashedTransactionSlice},
|
||||
inline_spl_token_v2_0,
|
||||
instruction_recorder::InstructionRecorder,
|
||||
log_collector::LogCollector,
|
||||
@ -85,6 +84,7 @@ use solana_sdk::{
|
||||
genesis_config::{ClusterType, GenesisConfig},
|
||||
hard_forks::HardForks,
|
||||
hash::{extend_and_hash, hashv, Hash},
|
||||
hashed_transaction::{HashedTransaction, HashedTransactionSlice},
|
||||
incinerator,
|
||||
inflation::Inflation,
|
||||
instruction::CompiledInstruction,
|
||||
|
@ -1,10 +1,9 @@
|
||||
use crate::{
|
||||
bank::{Bank, TransactionResults},
|
||||
genesis_utils::{self, GenesisConfigInfo, ValidatorVoteKeypairs},
|
||||
hashed_transaction::HashedTransaction,
|
||||
vote_sender_types::ReplayVoteSender,
|
||||
};
|
||||
use solana_sdk::{pubkey::Pubkey, signature::Signer};
|
||||
use solana_sdk::{hashed_transaction::HashedTransaction, pubkey::Pubkey, signature::Signer};
|
||||
use solana_vote_program::vote_transaction;
|
||||
|
||||
pub fn setup_bank_and_vote_pubkeys(num_vote_accounts: usize, stake: u64) -> (Bank, Vec<Pubkey>) {
|
||||
|
@ -1,50 +0,0 @@
|
||||
use solana_sdk::{hash::Hash, transaction::Transaction};
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// Transaction and the hash of its message
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct HashedTransaction<'a> {
|
||||
transaction: Cow<'a, Transaction>,
|
||||
pub message_hash: Hash,
|
||||
}
|
||||
|
||||
impl<'a> HashedTransaction<'a> {
|
||||
pub fn new(transaction: Cow<'a, Transaction>, message_hash: Hash) -> Self {
|
||||
Self {
|
||||
transaction,
|
||||
message_hash,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn transaction(&self) -> &Transaction {
|
||||
self.transaction.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<Transaction> for HashedTransaction<'_> {
|
||||
fn from(transaction: Transaction) -> Self {
|
||||
Self {
|
||||
message_hash: transaction.message().hash(),
|
||||
transaction: Cow::Owned(transaction),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a Transaction> for HashedTransaction<'a> {
|
||||
fn from(transaction: &'a Transaction) -> Self {
|
||||
Self {
|
||||
message_hash: transaction.message().hash(),
|
||||
transaction: Cow::Borrowed(transaction),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait HashedTransactionSlice<'a> {
|
||||
fn as_transactions_iter(&'a self) -> Box<dyn Iterator<Item = &'a Transaction> + '_>;
|
||||
}
|
||||
|
||||
impl<'a> HashedTransactionSlice<'a> for [HashedTransaction<'a>] {
|
||||
fn as_transactions_iter(&'a self) -> Box<dyn Iterator<Item = &'a Transaction> + '_> {
|
||||
Box::new(self.iter().map(|h| h.transaction.as_ref()))
|
||||
}
|
||||
}
|
@ -20,7 +20,6 @@ pub mod contains;
|
||||
pub mod epoch_stakes;
|
||||
pub mod genesis_utils;
|
||||
pub mod hardened_unpack;
|
||||
pub mod hashed_transaction;
|
||||
pub mod inline_spl_token_v2_0;
|
||||
pub mod instruction_recorder;
|
||||
pub mod loader_utils;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::bank::Bank;
|
||||
use crate::hashed_transaction::HashedTransaction;
|
||||
use solana_sdk::hashed_transaction::HashedTransaction;
|
||||
use solana_sdk::transaction::{Result, Transaction};
|
||||
use std::borrow::Cow;
|
||||
|
||||
|
Reference in New Issue
Block a user