diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-02-19 01:25:56 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-02-19 01:25:56 +0100 |
commit | 07f11151aa9015c46abfbc91e3e91dc7f8590824 (patch) | |
tree | f91e7455c0e0bacd8c9c6f1e5303e7ccd6510aee /extension/lib | |
parent | f79533614f46ff2c1c70071e19549472095d447c (diff) |
fix schema issues
Diffstat (limited to 'extension/lib')
-rw-r--r-- | extension/lib/wallet/db.ts | 2 | ||||
-rw-r--r-- | extension/lib/wallet/wallet.ts | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/extension/lib/wallet/db.ts b/extension/lib/wallet/db.ts index 8c331ef6f..106f1f34c 100644 --- a/extension/lib/wallet/db.ts +++ b/extension/lib/wallet/db.ts @@ -46,7 +46,7 @@ export function openTalerDb(): Promise<IDBDatabase> { switch (e.oldVersion) { case 0: // DB does not exist yet const mints = db.createObjectStore("mints", {keyPath: "baseUrl"}); - mints.createIndex("pubKey", "keys.master_public_key"); + mints.createIndex("pubKey", "masterPublicKey"); db.createObjectStore("reserves", {keyPath: "reserve_pub"}); db.createObjectStore("denoms", {keyPath: "denomPub"}); const coins = db.createObjectStore("coins", {keyPath: "coinPub"}); diff --git a/extension/lib/wallet/wallet.ts b/extension/lib/wallet/wallet.ts index 475d316e3..1504258a1 100644 --- a/extension/lib/wallet/wallet.ts +++ b/extension/lib/wallet/wallet.ts @@ -502,11 +502,11 @@ export class Wallet { let m: MintCoins = {}; function storeMintCoin(mc) { - let mint = mc[0]; + let mint: IMintInfo = mc[0]; let coin = mc[1]; let cd = { coin: coin, - denom: mint.keys.denoms.find((e) => e.denom_pub === coin.denomPub) + denom: mint.denoms.find((e) => e.denom_pub === coin.denomPub) }; if (!cd.denom) { throw Error("denom not found (database inconsistent)"); @@ -520,6 +520,7 @@ export class Wallet { } let ps = allowedMints.map((info) => { + console.log("Checking for merchant's mint", JSON.stringify(info)); return Query(this.db) .iter("mints", {indexName: "pubKey", only: info.master_pub}) .indexJoin("coins", "mintBaseUrl", (mint) => mint.baseUrl) @@ -947,25 +948,25 @@ export class Wallet { let mintKeysJson = KeysJson.checked(JSON.parse(resp.responseText)); return Query(this.db).get("mints", baseUrl).then((r) => { - let mint; + let mintInfo; console.log("got mints result"); console.dir(r); if (!r) { - mint = MintInfo.fresh(baseUrl); + mintInfo = MintInfo.fresh(baseUrl); console.log("making fresh mint"); } else { - mint = new MintInfo(r); + mintInfo = new MintInfo(r); console.log("using old mint"); } - return mint.mergeKeys(mintKeysJson) + return mintInfo.mergeKeys(mintKeysJson, this) .then(() => { return Query(this.db) - .put("mints", mint) + .put("mints", mintInfo) .finish() - .then(() => mint); + .then(() => mintInfo); }); }); |