warn about incompatible versions on withdraw
This commit is contained in:
parent
2b1e88737f
commit
2cf33705c8
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,3 +6,5 @@ dist/
|
||||
# Even though node_modules are tracked in git,
|
||||
# per default we don't want them to show up in git status
|
||||
node_modules
|
||||
|
||||
*.swp
|
||||
|
@ -151,44 +151,44 @@ msgid ""
|
||||
"selected."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:424
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:455
|
||||
#, c-format
|
||||
msgid "Accept fees and withdraw"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:429
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:460
|
||||
#, c-format
|
||||
msgid "Change Exchange Provider"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:485
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:517
|
||||
#, c-format
|
||||
msgid "You are about to withdraw %1$s from your bank account into your wallet."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:568
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Oops, something went wrong. The wallet responded with error status (%1$s)."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:579
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:611
|
||||
#, c-format
|
||||
msgid "Checking URL, please wait ..."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:593
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:625
|
||||
#, c-format
|
||||
msgid "Can't parse amount: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:632
|
||||
#, c-format
|
||||
msgid "Can't parse wire_types: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#. TODO:generic error reporting function or component.
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:620
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:652
|
||||
#, c-format
|
||||
msgid "Fatal error: \"%1$s\"."
|
||||
msgstr ""
|
||||
|
@ -151,44 +151,44 @@ msgid ""
|
||||
"selected."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:424
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:455
|
||||
#, c-format
|
||||
msgid "Accept fees and withdraw"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:429
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:460
|
||||
#, c-format
|
||||
msgid "Change Exchange Provider"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:485
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:517
|
||||
#, c-format
|
||||
msgid "You are about to withdraw %1$s from your bank account into your wallet."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:568
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Oops, something went wrong. The wallet responded with error status (%1$s)."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:579
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:611
|
||||
#, c-format
|
||||
msgid "Checking URL, please wait ..."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:593
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:625
|
||||
#, c-format
|
||||
msgid "Can't parse amount: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:632
|
||||
#, c-format
|
||||
msgid "Can't parse wire_types: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#. TODO:generic error reporting function or component.
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:620
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:652
|
||||
#, c-format
|
||||
msgid "Fatal error: \"%1$s\"."
|
||||
msgstr ""
|
||||
|
@ -151,44 +151,44 @@ msgid ""
|
||||
"selected."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:424
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:455
|
||||
#, c-format
|
||||
msgid "Accept fees and withdraw"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:429
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:460
|
||||
#, c-format
|
||||
msgid "Change Exchange Provider"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:485
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:517
|
||||
#, c-format
|
||||
msgid "You are about to withdraw %1$s from your bank account into your wallet."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:568
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Oops, something went wrong. The wallet responded with error status (%1$s)."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:579
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:611
|
||||
#, c-format
|
||||
msgid "Checking URL, please wait ..."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:593
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:625
|
||||
#, c-format
|
||||
msgid "Can't parse amount: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:632
|
||||
#, c-format
|
||||
msgid "Can't parse wire_types: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#. TODO:generic error reporting function or component.
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:620
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:652
|
||||
#, c-format
|
||||
msgid "Fatal error: \"%1$s\"."
|
||||
msgstr ""
|
||||
|
@ -151,44 +151,44 @@ msgid ""
|
||||
"selected."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:424
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:455
|
||||
#, c-format
|
||||
msgid "Accept fees and withdraw"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:429
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:460
|
||||
#, c-format
|
||||
msgid "Change Exchange Provider"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:485
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:517
|
||||
#, c-format
|
||||
msgid "You are about to withdraw %1$s from your bank account into your wallet."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:568
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Oops, something went wrong. The wallet responded with error status (%1$s)."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:579
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:611
|
||||
#, c-format
|
||||
msgid "Checking URL, please wait ..."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:593
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:625
|
||||
#, c-format
|
||||
msgid "Can't parse amount: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:632
|
||||
#, c-format
|
||||
msgid "Can't parse wire_types: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#. TODO:generic error reporting function or component.
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:620
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:652
|
||||
#, c-format
|
||||
msgid "Fatal error: \"%1$s\"."
|
||||
msgstr ""
|
||||
|
@ -151,44 +151,44 @@ msgid ""
|
||||
"selected."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:424
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:455
|
||||
#, c-format
|
||||
msgid "Accept fees and withdraw"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:429
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:460
|
||||
#, c-format
|
||||
msgid "Change Exchange Provider"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:485
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:517
|
||||
#, c-format
|
||||
msgid "You are about to withdraw %1$s from your bank account into your wallet."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:568
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Oops, something went wrong. The wallet responded with error status (%1$s)."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:579
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:611
|
||||
#, c-format
|
||||
msgid "Checking URL, please wait ..."
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:593
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:625
|
||||
#, c-format
|
||||
msgid "Can't parse amount: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:600
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:632
|
||||
#, c-format
|
||||
msgid "Can't parse wire_types: %1$s"
|
||||
msgstr ""
|
||||
|
||||
#. TODO:generic error reporting function or component.
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:620
|
||||
#: src/webex/pages/confirm-create-reserve.tsx:652
|
||||
#, c-format
|
||||
msgid "Fatal error: \"%1$s\"."
|
||||
msgstr ""
|
||||
|
13
src/types.ts
13
src/types.ts
@ -27,6 +27,7 @@
|
||||
* Imports.
|
||||
*/
|
||||
import { Checkable } from "./checkable";
|
||||
import * as LibtoolVersion from "./libtoolVersion";
|
||||
|
||||
/**
|
||||
* Non-negative financial amount. Fractional values are expressed as multiples
|
||||
@ -492,6 +493,11 @@ export interface ExchangeRecord {
|
||||
* Timestamp for last update.
|
||||
*/
|
||||
lastUpdateTime: number;
|
||||
|
||||
/**
|
||||
* Last observed protocol version.
|
||||
*/
|
||||
protocolVersion?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -558,6 +564,13 @@ export interface ReserveCreationInfo {
|
||||
* Public keys of trusted auditors for the currency we're withdrawing.
|
||||
*/
|
||||
trustedAuditorPubs: string[];
|
||||
/**
|
||||
* Result of checking the wallet's version
|
||||
* against the exchange's version.
|
||||
*
|
||||
* Older exchanges don't return version information.
|
||||
*/
|
||||
versionMatch: LibtoolVersion.VersionMatchResult|undefined;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@ import {
|
||||
HttpRequestLibrary,
|
||||
RequestException,
|
||||
} from "./http";
|
||||
import * as LibtoolVersion from "./libtoolVersion";
|
||||
import {
|
||||
AbortTransaction,
|
||||
Index,
|
||||
@ -151,6 +152,12 @@ export class KeysJson {
|
||||
@Checkable.Any
|
||||
signkeys: any;
|
||||
|
||||
/**
|
||||
* Protocol version.
|
||||
*/
|
||||
@Checkable.Optional(Checkable.String)
|
||||
version?: string;
|
||||
|
||||
/**
|
||||
* Verify that a value matches the schema of this class and convert it into a
|
||||
* member.
|
||||
@ -1500,6 +1507,19 @@ export class Wallet {
|
||||
trustedAuditorPubs.push(...currencyRecord.auditors.map((a) => a.auditorPub));
|
||||
}
|
||||
|
||||
let versionMatch;
|
||||
if (exchangeInfo.protocolVersion) {
|
||||
versionMatch = LibtoolVersion.compare(WALLET_PROTOCOL_VERSION, exchangeInfo.protocolVersion);
|
||||
|
||||
if (versionMatch && !versionMatch.compatible && versionMatch.currentCmp == -1) {
|
||||
console.log("wallet version might be outdated, checking for updates");
|
||||
chrome.runtime.requestUpdateCheck((status, details) => {
|
||||
console.log("update check status:", status);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const ret: ReserveCreationInfo = {
|
||||
earliestDepositExpiration,
|
||||
exchangeInfo,
|
||||
@ -1512,6 +1532,7 @@ export class Wallet {
|
||||
wireFees,
|
||||
wireInfo,
|
||||
withdrawFee: acc,
|
||||
versionMatch,
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
@ -1610,8 +1631,9 @@ export class Wallet {
|
||||
}
|
||||
|
||||
const updatedExchangeInfo = await this.updateExchangeInfo(exchangeInfo,
|
||||
exchangeKeysJson);
|
||||
exchangeKeysJson);
|
||||
await this.suspendCoins(updatedExchangeInfo);
|
||||
updatedExchangeInfo.protocolVersion = exchangeKeysJson.version;
|
||||
|
||||
await this.q()
|
||||
.put(Stores.exchanges, updatedExchangeInfo)
|
||||
|
@ -414,10 +414,41 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> {
|
||||
);
|
||||
}
|
||||
|
||||
renderUpdateStatus() {
|
||||
const rci = this.reserveCreationInfo();
|
||||
if (!rci) {
|
||||
return null;
|
||||
}
|
||||
if (!rci.versionMatch) {
|
||||
return null;
|
||||
}
|
||||
if (rci.versionMatch.compatible) {
|
||||
return null;
|
||||
}
|
||||
if (rci.versionMatch.currentCmp == -1) {
|
||||
return (
|
||||
<p className="errorbox">
|
||||
Your wallet might be outdated. The exchange has a higher, incompatible
|
||||
protocol version.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
if (rci.versionMatch.currentCmp == 1) {
|
||||
return (
|
||||
<p className="errorbox">
|
||||
The chosen exchange might be outdated. The exchange has a lower, incompatible
|
||||
protocol version.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
throw Error("not reached");
|
||||
}
|
||||
|
||||
renderConfirm() {
|
||||
return (
|
||||
<div>
|
||||
{this.renderFeeStatus()}
|
||||
<p>
|
||||
<button className="pure-button button-success"
|
||||
disabled={this.reserveCreationInfo() === null}
|
||||
onClick={() => this.confirmReserve()}>
|
||||
@ -428,7 +459,8 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> {
|
||||
onClick={() => this.selectingExchange(true)}>
|
||||
{i18n.str`Change Exchange Provider`}
|
||||
</button>
|
||||
<br/>
|
||||
</p>
|
||||
{this.renderUpdateStatus()}
|
||||
<Collapsible initiallyCollapsed={true} title="Fee and Spending Details">
|
||||
{renderReserveCreationDetails(this.reserveCreationInfo())}
|
||||
</Collapsible>
|
||||
|
@ -220,3 +220,22 @@ span.spacer {
|
||||
a.actionLink {
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
||||
.errorbox {
|
||||
border: 1px solid;
|
||||
display: inline-block;
|
||||
margin: 1em;
|
||||
padding: 1em;
|
||||
font-weight: bold;
|
||||
background: #FF8A8A;
|
||||
}
|
||||
|
||||
.okaybox {
|
||||
border: 1px solid;
|
||||
display: inline-block;
|
||||
margin: 1em;
|
||||
padding: 1em;
|
||||
font-weight: bold;
|
||||
background: #00FA9A;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ const DB_NAME = "taler";
|
||||
* In the future we might consider adding migration functions for
|
||||
* each version increment.
|
||||
*/
|
||||
const DB_VERSION = 17;
|
||||
const DB_VERSION = 18;
|
||||
|
||||
function handleMessage(db: IDBDatabase,
|
||||
wallet: Wallet,
|
||||
|
Loading…
Reference in New Issue
Block a user