aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/withdraw.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-10-14 21:00:13 +0200
committerFlorian Dold <florian@dold.me>2022-10-14 22:10:10 +0200
commitf1cba79c656875af0c6a09fd8e03b2c94fb2ac44 (patch)
tree469036c26f2ab84a5db218dd8833c38560c09e3d /packages/taler-wallet-core/src/operations/withdraw.ts
parent398e79d0d6b649d8921ffffa4d0be8775c15626e (diff)
downloadwallet-core-f1cba79c656875af0c6a09fd8e03b2c94fb2ac44.tar.xz
wallet-core: DB tweaks
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts23
1 files changed, 12 insertions, 11 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index e4bf6cd11..145a2d9c7 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -70,6 +70,7 @@ import {
DenominationRecord,
DenominationVerificationStatus,
PlanchetRecord,
+ PlanchetStatus,
WalletStoresV1,
WgInfo,
WithdrawalGroupRecord,
@@ -430,7 +431,7 @@ async function processPlanchetGenerate(
coinPub: r.coinPub,
denomPubHash: r.denomPubHash,
reservePub: r.reservePub,
- withdrawalDone: false,
+ planchetStatus: PlanchetStatus.Pending,
withdrawSig: r.withdrawSig,
withdrawalGroupId: withdrawalGroup.withdrawalGroupId,
maxAge: withdrawalGroup.restrictAge ?? AgeRestriction.AGE_UNRESTRICTED,
@@ -481,7 +482,7 @@ async function processPlanchetExchangeRequest(
if (!planchet) {
return;
}
- if (planchet.withdrawalDone) {
+ if (planchet.planchetStatus === PlanchetStatus.WithdrawalDone) {
logger.warn("processPlanchet: planchet already withdrawn");
return;
}
@@ -593,7 +594,7 @@ async function processPlanchetExchangeBatchRequest(
if (!planchet) {
return;
}
- if (planchet.withdrawalDone) {
+ if (planchet.planchetStatus === PlanchetStatus.WithdrawalDone) {
logger.warn("processPlanchet: planchet already withdrawn");
return;
}
@@ -652,7 +653,7 @@ async function processPlanchetVerifyAndStoreCoin(
if (!planchet) {
return;
}
- if (planchet.withdrawalDone) {
+ if (planchet.planchetStatus === PlanchetStatus.WithdrawalDone) {
logger.warn("processPlanchet: planchet already withdrawn");
return;
}
@@ -767,10 +768,10 @@ async function processPlanchetVerifyAndStoreCoin(
])
.runReadWrite(async (tx) => {
const p = await tx.planchets.get(planchetCoinPub);
- if (!p || p.withdrawalDone) {
+ if (!p || p.planchetStatus === PlanchetStatus.WithdrawalDone) {
return false;
}
- p.withdrawalDone = true;
+ p.planchetStatus = PlanchetStatus.WithdrawalDone;
await tx.planchets.put(p);
await makeCoinAvailable(ws, tx, coin);
return true;
@@ -1140,7 +1141,7 @@ export async function processWithdrawalGroup(
await tx.planchets.indexes.byGroup
.iter(withdrawalGroupId)
.forEach((x) => {
- if (x.withdrawalDone) {
+ if (x.planchetStatus === PlanchetStatus.WithdrawalDone) {
numFinished++;
}
if (x.lastError) {
@@ -1258,10 +1259,10 @@ export async function getExchangeWithdrawalInfo(
});
let versionMatch;
- if (exchangeDetails.protocolVersion) {
+ if (exchangeDetails.protocolVersionRange) {
versionMatch = LibtoolVersion.compare(
WALLET_EXCHANGE_PROTOCOL_VERSION,
- exchangeDetails.protocolVersion,
+ exchangeDetails.protocolVersionRange,
);
if (
@@ -1271,7 +1272,7 @@ export async function getExchangeWithdrawalInfo(
) {
logger.warn(
`wallet's support for exchange protocol version ${WALLET_EXCHANGE_PROTOCOL_VERSION} might be outdated ` +
- `(exchange has ${exchangeDetails.protocolVersion}), checking for updates`,
+ `(exchange has ${exchangeDetails.protocolVersionRange}), checking for updates`,
);
}
}
@@ -1296,7 +1297,7 @@ export async function getExchangeWithdrawalInfo(
earliestDepositExpiration,
exchangePaytoUris: paytoUris,
exchangeWireAccounts,
- exchangeVersion: exchangeDetails.protocolVersion || "unknown",
+ exchangeVersion: exchangeDetails.protocolVersionRange || "unknown",
isAudited,
isTrusted,
numOfferedDenoms: possibleDenoms.length,