electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit cac030e2eed35fd5aba944b0293c62e6ec7f6e7d
parent a5168cc09f9f3303c283eb6c72ff031098566e69
Author: ecdsa <ecdsa@github>
Date:   Sat, 23 Mar 2013 18:10:09 +0100

fix transaction order in history

Diffstat:
Mlib/verifier.py | 11++++++-----
Mlib/wallet.py | 2+-
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/verifier.py b/lib/verifier.py @@ -35,7 +35,7 @@ class WalletVerifier(threading.Thread): self.transactions = {} # requested verifications (with height sent by the requestor) self.interface.register_channel('verifier') - self.verified_tx = config.get('verified_tx2',{}) # height, timestamp of verified transactions + self.verified_tx = config.get('verified_tx3',{}) # height, timestamp of verified transactions self.merkle_roots = config.get('merkle_roots',{}) # hashed by me self.targets = config.get('targets',{}) # compute targets @@ -50,7 +50,7 @@ class WalletVerifier(threading.Thread): """ return the number of confirmations of a monitored transaction. """ with self.lock: if tx in self.verified_tx: - height, timestamp = self.verified_tx[tx] + height, timestamp, pos = self.verified_tx[tx] conf = (self.local_height - height + 1) else: conf = 0 @@ -183,7 +183,8 @@ class WalletVerifier(threading.Thread): def verify_merkle(self, tx_hash, result): tx_height = result.get('block_height') - self.merkle_roots[tx_hash] = self.hash_merkle_root(result['merkle'], tx_hash, result.get('pos')) + pos = result.get('pos') + self.merkle_roots[tx_hash] = self.hash_merkle_root(result['merkle'], tx_hash, pos) header = self.read_header(tx_height) if not header: return assert header.get('merkle_root') == self.merkle_roots[tx_hash] @@ -191,9 +192,9 @@ class WalletVerifier(threading.Thread): header = self.read_header(tx_height) timestamp = header.get('timestamp') with self.lock: - self.verified_tx[tx_hash] = (tx_height, timestamp) + self.verified_tx[tx_hash] = (tx_height, timestamp, pos) print_error("verified %s"%tx_hash) - self.config.set_key('verified_tx2', self.verified_tx, True) + self.config.set_key('verified_tx3', self.verified_tx, True) self.interface.trigger_callback('updated') diff --git a/lib/wallet.py b/lib/wallet.py @@ -644,7 +644,7 @@ class Wallet: def get_tx_history(self): with self.lock: history = self.transactions.items() - history.sort(key = lambda x: self.verifier.get_height(x[0]) if self.verifier.get_height(x[0]) else 1e12) + history.sort(key = lambda x: self.verifier.verified_tx.get(x[0]) if self.verifier.verified_tx.get(x[0]) else (1e12,0,0)) result = [] balance = 0