Skip to content

Commit

Permalink
pass slot instead of bank
Browse files Browse the repository at this point in the history
  • Loading branch information
bw-solana committed Aug 9, 2024
1 parent 903a403 commit 910dc0f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion core/src/banking_stage/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl Committer {
})
.collect();
transaction_status_sender.send_transaction_status_batch(
bank.clone(),
bank.slot(),
txs,
commit_results,
TransactionBalancesSet::new(
Expand Down
6 changes: 2 additions & 4 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,6 @@ fn record_transactions(
) {
for tsm in recv {
if let TransactionStatusMessage::Batch(batch) = tsm {
let slot = batch.bank.slot();

assert_eq!(batch.transactions.len(), batch.commit_results.len());

let transactions: Vec<_> = batch
Expand Down Expand Up @@ -725,11 +723,11 @@ fn record_transactions(

let mut slots = slots.lock().unwrap();

if let Some(recorded_slot) = slots.iter_mut().find(|f| f.slot == slot) {
if let Some(recorded_slot) = slots.iter_mut().find(|f| f.slot == batch.slot) {
recorded_slot.transactions.extend(transactions);
} else {
slots.push(SlotDetails {
slot,
slot: batch.slot,
transactions,
..Default::default()
});
Expand Down
10 changes: 4 additions & 6 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub fn execute_batch(
TransactionTokenBalancesSet::new(pre_token_balances, post_token_balances);

transaction_status_sender.send_transaction_status_batch(
bank.clone(),
bank.slot(),
transactions,
commit_results,
balances,
Expand Down Expand Up @@ -2108,7 +2108,7 @@ pub enum TransactionStatusMessage {
}

pub struct TransactionStatusBatch {
pub bank: Arc<Bank>,
pub slot: Slot,
pub transactions: Vec<SanitizedTransaction>,
pub commit_results: Vec<TransactionCommitResult>,
pub balances: TransactionBalancesSet,
Expand All @@ -2124,19 +2124,17 @@ pub struct TransactionStatusSender {
impl TransactionStatusSender {
pub fn send_transaction_status_batch(
&self,
bank: Arc<Bank>,
slot: Slot,
transactions: Vec<SanitizedTransaction>,
commit_results: Vec<TransactionCommitResult>,
balances: TransactionBalancesSet,
token_balances: TransactionTokenBalancesSet,
transaction_indexes: Vec<usize>,
) {
let slot = bank.slot();

if let Err(e) = self
.sender
.send(TransactionStatusMessage::Batch(TransactionStatusBatch {
bank,
slot,
transactions,
commit_results,
balances,
Expand Down
5 changes: 2 additions & 3 deletions rpc/src/transaction_status_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ impl TransactionStatusService {
) -> Result<(), RecvTimeoutError> {
match write_transaction_status_receiver.recv_timeout(Duration::from_secs(1))? {
TransactionStatusMessage::Batch(TransactionStatusBatch {
bank,
slot,
transactions,
commit_results,
balances,
token_balances,
transaction_indexes,
}) => {
let slot = bank.slot();
for (
transaction,
commit_result,
Expand Down Expand Up @@ -384,7 +383,7 @@ pub(crate) mod tests {
let signature = *transaction.signature();
let transaction_index: usize = bank.transaction_count().try_into().unwrap();
let transaction_status_batch = TransactionStatusBatch {
bank,
slot,
transactions: vec![transaction],
commit_results: vec![commit_result],
balances,
Expand Down

0 comments on commit 910dc0f

Please sign in to comment.