Skip to content

Commit

Permalink
No need to start 2nd get_block_with_limit call with first block again
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Jan 18, 2024
1 parent 9d64520 commit 766a416
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,15 @@ impl JsonRpcRequestProcessor {

let bank = self.get_bank_with_config(slot_context)?;

let mut reward_map: HashMap<String, (Reward, Slot)> = {
let first_confirmed_block_in_epoch = *self
.get_blocks_with_limit(first_slot_in_epoch, 1, config.commitment)
.await?
.first()
.ok_or(RpcCustomError::BlockNotAvailable {
slot: first_slot_in_epoch,
})?;
let first_confirmed_block_in_epoch = *self
.get_blocks_with_limit(first_slot_in_epoch, 1, config.commitment)
.await?
.first()
.ok_or(RpcCustomError::BlockNotAvailable {
slot: first_slot_in_epoch,
})?;

let mut reward_map: HashMap<String, (Reward, Slot)> = {
let addresses: Vec<String> =
addresses.iter().map(|pubkey| pubkey.to_string()).collect();

Expand Down Expand Up @@ -643,8 +643,8 @@ impl JsonRpcRequestProcessor {

let block_list = self
.get_blocks_with_limit(
first_slot_in_epoch,
partition_data.num_partitions + 1,
first_confirmed_block_in_epoch + 1,
partition_data.num_partitions,
config.commitment,
)
.await?;
Expand Down

0 comments on commit 766a416

Please sign in to comment.