diff options
-rw-r--r-- | src/crypto/browserWorkerEntry.ts | 2 | ||||
-rw-r--r-- | src/crypto/cryptoApi.ts | 10 | ||||
-rw-r--r-- | src/crypto/synchronousWorker.ts | 2 | ||||
-rw-r--r-- | src/db.ts | 4 | ||||
-rw-r--r-- | src/headless/helpers.ts | 2 | ||||
-rw-r--r-- | src/headless/taler-wallet-cli.ts | 15 | ||||
-rw-r--r-- | src/wallet.ts | 16 | ||||
-rw-r--r-- | tsconfig.json | 1 | ||||
m--------- | web-common | 0 |
9 files changed, 30 insertions, 22 deletions
diff --git a/src/crypto/browserWorkerEntry.ts b/src/crypto/browserWorkerEntry.ts index 3df59fe0d..d133e93cc 100644 --- a/src/crypto/browserWorkerEntry.ts +++ b/src/crypto/browserWorkerEntry.ts @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ +*/ /** * Web worker for crypto operations. diff --git a/src/crypto/cryptoApi.ts b/src/crypto/cryptoApi.ts index a4e12c00f..46fe2576e 100644 --- a/src/crypto/cryptoApi.ts +++ b/src/crypto/cryptoApi.ts @@ -140,7 +140,7 @@ export class CryptoApi { */ private stopped: boolean = false; - public enableTracing = true; + static enableTracing = false; /** * Terminate all worker threads. @@ -148,7 +148,7 @@ export class CryptoApi { terminateWorkers() { for (let worker of this.workers) { if (worker.w) { - this.enableTracing && console.log("terminating worker"); + CryptoApi.enableTracing && console.log("terminating worker"); worker.w.terminate(); if (worker.terminationTimerHandle) { worker.terminationTimerHandle.clear(); @@ -173,7 +173,7 @@ export class CryptoApi { */ wake(ws: WorkerState, work: WorkItem): void { if (this.stopped) { - this.enableTracing && console.log("not waking, as cryptoApi is stopped"); + CryptoApi.enableTracing && console.log("not waking, as cryptoApi is stopped"); return; } if (ws.currentWorkItem !== null) { @@ -268,7 +268,7 @@ export class CryptoApi { return; } - this.enableTracing && + CryptoApi.enableTracing && console.log( `rpc ${currentWorkItem.operation} took ${timer.performanceNow() - currentWorkItem.startTime}ms`, @@ -299,7 +299,7 @@ export class CryptoApi { priority: number, ...args: any[] ): Promise<T> { - this.enableTracing && console.log("cryptoApi: doRpc called"); + CryptoApi.enableTracing && console.log("cryptoApi: doRpc called"); const p: Promise<T> = new Promise<T>((resolve, reject) => { const rpcId = this.nextRpcId++; const workItem: WorkItem = { diff --git a/src/crypto/synchronousWorker.ts b/src/crypto/synchronousWorker.ts index 4369612ad..b697c8e16 100644 --- a/src/crypto/synchronousWorker.ts +++ b/src/crypto/synchronousWorker.ts @@ -131,6 +131,6 @@ export class SynchronousCryptoWorker { * Forcibly terminate the worker thread. */ terminate() { - console.log("terminating synchronous worker (no-op)"); + // This is a no-op. } } @@ -14,15 +14,12 @@ export function openTalerDb( ): Promise<IDBDatabase> { console.log("in openTalerDb"); return new Promise<IDBDatabase>((resolve, reject) => { - console.log("calling factory.open"); const req = idbFactory.open(DB_NAME, WALLET_DB_VERSION); - console.log("after factory.open"); req.onerror = e => { console.log("taler database error", e); reject(e); }; req.onsuccess = e => { - console.log("in openTalerDb onsuccess"); req.result.onversionchange = (evt: IDBVersionChangeEvent) => { console.log( `handling live db version change from ${evt.oldVersion} to ${ @@ -35,7 +32,6 @@ export function openTalerDb( resolve(req.result); }; req.onupgradeneeded = e => { - console.log("in openTalerDb onupgradeneeded"); const db = req.result; console.log( `DB: upgrade needed: oldVersion=${e.oldVersion}, newVersion=${ diff --git a/src/headless/helpers.ts b/src/headless/helpers.ts index 0a98f7ce8..975c45e52 100644 --- a/src/headless/helpers.ts +++ b/src/headless/helpers.ts @@ -173,8 +173,6 @@ export async function getDefaultNodeWallet( shimIndexedDB(myBridgeIdbFactory); - console.log("opening taler DB"); - const myDb = await openTalerDb( myIdbFactory, myVersionChange, diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts index 6e2190236..0f40c4734 100644 --- a/src/headless/taler-wallet-cli.ts +++ b/src/headless/taler-wallet-cli.ts @@ -19,16 +19,27 @@ import os = require("os"); import { getDefaultNodeWallet, withdrawTestBalance } from "./helpers"; import { MerchantBackendConnection } from "./merchant"; import { runIntegrationTest } from "./integrationtest"; +import { Wallet } from "../wallet"; const program = new commander.Command(); -program.version("0.0.1"); +program + .version("0.0.1") + .option('--verbose', "enable verbose output", false); const walletDbPath = os.homedir + "/" + ".talerwalletdb.json"; +function applyVerbose(verbose: boolean) { + if (verbose) { + console.log("enabled verbose logging"); + Wallet.enableTracing = true; + } +} + program .command("test-withdraw") .description("withdraw test currency from the test bank") .action(async () => { + applyVerbose(program.verbose) console.log("test-withdraw command called"); const wallet = await getDefaultNodeWallet({ persistentStoragePath: walletDbPath, @@ -41,6 +52,7 @@ program .command("balance") .description("show wallet balance") .action(async () => { + applyVerbose(program.verbose) console.log("balance command called"); const wallet = await getDefaultNodeWallet({ persistentStoragePath: walletDbPath, @@ -63,6 +75,7 @@ program .option('-s, --spend-amount <spend-amt>', 'amount to spend', "TESTKUDOS:5") .description("Run integration test with bank, exchange and merchant.") .action(async (cmdObj) => { + applyVerbose(program.verbose) await runIntegrationTest({ amountToSpend: cmdObj.spendAmount, diff --git a/src/wallet.ts b/src/wallet.ts index c8dd56bbd..f7df6658f 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -328,7 +328,7 @@ export class Wallet { * IndexedDB database used by the wallet. */ db: IDBDatabase; - private enableTracing = false; + static enableTracing = false; private http: HttpRequestLibrary; private badge: Badge; private notifier: Notifier; @@ -385,7 +385,7 @@ export class Wallet { console.log("defaults already applied"); }; const onFalse = (r: QueryRoot) => { - console.log("applying defaults"); + Wallet.enableTracing && console.log("applying defaults"); r.put(Stores.config, { key: "currencyDefaultsApplied", value: true }) .putAll(Stores.currencies, builtinCurrencies) .finish(); @@ -1105,6 +1105,7 @@ export class Wallet { console.warn( `Failed to deplete reserve, trying again in ${retryDelayMs} ms`, ); + Wallet.enableTracing && console.info("Cause for retry was:", e); this.timerGroup.after(retryDelayMs, () => processReserveInternal(nextDelay), ); @@ -1144,10 +1145,9 @@ export class Wallet { this.processPreCoinConcurrent >= 4 || this.processPreCoinThrottle[preCoin.exchangeBaseUrl] ) { - this.enableTracing && console.log("delaying processPreCoin"); - this.timerGroup.after(retryDelayMs, () => - processPreCoinInternal(Math.min(retryDelayMs * 2, 5 * 60 * 1000)), - ); + const timeout = Math.min(retryDelayMs * 2, 5 * 60 * 1000); + Wallet.enableTracing && console.log(`throttling processPreCoin of ${preCoinPub} for ${timeout}ms`); + this.timerGroup.after(retryDelayMs, () => processPreCoinInternal()); return op.promise; } @@ -1498,6 +1498,8 @@ export class Wallet { reqUrl.query({ reserve_pub: reservePub }); const resp = await this.http.get(reqUrl.href()); if (resp.status !== 200) { + Wallet.enableTracing && + console.warn(`reserve/status returned ${resp.status}`); throw Error(); } const reserveInfo = ReserveStatus.checked(resp.responseJson); @@ -1575,7 +1577,6 @@ export class Wallet { if (denom.status === DenominationStatus.VerifiedGood) { return Amounts.add(denom.feeWithdraw, denom.value).amount; } - console.log(`verifying denom ${denom.denomPub.substr(0, 15)}`); const valid = await this.cryptoApi.isValidDenom( denom, exchange.masterPublicKey, @@ -1630,7 +1631,6 @@ export class Wallet { selectedDenoms = getWithdrawDenomList(amount, possibleDenoms); for (const denom of selectedDenoms || []) { if (denom.status === DenominationStatus.Unverified) { - console.log(`verifying denom ${denom.denomPub.substr(0, 15)}`); const valid = await this.cryptoApi.isValidDenom( denom, exchange.masterPublicKey, diff --git a/tsconfig.json b/tsconfig.json index 2b1fe6b05..7c28dc380 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,6 +23,7 @@ }, "files": [ "src/amounts.ts", + "src/android/index.ts", "src/checkable.ts", "src/crypto/browserWorkerEntry.ts", "src/crypto/cryptoApi-test.ts", diff --git a/web-common b/web-common deleted file mode 160000 -Subproject ebf2b43fb00f057643d69abf34b54a1b6087dfc |