aboutsummaryrefslogtreecommitdiff
path: root/extension/lib/wallet
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-02-19 13:03:45 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-02-19 13:03:45 +0100
commitbbd20cd80a4629e6105f6565011325f6829e82d2 (patch)
tree472d1449973ef1f684561eff23a1a8b4f7225758 /extension/lib/wallet
parent29dfafaa1282d6b1e03bd7211ce598a09c22bae7 (diff)
remove FF wallet link
Diffstat (limited to 'extension/lib/wallet')
-rw-r--r--extension/lib/wallet/emscriptif.ts4
-rw-r--r--extension/lib/wallet/wallet.ts6
-rw-r--r--extension/lib/wallet/wxMessaging.ts6
3 files changed, 13 insertions, 3 deletions
diff --git a/extension/lib/wallet/emscriptif.ts b/extension/lib/wallet/emscriptif.ts
index 690800e2f..b03bc9bc7 100644
--- a/extension/lib/wallet/emscriptif.ts
+++ b/extension/lib/wallet/emscriptif.ts
@@ -381,6 +381,10 @@ export class Amount extends ArenaObject {
}
cmp(a: Amount) {
+ // If we don't check this, the c code aborts.
+ if (this.currency !== a.currency) {
+ throw Error(`incomparable currencies (${this.currency} and ${a.currency})`);
+ }
return emsc.amount_cmp(this.nativePtr, a.nativePtr);
}
diff --git a/extension/lib/wallet/wallet.ts b/extension/lib/wallet/wallet.ts
index 448714254..8e7f63b12 100644
--- a/extension/lib/wallet/wallet.ts
+++ b/extension/lib/wallet/wallet.ts
@@ -513,7 +513,7 @@ export class Wallet {
function storeMintCoin(mc) {
let mint: IMintInfo = mc[0];
- let coin = mc[1];
+ let coin: Coin = mc[1];
let cd = {
coin: coin,
denom: mint.denoms.find((e) => e.denom_pub === coin.denomPub)
@@ -521,6 +521,10 @@ export class Wallet {
if (!cd.denom) {
throw Error("denom not found (database inconsistent)");
}
+ if (cd.denom.value.currency !== paymentAmount.currency) {
+ console.warn("same pubkey for different currencies");
+ return;
+ }
let x = m[mint.baseUrl];
if (!x) {
m[mint.baseUrl] = [cd];
diff --git a/extension/lib/wallet/wxMessaging.ts b/extension/lib/wallet/wxMessaging.ts
index df79648ab..d497e5246 100644
--- a/extension/lib/wallet/wxMessaging.ts
+++ b/extension/lib/wallet/wxMessaging.ts
@@ -139,7 +139,8 @@ function dispatch(handlers, req, sendResponse) {
})
})
.catch((e) => {
- console.log("exception during wallet handler");
+ console.log(`exception during wallet handler for '${req.type}'`);
+ console.log("request", req);
console.error(e);
sendResponse({
error: "exception",
@@ -205,7 +206,8 @@ export function wxMain() {
try {
return dispatch(handlers, req, sendResponse)
} catch (e) {
- console.log("exception during wallet handler (dispatch)");
+ console.log(`exception during wallet handler (dispatch)`);
+ console.log("request", req);
console.error(e);
sendResponse({
error: "exception",