aboutsummaryrefslogtreecommitdiff
path: root/lib/wallet/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-18 01:47:40 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-18 01:47:40 +0200
commit218c7d5bd6a918bd177982f9728ab809e1a3345b (patch)
treedbe0be3a6ddbce12b9129e8e6e87ba39c17ab932 /lib/wallet/wallet.ts
parent700eb32f5a8852a8004782b199e5fcca4c847116 (diff)
downloadwallet-core-218c7d5bd6a918bd177982f9728ab809e1a3345b.tar.xz
be even more safe in db
Diffstat (limited to 'lib/wallet/wallet.ts')
-rw-r--r--lib/wallet/wallet.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/wallet/wallet.ts b/lib/wallet/wallet.ts
index 54c979919..f55ba2170 100644
--- a/lib/wallet/wallet.ts
+++ b/lib/wallet/wallet.ts
@@ -329,9 +329,17 @@ namespace Stores {
timestampIndex = new Index<number,HistoryRecord>(this, "timestamp");
}
+ class TransactionsStore extends Store<Transaction> {
+ constructor() {
+ super("transactions");
+ }
+
+ repurchaseIndex = new Index<[string,string],Transaction>(this, "repurchase");
+ }
+
export let exchanges: ExchangeStore = new ExchangeStore();
- export let transactions: Store<Transaction> = new Store<Transaction>("transactions");
+ export let transactions: TransactionsStore = new TransactionsStore();
export let reserves: Store<ReserveRecord> = new Store<ReserveRecord>("reserves");
export let coins: CoinsStore = new CoinsStore();
export let refresh: Store<RefreshSession> = new Store<RefreshSession>("refresh");
@@ -1444,10 +1452,9 @@ export class Wallet {
console.log("no repurchase: no correlation id");
return {isRepurchase: false};
}
- let result: Transaction = await (
+ let result: Transaction|undefined = await (
this.q()
- .getIndexed("transactions",
- "repurchase",
+ .getIndexed(Stores.transactions.repurchaseIndex,
[
contract.merchant_pub,
contract.repurchase_correlation_id