From 627cf5ab8ebda43f281e90d5f7185019835c662c Mon Sep 17 00:00:00 2001 From: wphan Date: Sat, 11 Nov 2023 17:09:06 -0800 Subject: [PATCH] ts-sdk: do not crash if blockhash fetch fails --- sdk/src/tx/fastSingleTxSender.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sdk/src/tx/fastSingleTxSender.ts b/sdk/src/tx/fastSingleTxSender.ts index d9791082c..c6135f8e8 100644 --- a/sdk/src/tx/fastSingleTxSender.ts +++ b/sdk/src/tx/fastSingleTxSender.ts @@ -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); }