Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions packages/request-node/test/persistTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,40 @@ describe('persistTransaction', () => {
}
await Promise.all(assertions);
});

it('should return 200 on the second call, even after a transaction is rejected by the RPC', async () => {
axiosMock.reset();
axiosMock.onAny().reply((req) => {
if (req.data.body?.includes('eth_sendTransaction')) {
return [
StatusCodes.INTERNAL_SERVER_ERROR,
{
jsonrpc: '2.0',
error: {
code: -32010,
message:
'FeeTooLow, EffectivePriorityFeePerGas too low 513061393 < 1000000000, BaseFee: 20101010505',
},
id: 3939,
},
];
}
return [StatusCodes.OK];
});

await request(server)
.post('/persistTransaction')
.send({ channelId, topics, transactionData })
.set('Accept', 'application/json')
.expect(StatusCodes.INTERNAL_SERVER_ERROR);

axiosMock.reset();
axiosMock.onAny().passThrough();

await request(server)
.post('/persistTransaction')
.send({ channelId, topics, transactionData })
.set('Accept', 'application/json')
.expect(StatusCodes.OK);
});
});