gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-wallet-webex] branch master updated (ace1a1b -> 8d8f


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-webex] branch master updated (ace1a1b -> 8d8f48f)
Date: Thu, 13 Apr 2017 16:14:50 +0200

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

dold pushed a change to branch master
in repository wallet-webex.

    from ace1a1b  download/import db from dump page
     new 75cf7ac  simplify coin status, don't show refreshed coins in balance
     new 8d8f48f  payback field

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/cryptoLib.ts   |  5 ++---
 src/pages/tree.tsx |  5 ++---
 src/types.ts       | 18 ++++++++----------
 src/wallet.ts      | 31 ++++++++++++++++++++-----------
 src/wxBackend.ts   |  2 +-
 5 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/src/cryptoLib.ts b/src/cryptoLib.ts
index 7a363e6..717a681 100644
--- a/src/cryptoLib.ts
+++ b/src/cryptoLib.ts
@@ -24,7 +24,7 @@
 import * as native from "./emscriptif";
 import {
   PreCoinRecord, PayCoinInfo, AmountJson,
-  RefreshSessionRecord, RefreshPreCoinRecord, ReserveRecord
+  RefreshSessionRecord, RefreshPreCoinRecord, ReserveRecord, CoinStatus,
 } from "./types";
 import create = chrome.alarms.create;
 import {OfferRecord} from "./wallet";
