diff options
author | Sebastian <sebasjm@gmail.com> | 2023-06-21 10:24:01 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-06-21 10:24:01 -0300 |
commit | 8b85fe1775e21f360ad028fc0eb3ea2c3155bfff (patch) | |
tree | da2fff01e5b60c005d1f7c6b7dd1bac447f48b38 | |
parent | 06301efda34a7b92b7e193b9af67c75946286774 (diff) |
wait 5 minutes before trigger wire transfer, prevent the exchange to make more than 1 wire transfer if the deposit takes times
-rw-r--r-- | packages/taler-wallet-core/src/operations/deposits.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts index 0bc3caec4..8fd49858f 100644 --- a/packages/taler-wallet-core/src/operations/deposits.ts +++ b/packages/taler-wallet-core/src/operations/deposits.ts @@ -60,6 +60,7 @@ import { URL, WireFee, TransactionAction, + Duration, } from "@gnu-taler/taler-util"; import { DenominationRecord, @@ -1118,6 +1119,9 @@ export async function createDepositGroup( }); const now = AbsoluteTime.now(); + const wireDeadline = AbsoluteTime.toProtocolTimestamp( + AbsoluteTime.addDuration(now, Duration.fromSpec({ minutes: 5 })), + ); const nowRounded = AbsoluteTime.toProtocolTimestamp(now); const noncePair = await ws.cryptoApi.createEddsaKeypair({}); const merchantPair = await ws.cryptoApi.createEddsaKeypair({}); @@ -1133,7 +1137,7 @@ export async function createDepositGroup( merchant_base_url: "", summary: "", nonce: noncePair.pub, - wire_transfer_deadline: nowRounded, + wire_transfer_deadline: wireDeadline, order_id: "", h_wire: wireHash, pay_deadline: AbsoluteTime.toProtocolTimestamp( |