sonot duplicate sendTx
This commit is contained in:
@@ -260,23 +260,39 @@ class RPCProxy {
|
|||||||
() => responseCompleted = true,
|
() => responseCompleted = true,
|
||||||
() => clientCloseReason
|
() => clientCloseReason
|
||||||
);
|
);
|
||||||
const comparePromise = this.compareResponse(requestId, requestBody, startTime);
|
|
||||||
|
// Check if method should be excluded from comparison
|
||||||
|
const excludedMethods = ['eth_sendRawTransaction', 'eth_sendTransaction'];
|
||||||
|
const shouldCompare = !excludedMethods.includes(requestBody.method);
|
||||||
|
|
||||||
|
let comparePromise = null;
|
||||||
|
if (shouldCompare) {
|
||||||
|
comparePromise = this.compareResponse(requestId, requestBody, startTime);
|
||||||
|
} else {
|
||||||
|
logger.info({
|
||||||
|
requestId,
|
||||||
|
method: requestBody.method,
|
||||||
|
reason: 'excluded_write_transaction',
|
||||||
|
}, 'Skipping comparison for write transaction method');
|
||||||
|
}
|
||||||
|
|
||||||
// Wait for the stream to complete and get response info
|
// Wait for the stream to complete and get response info
|
||||||
const streamInfo = await streamPromise;
|
const streamInfo = await streamPromise;
|
||||||
|
|
||||||
// Get comparison response
|
// Get comparison response if applicable
|
||||||
comparePromise.then(compareInfo => {
|
if (comparePromise) {
|
||||||
if (compareInfo && streamInfo) {
|
comparePromise.then(compareInfo => {
|
||||||
this.compareResponses(requestId, streamInfo, compareInfo, requestBody);
|
if (compareInfo && streamInfo) {
|
||||||
}
|
this.compareResponses(requestId, streamInfo, compareInfo, requestBody);
|
||||||
}).catch(err => {
|
}
|
||||||
logger.error({
|
}).catch(err => {
|
||||||
requestId,
|
logger.error({
|
||||||
error: err.message,
|
requestId,
|
||||||
endpoint: 'compare',
|
error: err.message,
|
||||||
}, 'Error in comparison request');
|
endpoint: 'compare',
|
||||||
});
|
}, 'Error in comparison request');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error({
|
logger.error({
|
||||||
|
|||||||
Reference in New Issue
Block a user