@@ -210,8 +210,7 @@ namespace RpcFunctions {
       let newAmount = new native.Amount(cd.coin.currentAmount);
       newAmount.sub(coinSpend);
       cd.coin.currentAmount = newAmount.toJson();
-      cd.coin.dirty = true;
-      cd.coin.transactionPending = true;
+      cd.coin.status = CoinStatus.TransactionPending;
 
       let d = new native.DepositRequestPS({
         h_contract: native.HashCode.fromCrock(offer.H_contract),
diff --git a/src/pages/tree.tsx b/src/pages/tree.tsx
index dab6371..4909c18 100644
--- a/src/pages/tree.tsx
+++ b/src/pages/tree.tsx
@@ -21,7 +21,7 @@
  */
 
 
-import {ExchangeRecord, DenominationRecord} from "src/types";
+import {ExchangeRecord, DenominationRecord, CoinStatus} from "src/types";
 import { ReserveRecord, CoinRecord, PreCoinRecord, Denomination } from 
"src/types";
 import { ImplicitStateComponent, StateHolder } from "src/components";
 import {
@@ -124,8 +124,7 @@ class CoinView extends React.Component<CoinViewProps, void> 
{
           <li>Current amount: {prettyAmount(c.currentAmount)}</li>
           <li>Denomination: <ExpanderText text={c.denomPub} /></li>
           <li>Suspended: {(c.suspended || false).toString()}</li>
-          <li>Dirty: {(c.dirty || false).toString()}</li>
-          <li>Transaction Pending: {(c.transactionPending || 
false).toString()}</li>
+          <li>Status: {CoinStatus[c.status]}</li>
           <li><RefreshDialog coin={c} /></li>
         </ul>
       </div>
diff --git a/src/types.ts b/src/types.ts
index 5b2fa28..87b77b8 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -347,6 +347,12 @@ export interface CoinPaySig {
   f: AmountJson;
 }
 
+
+export enum CoinStatus {
+  Fresh, TransactionPending, Dirty, Refreshed,
+}
+
+
 /**
  * CoinRecord as stored in the "coins" data store
  * of the wallet database.
@@ -391,17 +397,9 @@ export interface CoinRecord {
   suspended?: boolean;
 
   /**
-   * Was the coin revealed in a transaction?
-   */
-  dirty: boolean;
-
-  /**
-   * Is the coin currently involved in a transaction?
-   *
-   * This delays refreshing until the transaction is finished or
-   * aborted.
+   * Status of the coin.
    */
-  transactionPending: boolean;
+  status: CoinStatus;
 }
 
 
diff --git a/src/wallet.ts b/src/wallet.ts
index 916d8e1..5b76a01 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -42,6 +42,7 @@ import {
   WalletBalance,
   WalletBalanceEntry,
   WireInfo, DenominationRecord, DenominationStatus, denominationRecordFromKeys,
+  CoinStatus,
 } from "./types";
 import {
   HttpRequestLibrary,
@@ -73,6 +74,12 @@ export interface CoinWithDenom {
   denom: DenominationRecord;
 }
 
address@hidden
+export class Payback {
+  @Checkable.String
+  h_denom_pub: string;
+}
+
 
 @Checkable.Class
 export class KeysJson {
@@ -88,6 +95,9 @@ export class KeysJson {
   @Checkable.String
   list_issue_date: string;
 
+  @Checkable.List(Checkable.Value(Payback))
+  payback?: Payback[];
+
   @Checkable.Any
   signkeys: any;
 
@@ -266,7 +276,7 @@ export function selectCoins(cds: CoinWithDenom[], 
paymentAmount: AmountJson,
     if (coin.suspended) {
       continue;
     }
-    if (coin.dirty) {
+    if (coin.status != CoinStatus.Fresh) {
       continue;
     }
     if (Amounts.cmp(denom.feeDeposit, coin.currentAmount) >= 0) {
@@ -526,7 +536,7 @@ export class Wallet {
     this.q()
         .iter(Stores.coins)
         .reduce((c: CoinRecord) => {
-          if (c.dirty && !c.transactionPending && !(c.currentAmount.value == 0 
&& c.currentAmount.fraction == 0)) {
+          if (c.status == CoinStatus.Dirty) {
             console.log("resuming pending refresh for coin", c);
             this.refresh(c.coinPub);
           }
@@ -581,10 +591,7 @@ export class Wallet {
         if (coin.suspended) {
           continue;
         }
-        if (coin.dirty) {
-          continue;
-        }
-        if (coin.transactionPending) {
+        if (coin.status != CoinStatus.Fresh) {
           continue;
         }
         cds.push({coin, denom});
@@ -989,8 +996,7 @@ export class Wallet {
       denomSig: denomSig,
       currentAmount: pc.coinValue,
       exchangeBaseUrl: pc.exchangeBaseUrl,
-      dirty: false,
-      transactionPending: false,
+      status: CoinStatus.Fresh,
     };
     return coin;
   }
@@ -1348,6 +1354,9 @@ export class Wallet {
       if (c.suspended) {
         return balance;
       }
+      if (!(c.status == CoinStatus.Dirty || c.status == CoinStatus.Fresh)) {
+        return balance;
+      }
       let currency = c.currentAmount.currency;
       let entry = ensureEntry(balance, currency);
       entry.available = Amounts.add(entry.available, c.currentAmount).amount;
@@ -1496,6 +1505,7 @@ export class Wallet {
         throw AbortTransaction;
       }
       c.currentAmount = r.amount;
+      c.status = CoinStatus.Refreshed;
       return c;
     }
 
@@ -1667,8 +1677,7 @@ export class Wallet {
         denomSig: denomSig,
         currentAmount: denom.value,
         exchangeBaseUrl: refreshSession.exchangeBaseUrl,
-        dirty: false,
-        transactionPending: false,
+        status: CoinStatus.Fresh,
       };
 
       coins.push(coin);
@@ -1787,7 +1796,7 @@ export class Wallet {
           console.error("coin not found");
           return;
         }
-        c.transactionPending = false;
+        c.status = CoinStatus.Dirty;
         modifiedCoins.push(c);
       }
 
diff --git a/src/wxBackend.ts b/src/wxBackend.ts
index 7b1a2b3..f31472c 100644
--- a/src/wxBackend.ts
+++ b/src/wxBackend.ts
@@ -35,7 +35,7 @@ import * as logging from "./logging";
 "use strict";
 
 const DB_NAME = "taler";
-const DB_VERSION = 15;
+const DB_VERSION = 16;
 
 import {Stores} from "./wallet";
 import {Store, Index} from "./query";

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



reply via email to

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