Skip to content

Commit

Permalink
ts-sdk: do not crash if blockhash fetch fails (#690)
Browse files Browse the repository at this point in the history
  • Loading branch information
wphan committed Nov 12, 2023
1 parent 827b84d commit 70f7068
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sdk/src/tx/fastSingleTxSender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ export class FastSingleTxSender extends BaseTxSender {

startBlockhashRefreshLoop(): void {
setInterval(async () => {
this.recentBlockhash = (
await this.connection.getLatestBlockhash(this.opts)
).blockhash;
try {
this.recentBlockhash = (
await this.connection.getLatestBlockhash(this.opts)
).blockhash;
} catch (e) {
console.error('Error in startBlockhashRefreshLoop: ', e);
}
}, this.blockhashRefreshInterval);
}

Expand Down

0 comments on commit 70f7068

Please sign in to comment.