mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-19 00:15:08 +00:00
Clear Transaction when no contract found
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
This commit is contained in:
parent
bf91df7ef3
commit
9aec7ffd2a
2 changed files with 13 additions and 0 deletions
|
|
@ -280,6 +280,18 @@ describe('Fabric', () => {
|
|||
const index = await redis.zrange('index:txn:timestamp', 0, -1);
|
||||
expect(index).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it('starts a retry loop which clears the saved details when no contract exist for the org', async () => {
|
||||
addMockTransationDetails(redis);
|
||||
mockContracts = new Map<string, Contract>();
|
||||
startRetryLoop(mockContracts, redis);
|
||||
jest.runOnlyPendingTimers();
|
||||
await flushPromises();
|
||||
|
||||
const index = await redis.zrange('index:txn:timestamp', 0, -1);
|
||||
expect(index).toStrictEqual([]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('evatuateTransaction', () => {
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ export const startRetryLoop = (
|
|||
if (contract) {
|
||||
await retryTransaction(contract, redis, savedTransaction);
|
||||
} else {
|
||||
clearTransactionDetails(redis,savedTransaction.transactionId)
|
||||
logger.error(
|
||||
'No contract found for %s to retry transaction %s',
|
||||
savedTransaction.mspId,
|
||||
|
|
|
|||
Loading…
Reference in a new issue