summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2020-11-16 14:48:33 +0100
committerFlorian Dold <florian@dold.me>2020-11-16 14:48:33 +0100
commit7e07ad6b2abda4731c0d90038df179296f93d3b7 (patch)
tree2d20249aa225fd047c59faddaf2095adfc2cbe81 /packages/taler-wallet-core/src/operations
parentdeaeb17c023eb23ca97dcce08b36d5c0ebca9b0e (diff)
downloadwallet-core-7e07ad6b2abda4731c0d90038df179296f93d3b7.tar.gz
wallet-core-7e07ad6b2abda4731c0d90038df179296f93d3b7.tar.bz2
wallet-core-7e07ad6b2abda4731c0d90038df179296f93d3b7.zip
use index to check existing tip record
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/tip.ts12
1 files changed, 5 insertions, 7 deletions
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts
index 3b8ac0269..1d7386b8d 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -46,7 +46,7 @@ import { Logger } from "../util/logging";
import { checkDbInvariant } from "../util/invariants";
import { TalerErrorCode } from "../TalerErrorCode";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
-import { j2s } from '../util/helpers';
+import { j2s } from "../util/helpers";
const logger = new Logger("operations/tip.ts");
@@ -73,12 +73,10 @@ export async function prepareTip(
const amount = Amounts.parseOrThrow(tipPickupStatus.tip_amount);
- const merchantOrigin = new URL(res.merchantBaseUrl).origin;
-
- let tipRecord = await ws.db.get(Stores.tips, [
- res.merchantTipId,
- merchantOrigin,
- ]);
+ let tipRecord = await ws.db.getIndexed(
+ Stores.tips.byMerchantTipIdAndBaseUrl,
+ [res.merchantTipId, res.merchantBaseUrl],
+ );
if (!tipRecord) {
logger.trace("new tip, creating tip record");