aboutsummaryrefslogtreecommitdiff
path: root/src/wallet-impl
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-07 20:35:47 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-07 20:35:47 +0100
commit27e42111e77b6f1ead1d0e341a3cfe9e4b68ecd3 (patch)
treeecac32131713c865c813df994fd8db597051c4b0 /src/wallet-impl
parent165486a11268ab3d8009506916cd22d233cd248b (diff)
fix pending operation query for refunds
Diffstat (limited to 'src/wallet-impl')
-rw-r--r--src/wallet-impl/pending.ts54
1 files changed, 30 insertions, 24 deletions
diff --git a/src/wallet-impl/pending.ts b/src/wallet-impl/pending.ts
index 5fb9ef5ce..729dcf125 100644
--- a/src/wallet-impl/pending.ts
+++ b/src/wallet-impl/pending.ts
@@ -366,14 +366,16 @@ async function gatherPurchasePending(
now,
pr.payRetryInfo.nextRetry,
);
- resp.pendingOperations.push({
- type: "pay",
- givesLifeness: true,
- isReplay: false,
- proposalId: pr.proposalId,
- retryInfo: pr.payRetryInfo,
- lastError: pr.lastPayError,
- });
+ if (!onlyDue || pr.payRetryInfo.nextRetry.t_ms <= now.t_ms) {
+ resp.pendingOperations.push({
+ type: "pay",
+ givesLifeness: true,
+ isReplay: false,
+ proposalId: pr.proposalId,
+ retryInfo: pr.payRetryInfo,
+ lastError: pr.lastPayError,
+ });
+ }
}
if (pr.refundStatusRequested) {
resp.nextRetryDelay = updateRetryDelay(
@@ -381,13 +383,15 @@ async function gatherPurchasePending(
now,
pr.refundStatusRetryInfo.nextRetry,
);
- resp.pendingOperations.push({
- type: "refund-query",
- givesLifeness: true,
- proposalId: pr.proposalId,
- retryInfo: pr.refundStatusRetryInfo,
- lastError: pr.lastRefundStatusError,
- });
+ if (!onlyDue || pr.refundStatusRetryInfo.nextRetry.t_ms <= now.t_ms) {
+ resp.pendingOperations.push({
+ type: "refund-query",
+ givesLifeness: true,
+ proposalId: pr.proposalId,
+ retryInfo: pr.refundStatusRetryInfo,
+ lastError: pr.lastRefundStatusError,
+ });
+ }
}
const numRefundsPending = Object.keys(pr.refundsPending).length;
if (numRefundsPending > 0) {
@@ -397,15 +401,17 @@ async function gatherPurchasePending(
now,
pr.refundApplyRetryInfo.nextRetry,
);
- resp.pendingOperations.push({
- type: "refund-apply",
- numRefundsDone,
- numRefundsPending,
- givesLifeness: true,
- proposalId: pr.proposalId,
- retryInfo: pr.refundApplyRetryInfo,
- lastError: pr.lastRefundApplyError,
- });
+ if (!onlyDue || pr.refundApplyRetryInfo.nextRetry.t_ms <= now.t_ms) {
+ resp.pendingOperations.push({
+ type: "refund-apply",
+ numRefundsDone,
+ numRefundsPending,
+ givesLifeness: true,
+ proposalId: pr.proposalId,
+ retryInfo: pr.refundApplyRetryInfo,
+ lastError: pr.lastRefundApplyError,
+ });
+ }
}
});
}