Skip to content

Commit

Permalink
waiting for relayer info update
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Jan 26, 2024
1 parent 01c38c9 commit e6b3e10
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions apollo/src/lnv3/lnv3.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,23 @@ export class Lnv3Service implements OnModuleInit {
let requestWithdrawTimestamp = Number(relayRecord.requestWithdrawTimestamp);
let endTxHash = record.endTxHash;
if (record.result !== RecordStatus.success) {
const providerId = this.genRelayInfoID(
transfer.chainId,
toChain.chainId,
record.relayer,
record.sendTokenAddress
);
const relayerInfo = await this.aggregationService.queryLnBridgeRelayInfoById({
id: providerId,
});
// waiting for relayer info update
if (!relayerInfo) {
this.logger.log(
`lnv3 [${transfer.chain}->${toChain.chain}] waiting for relayer info update, id: ${providerId}`
);
continue;
}

if (relayRecord.slashed) {
needWithdrawLiquidity = false;
}
Expand All @@ -217,17 +234,9 @@ export class Lnv3Service implements OnModuleInit {
data: updateData,
});

const cost = relayRecord.slashed ? relayRecord.fee : 0;
const profit = relayRecord.slashed ? record.fee : 0;
const providerId = this.genRelayInfoID(
transfer.chainId,
toChain.chainId,
record.relayer,
record.sendTokenAddress
);
const relayerInfo = await this.aggregationService.queryLnBridgeRelayInfoById({
id: providerId,
});
const cost = relayRecord.slashed ? 0 : relayRecord.fee;
const profit = relayRecord.slashed ? 0 : record.fee;

await this.aggregationService.updateLnBridgeRelayInfo({
where: { id: providerId },
data: {
Expand Down

0 comments on commit e6b3e10

Please sign in to comment.