Skip to content

Commit

Permalink
Removes querying to mirrorNode
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantina Blazhukova <[email protected]>
  • Loading branch information
konstantinabl committed Oct 21, 2024
1 parent 7963929 commit 92f5b6a
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions packages/relay/src/lib/clients/sdkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ import {
ITransactionRecordMetric,
RequestDetails,
} from '../types';
import MirrorNode from '@hashgraph/sdk/lib/MirrorNode';
import { MirrorNodeClient } from './mirrorNodeClient';
import { Registry } from 'prom-client';

const _ = require('lodash');

Expand Down Expand Up @@ -121,8 +118,6 @@ export class SDKClient {
*/
private readonly eventEmitter: EventEmitter;

private readonly mirrorNodeClient: MirrorNodeClient;

/**
* Constructs an instance of the SDKClient and initializes various services and settings.
*
Expand All @@ -139,9 +134,6 @@ export class SDKClient {
cacheService: CacheService,
eventEmitter: EventEmitter,
) {
const registry = new Registry();
const restUrl = process.env.MIRROR_NODE_REST_URL || '';
this.mirrorNodeClient = new MirrorNodeClient(restUrl, logger, registry, cacheService);
this.clientMain = clientMain;

if (process.env.CONSENSUS_MAX_EXECUTION_TIME) {
Expand Down Expand Up @@ -757,25 +749,10 @@ export class SDKClient {
);

if (!transactionResponse) {
await new Promise((resolve) => setTimeout(resolve, 2000));
const transactionId = transaction.transactionId ? transaction.transactionId.toString() : false;
console.log('Transaction id', transactionId);
if (transactionId) {
try {
const transactionFromMirrorNode = await this.mirrorNodeClient.getTransactionById(
transactionId,
requestDetails,
);
this.logger.warn('Transaction found', transactionFromMirrorNode);
} catch (e) {
this.logger.warn('Transaction not found in mirror node', e);
}
}
throw predefined.INTERNAL_ERROR(
`${requestDetails.formattedRequestId} TTransaction execution returns a null value: transactionId=${transaction.transactionId}, callerName=${callerName}, txConstructorName=${txConstructorName}`,
`${requestDetails.formattedRequestId} Transaction execution returns a null value: transactionId=${transaction.transactionId}, callerName=${callerName}, txConstructorName=${txConstructorName}`,
);
}

return transactionResponse;
} finally {
if (transactionId?.length) {
Expand Down

0 comments on commit 92f5b6a

Please sign in to comment.