URI: 
       tuse None as timestamp for pending transactions - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 8ec2b16e218c47d0932d80e3bf225207f9ffdc23
   DIR parent b39f1424ec434ba0977e71db4e22dbc59dd0216c
  HTML Author: thomasv <thomasv@gitorious>
       Date:   Fri, 16 Nov 2012 10:18:35 +0100
       
       use None as timestamp for pending transactions
       
       Diffstat:
         M lib/gui_qt.py                       |       5 +++--
         M lib/verifier.py                     |       7 +++----
         M lib/wallet.py                       |      12 +++++-------
       
       3 files changed, 11 insertions(+), 13 deletions(-)
       ---
   DIR diff --git a/lib/gui_qt.py b/lib/gui_qt.py
       t@@ -333,8 +333,9 @@ class ElectrumWindow(QMainWindow):
                tx = self.wallet.transactions.get(tx_hash)
        
                conf = self.wallet.verifier.get_confirmations(tx_hash)
       -        if conf:
       -            time_str = datetime.datetime.fromtimestamp( tx['timestamp']).isoformat(' ')[:-3]
       +        timestamp = tx.get('timestamp')
       +        if conf and timestamp:
       +            time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
                else:
                    time_str = 'pending'
        
   DIR diff --git a/lib/verifier.py b/lib/verifier.py
       t@@ -361,8 +361,7 @@ class WalletVerifier(threading.Thread):
            def get_timestamp(self, tx_height):
                if tx_height>0:
                    header = self.read_header(tx_height)
       -            timestamp = header.get('timestamp') if header else 0
       -        else:
       -            timestamp = 1e12
       -        return timestamp
       +            if header:
       +                return header.get('timestamp') 
       +
        
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -585,8 +585,7 @@ class Wallet:
            def get_tx_history(self):
                with self.lock:
                    lines = self.transactions.values()
       -
       -        lines = sorted(lines, key=operator.itemgetter("timestamp"))
       +        lines.sort(key = lambda x: x.get('timestamp') if x.get('timestamp') else 1e12)
                return lines
        
            def get_transactions_at_height(self, height):
       t@@ -901,7 +900,8 @@ class Wallet:
            def set_verifier(self, verifier):
                self.verifier = verifier
        
       -        # review transactions (they might not all be in history)
       +        # review stored transactions and send them to the verifier
       +        # (they are not necessarily in the history, because history items might have have been pruned)
                for tx_hash, tx in self.transactions.items():
                    tx_height = tx.get('height')
                    if tx_height <1:
       t@@ -914,11 +914,9 @@ class Wallet:
                    # set the timestamp for transactions that need it
                    if tx and not tx.get('timestamp'):
                        timestamp = self.verifier.get_timestamp(tx_height)
       -                if timestamp:
       -                    self.set_tx_timestamp(tx_hash, timestamp)
       -
       +                self.set_tx_timestamp(tx_hash, timestamp)
        
       -        # review existing history
       +        # review transactions that are in the history
                for addr, hist in self.history.items():
                    if hist == ['*']: continue
                    for tx_hash, tx_height in hist: