Skip to content

Commit

Permalink
update handler when exist an outpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
perfogic committed Oct 7, 2024
1 parent 008eeea commit 6c95950
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions packages/orchestrator/src/services/relayer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,15 +515,34 @@ class RelayerService implements RelayerInterface {
});

if (isExistOutpoint === true) {
setNestedMap(
this.depositIndex,
[
toReceiverAddr(convertSdkDestToWasmDest(script.dest)),
address,
getTxidKey(txid, i),
],
undefined
// Remove this outpoint from deposit index
let bitcoinAddrMap = this.depositIndex.get(
toReceiverAddr(convertSdkDestToWasmDest(script.dest))
);
if (!bitcoinAddrMap) continue;
let txidMap = bitcoinAddrMap.get(address);
if (!txidMap) continue;
txidMap.delete(getTxidKey(txid, i));

if (
this.depositIndex
.get(toReceiverAddr(convertSdkDestToWasmDest(script.dest)))
?.get(address)
?.get(getTxidKey(txid, i)) !== undefined
) {
this.logger.error(
`Failed to remove deposit index for txid ${txid} at vout ${i}`
);
setNestedMap(
this.depositIndex,
[
toReceiverAddr(convertSdkDestToWasmDest(script.dest)),
address,
getTxidKey(txid, i),
],
undefined
);
}
continue;
}

Expand Down

0 comments on commit 6c95950

Please sign in to comment.