diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-12-19 20:42:49 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-12-19 20:42:49 +0100 |
commit | 0c9358c1b2bd80e25940022e86bd8daef8184ad7 (patch) | |
tree | a8c8ca0134bd886d8151633aff4c85e9513ad32c /src/operations/pending.ts | |
parent | 49e3b3e5b9bbf1ce356ef68f301d50c689ceecb9 (diff) | |
download | wallet-core-0c9358c1b2bd80e25940022e86bd8daef8184ad7.tar.xz |
new date format, replace checkable annotations with codecs
Diffstat (limited to 'src/operations/pending.ts')
-rw-r--r-- | src/operations/pending.ts | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/operations/pending.ts b/src/operations/pending.ts index 360180854..ed3b59d71 100644 --- a/src/operations/pending.ts +++ b/src/operations/pending.ts @@ -27,7 +27,7 @@ import { PendingOperationsResponse, PendingOperationType, } from "../types/pending"; -import { Duration, getTimestampNow, Timestamp } from "../types/walletTypes"; +import { Duration, getTimestampNow, Timestamp, getDurationRemaining, durationMin } from "../util/time"; import { TransactionHandle } from "../util/query"; import { InternalWalletState } from "./state"; @@ -36,10 +36,8 @@ function updateRetryDelay( now: Timestamp, retryTimestamp: Timestamp, ): Duration { - if (retryTimestamp.t_ms <= now.t_ms) { - return { d_ms: 0 }; - } - return { d_ms: Math.min(oldDelay.d_ms, retryTimestamp.t_ms - now.t_ms) }; + const remaining = getDurationRemaining(retryTimestamp, now); + return durationMin(oldDelay, remaining); } async function gatherExchangePending( @@ -278,7 +276,7 @@ async function gatherProposalPending( resp.pendingOperations.push({ type: PendingOperationType.ProposalChoice, givesLifeness: false, - merchantBaseUrl: proposal.download!!.contractTerms.merchant_base_url, + merchantBaseUrl: proposal.download!!.contractData.merchantBaseUrl, proposalId: proposal.proposalId, proposalTimestamp: proposal.timestamp, }); |