Skip to content

Commit

Permalink
Use median block num for solana tx batch
Browse files Browse the repository at this point in the history
  • Loading branch information
vrtnd committed Jul 27, 2024
1 parent 27a2c95 commit d5bdd3f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,9 @@ export const runAdapterHistorical = async (

if (chain === "solana") {
latestSolanaBlock = await getLatestBlock("solana");
const averageBlock = Math.floor((minBlock + maxBlock) / 2);
const connection = getConnection();

averageBlockTimestamp = await connection.getBlockTime(averageBlock);
const medianBlockNumber = txBlocks?.sort((a, b) => a - b)?.[Math.floor(txBlocks.length / 2)];
averageBlockTimestamp = await connection.getBlockTime(medianBlockNumber);
}

for (let i = 0; i < 10; i++) {
Expand Down

0 comments on commit d5bdd3f

Please sign in to comment.