Skip to content

Commit

Permalink
Fix waiting for jito confirm timeout (#9)
Browse files Browse the repository at this point in the history
Co-authored-by: mrlotfi <[email protected]>
  • Loading branch information
mrlotfi and mrlotfi authored Sep 1, 2024
1 parent 817f580 commit 27504e5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/utils/solana-trx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ export class SolanaMultiTxSender {
const url = 'ws://bundles-api-rest.jito.wtf/api/v1/bundles/tip_stream';
const connection = new WebSocket(url);
connection.on('message', (message) => {
const newFiftyPercentileTip = Number(
JSON.parse(message.toString())[0]['ema_landed_tips_50th_percentile'],
);
const newFiftyPercentileTip = Number(JSON.parse(message.toString())[0]['landed_tips_75th_percentile']);
this.minJitoTipAmount = Math.min(
this.maxJitoTipAmount,
Math.max(newFiftyPercentileTip, this.minJitoTipAmount),
Expand Down Expand Up @@ -137,7 +135,7 @@ export class SolanaMultiTxSender {
const interval = 1000;
const startTime = Date.now();

while (Date.now() - startTime < timeout || (await this.connection.getBlockHeight()) <= lastValidBlockHeight) {
while (Date.now() - startTime < timeout && (await this.connection.getBlockHeight()) <= lastValidBlockHeight) {
const bundleStatuses = await getBundleStatuses(
[bundleId],
`${this.rpcConfig.solana.jitoEndpoint}/api/v1/bundles`,
Expand Down

0 comments on commit 27504e5

Please sign in to comment.