gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: add --extra-debug option to h


From: gnunet
Subject: [taler-wallet-core] branch master updated: add --extra-debug option to history
Date: Fri, 27 Mar 2020 19:48:32 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new c9012cbd add --extra-debug option to history
c9012cbd is described below

commit c9012cbd4ce9ba1037807ec1b00a6c9c5e1b0d14
Author: Florian Dold <address@hidden>
AuthorDate: Sat Mar 28 00:18:25 2020 +0530

    add --extra-debug option to history
---
 src/headless/integrationtest.ts  |  4 ++--
 src/headless/taler-wallet-cli.ts | 10 ++++++----
 src/operations/history.ts        | 14 +++++++++++---
 src/types/history.ts             | 10 +++++++++-
 4 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/src/headless/integrationtest.ts b/src/headless/integrationtest.ts
index fbc6223f..0c015207 100644
--- a/src/headless/integrationtest.ts
+++ b/src/headless/integrationtest.ts
@@ -188,7 +188,7 @@ export async function runIntegrationTest(args: 
IntegrationTestArgs) {
 
   await myWallet.runUntilDone();
 
-  const history = await myWallet.getHistory({ verboseDetails: true });
+  const history = await myWallet.getHistory({ extraDebug: true });
 
   console.log(
     "history after integration test:",
@@ -323,7 +323,7 @@ export async function runIntegrationTestBasic(cfg: 
Configuration) {
 
   await myWallet.runUntilDone();
 
-  const history = await myWallet.getHistory({ verboseDetails: true });
+  const history = await myWallet.getHistory({ extraDebug: true });
 
   console.log(
     "history after integration test:",
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index fafa9487..45ab819a 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -135,8 +135,7 @@ const walletCli = clk
       "Inhibit running certain operations, useful for debugging and testing.",
   })
   .flag("noThrottle", ["--no-throttle"], {
-    help:
-      "Don't do any request throttling.",
+    help: "Don't do any request throttling.",
   })
   .flag("version", ["-v", "--version"], {
     onPresentHandler: printVersion,
@@ -206,9 +205,12 @@ walletCli
   .maybeOption("to", ["--to"], clk.STRING)
   .maybeOption("limit", ["--limit"], clk.STRING)
   .maybeOption("contEvt", ["--continue-with"], clk.STRING)
+  .flag("extraDebug", ["--extra-debug"])
   .action(async (args) => {
     await withWallet(args, async (wallet) => {
-      const history = await wallet.getHistory();
+      const history = await wallet.getHistory({
+        extraDebug: args.history.extraDebug,
+      });
       if (args.history.json) {
         console.log(JSON.stringify(history, undefined, 2));
       } else {
@@ -403,7 +405,7 @@ advancedCli
     });
   });
 
-  const coinPubListCodec = makeCodecForList(codecForString);
+const coinPubListCodec = makeCodecForList(codecForString);
 
 advancedCli
   .subcommand("suspendCoins", "suspend-coins", {
diff --git a/src/operations/history.ts b/src/operations/history.ts
index b19b9f19..65907de8 100644
--- a/src/operations/history.ts
+++ b/src/operations/history.ts
@@ -218,7 +218,7 @@ export async function getHistory(
           });
 
           let verboseDetails: VerboseWithdrawDetails | undefined = undefined;
-          if (historyQuery?.verboseDetails) {
+          if (historyQuery?.extraDebug) {
             verboseDetails = {
               coins: cs.map((x) => ({
                 value: Amounts.toString(x.coinValue),
@@ -260,7 +260,7 @@ export async function getHistory(
           return;
         }
         let verboseDetails: VerbosePayCoinDetails | undefined = undefined;
-        if (historyQuery?.verboseDetails) {
+        if (historyQuery?.extraDebug) {
           const coins: {
             value: string,
             contribution: string;
@@ -337,7 +337,7 @@ export async function getHistory(
           amountRefreshedEffective = Amounts.sum(amountsEffective).amount;
         }
         let verboseDetails: VerboseRefreshDetails | undefined = undefined;
-        if (historyQuery?.verboseDetails) {
+        if (historyQuery?.extraDebug) {
           const outputCoins: {
             value: string;
             denomPub: string,
@@ -488,11 +488,19 @@ export async function getHistory(
 
       tx.iter(Stores.recoupGroups).forEach(rg => {
         if (rg.timestampFinished) {
+          let verboseDetails: any = undefined;
+          if (historyQuery?.extraDebug) {
+            verboseDetails = {
+              oldAmountPerCoin: rg.oldAmountPerCoin.map(Amounts.toString),
+            };
+          }
+
           history.push({
             type: HistoryEventType.FundsRecouped,
             timestamp: rg.timestampFinished,
             eventId: makeEventId(HistoryEventType.FundsRecouped, 
rg.recoupGroupId),
             numCoinsRecouped: rg.coinPubs.length,
+            verboseDetails,
           });
         }
       });
diff --git a/src/types/history.ts b/src/types/history.ts
index b1ac0ef9..976788fc 100644
--- a/src/types/history.ts
+++ b/src/types/history.ts
@@ -18,6 +18,9 @@
  * Type and schema definitions for the wallet's history.
  */
 
+ /**
+  * Imports.
+  */
 import { RefreshReason } from "./walletTypes";
 import { ReserveTransaction } from "./ReserveTransaction";
 import { WithdrawalSource } from "./dbTypes";
@@ -647,6 +650,11 @@ export interface HistoryEventBase {
    * on the event (e.g. hiding it from the history).
    */
   eventId: string;
+
+  /**
+   * Extra details for debugging.
+   */
+  verboseDetails?: any;
 }
 
 /**
@@ -685,5 +693,5 @@ export interface HistoryQuery {
    * Output extra verbose details, intended for debugging
    * and not for end users.
    */
-  verboseDetails?: boolean;
+  extraDebug?: boolean;
 }

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]