wait 5 minutes before trigger wire transfer, prevent the exchange to make more than 1 wire transfer if the deposit takes times

This commit is contained in:
Sebastian 2023-06-21 10:24:01 -03:00
parent 06301efda3
commit 8b85fe1775
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069

View File

@ -60,6 +60,7 @@ import {
URL, URL,
WireFee, WireFee,
TransactionAction, TransactionAction,
Duration,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import {
DenominationRecord, DenominationRecord,
@ -1118,6 +1119,9 @@ export async function createDepositGroup(
}); });
const now = AbsoluteTime.now(); const now = AbsoluteTime.now();
const wireDeadline = AbsoluteTime.toProtocolTimestamp(
AbsoluteTime.addDuration(now, Duration.fromSpec({ minutes: 5 })),
);
const nowRounded = AbsoluteTime.toProtocolTimestamp(now); const nowRounded = AbsoluteTime.toProtocolTimestamp(now);
const noncePair = await ws.cryptoApi.createEddsaKeypair({}); const noncePair = await ws.cryptoApi.createEddsaKeypair({});
const merchantPair = await ws.cryptoApi.createEddsaKeypair({}); const merchantPair = await ws.cryptoApi.createEddsaKeypair({});
@ -1133,7 +1137,7 @@ export async function createDepositGroup(
merchant_base_url: "", merchant_base_url: "",
summary: "", summary: "",
nonce: noncePair.pub, nonce: noncePair.pub,
wire_transfer_deadline: nowRounded, wire_transfer_deadline: wireDeadline,
order_id: "", order_id: "",
h_wire: wireHash, h_wire: wireHash,
pay_deadline: AbsoluteTime.toProtocolTimestamp( pay_deadline: AbsoluteTime.toProtocolTimestamp(