Skip to content

Commit

Permalink
Make sure to not proxy to RPC when already handled request
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Oct 21, 2024
1 parent 2c31b10 commit 806b1a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions json-rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const handleJsonRpc = async ctx => {

ctx.body = rpcResult(body.id, await handleQuery({ blockHeight, body }));
}
break;
return;
}
case 'chunk': {
const { block_id, shard_id } = body.params;
Expand All @@ -268,23 +268,23 @@ const handleJsonRpc = async ctx => {

throw new FastNEARError('chunkNotFound', `Chunk not found: ${block_id} ${shard_id}`, { block_id, shard_id });
}
break;
return;
}
case 'broadcast_tx_commit': {
const result = await submitTransaction(Buffer.from(body.params[0], 'base64'));
ctx.body = rpcResult(body.id, result);
break;
return;
}
default:
// Fall back to proxying
break;
await proxyJson(ctx);
}
} catch (error) {
await handleError({ ctx, blockHeight: null, error });
return;
}

await proxyJson(ctx);
throw new Error('Should not happen');
};

async function handleQuery({ blockHeight, body }) {
Expand Down

0 comments on commit 806b1a9

Please sign in to comment.