diff --git a/src/bank.rs b/src/bank.rs index e1e1558c9736b1..856dab7a748ba9 100644 --- a/src/bank.rs +++ b/src/bank.rs @@ -309,6 +309,10 @@ impl Bank { } } + pub fn trunk_fork(&self) -> BankState { + self.forks.read().unwrap().trunk_fork() + } + #[must_use] fn process_and_record_transactions_on_fork( &self, @@ -372,7 +376,7 @@ impl Bank { { let block: Vec = group.collect(); - if !Entry::verify_many(&block, &last_id) { + if !block.as_slice().verify(&last_id) { warn!("Ledger proof of history failed at entry: {}", entry_height); return Err(BankError::LedgerVerificationFailed); } @@ -384,8 +388,7 @@ impl Bank { self.init_fork(new, &block[0].id, base) .expect("initializing fork for replay"); //there is only one base, and its the current live fork - let new_trunk = self - .forks + self.forks .write() .unwrap() .merge_into_trunk(base, new) diff --git a/src/compute_leader_finality_service.rs b/src/compute_leader_finality_service.rs index 4e549bac35a407..0607aff9e5d2f1 100644 --- a/src/compute_leader_finality_service.rs +++ b/src/compute_leader_finality_service.rs @@ -42,7 +42,7 @@ impl ComputeLeaderFinalityService { // process_transaction(), case VoteInstruction::RegisterAccount), this will be more accurate. // See github issue 1654. let state = bank.trunk_fork(); - let accounts = state.accounts.accounts_db.read().unwrap(); + let accounts = state.head().accounts.accounts_db.read().unwrap(); accounts .accounts .iter() diff --git a/src/entry.rs b/src/entry.rs index fcae97fce9ba8b..f14e64cbb3e403 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -196,17 +196,6 @@ impl Entry { } true } - pub fn verify_many(entries: &[Self], start_hash: &Hash) -> bool { - let mut hash = *start_hash; - for e in entries { - if !e.verify(&hash) { - return false; - } - hash = e.id; - } - true - } - pub fn is_tick(&self) -> bool { self.transactions.is_empty() } diff --git a/src/leader_scheduler.rs b/src/leader_scheduler.rs index 3071e057bf7a58..638b07f3c4b08f 100644 --- a/src/leader_scheduler.rs +++ b/src/leader_scheduler.rs @@ -319,7 +319,7 @@ impl LeaderScheduler { { let state = bank.trunk_fork(); - let accounts = state.accounts.accounts_db.read().unwrap(); + let accounts = state.head().accounts.accounts_db.read().unwrap(); // TODO: iterate through checkpoints, too accounts diff --git a/src/replay_stage.rs b/src/replay_stage.rs index d20c4e0cfba713..3154036d9fe818 100644 --- a/src/replay_stage.rs +++ b/src/replay_stage.rs @@ -82,11 +82,11 @@ impl ReplayStage { /// Process entry blobs, already in order fn process_entries( bank: &Arc, - cluster_info: &Arc>, + _cluster_info: &Arc>, window_receiver: &EntryReceiver, - keypair: &Arc, - vote_account_keypair: &Arc, - vote_blob_sender: Option<&BlobSender>, + _keypair: &Arc, + _vote_account_keypair: &Arc, + _vote_blob_sender: Option<&BlobSender>, ledger_entry_sender: &EntrySender, entry_height: &mut u64, last_entry_id: &mut Hash,