Describe the bug
Withdrawing on goerli succeeded, but had the following db error:
2020-07-27T20:00:54.203Z [WithdrawService] Withdrawal tx sent! Hash: 0x9f326203b8bb3b84f46db6fd3937aeb91c06363fb924d30a2157b1c0c0077eb5
query failed: UPDATE "withdraw" SET "onchainTransactionId" = $2, "updatedAt" = CURRENT_TIMESTAMP WHERE "id" IN ($1) RETURNING "updatedAt" -- PARAMETERS: [43,36]
error: error: duplicate key value violates unique constraint "REL_fe366fd9823feea6af8ad15717"
at Parser.parseErrorMessage (/root/node_modules/pg-protocol/dist/parser.js:278:15)
at Parser.handlePacket (/root/node_modules/pg-protocol/dist/parser.js:126:29)
at Parser.parse (/root/node_modules/pg-protocol/dist/parser.js:39:38)
at Socket.<anonymous> (/root/node_modules/pg-protocol/dist/index.js:8:42)
at Socket.emit (events.js:210:5)
at addChunk (_stream_readable.js:308:12)
at readableAddChunk (_stream_readable.js:289:11)
at Socket.Readable.push (_stream_readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:182:23) {
length: 244,
name: 'error',
severity: 'ERROR',
code: '23505',
detail: 'Key ("onchainTransactionId")=(36) already exists.',
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: 'public',
table: 'withdraw',
column: undefined,
dataType: undefined,
constraint: 'REL_fe366fd9823feea6af8ad15717',
file: 'nbtinsert.c',
line: '563',
routine: '_bt_check_unique'
}
This relation comes from the following:
await queryRunner.query(
`CREATE TABLE "withdraw" ("id" SERIAL NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "amount" text NOT NULL, "assetId" text NOT NULL, "recipient" text NOT NULL, "appInstanceId" text NOT NULL, "data" text NOT NULL, "withdrawerSignature" text NOT NULL, "counterpartySignature" text, "finalized" text NOT NULL, "channelId" integer, "onchainTransactionId" integer, CONSTRAINT "REL_fe366fd9823feea6af8ad15717" UNIQUE ("onchainTransactionId"), CONSTRAINT "PK_5c172f81689173f75bf5906ef22" PRIMARY KEY ("id"))`,
undefined,
);
Describe the bug
Withdrawing on goerli succeeded, but had the following db error:
This relation comes from the following: