Skip to content

Commit

Permalink
feat: check recent confirmed utxos to void missing pending xudt
Browse files Browse the repository at this point in the history
  • Loading branch information
ahonn committed Jun 19, 2024
1 parent 5544caf commit 735ffb9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/routes/rgbpp/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,12 @@ const addressRoutes: FastifyPluginCallback<Record<never, never>, Server, ZodType
};
});

const pendingUtxos = utxos.filter((utxo) => !utxo.status.confirmed);
const pendingUtxos = utxos.filter(
(utxo) =>
!utxo.status.confirmed ||
// include utxo that confirmed in 20 minutes to avoid missing pending xudt
(utxo.status.block_time && Date.now() - utxo.status.block_time / 1000 < 20 * 60),
);
const pendingUtxosGroup = groupBy(pendingUtxos, (utxo) => utxo.txid);
const pendingTxids = Object.keys(pendingUtxosGroup);

Expand Down

0 comments on commit 735ffb9

Please sign in to comment.