trename spv class, use own print_error - electrum - Electrum Bitcoin wallet
 (HTM) git clone https://git.parazyd.org/electrum
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
       ---
 (DIR) commit 5b8588ee90ad4dd53c3c593c64dbf000a82c69db
 (DIR) parent 5918bac5cb7e935d3140116c82ebefaa8bc35423
 (HTM) Author: ThomasV <thomasv@gitorious>
       Date:   Sat, 14 Mar 2015 09:20:27 +0100
       
       rename spv class, use own print_error
       
       Diffstat:
         M lib/__init__.py                     |       1 -
         M lib/verifier.py                     |      12 ++++++------
         M lib/wallet.py                       |       4 ++--
       
       3 files changed, 8 insertions(+), 9 deletions(-)
       ---
 (DIR) diff --git a/lib/__init__.py b/lib/__init__.py
       t@@ -2,7 +2,6 @@ from version import ELECTRUM_VERSION
        from util import format_satoshis, print_msg, print_json, print_error, set_verbosity
        from wallet import WalletSynchronizer, WalletStorage
        from wallet import Wallet, Wallet_2of2, Wallet_2of3, Imported_Wallet
       -from verifier import TxVerifier
        from network import Network, DEFAULT_SERVERS, DEFAULT_PORTS, pick_random_server
        from interface import Interface
        from simple_config import SimpleConfig, get_config, set_config
 (DIR) diff --git a/lib/verifier.py b/lib/verifier.py
       t@@ -26,7 +26,7 @@ from bitcoin import *
        
        
        
       -class TxVerifier(util.DaemonThread):
       +class SPV(util.DaemonThread):
            """ Simple Payment Verification """
        
            def __init__(self, network, storage):
       t@@ -95,7 +95,7 @@ class TxVerifier(util.DaemonThread):
                                continue
                            if self.merkle_roots.get(tx_hash) is None and tx_hash not in requested_merkle:
                                if self.network.send([ ('blockchain.transaction.get_merkle',[tx_hash, tx_height]) ], self.queue.put):
       -                            print_error('requesting merkle', tx_hash)
       +                            self.print_error('requesting merkle', tx_hash)
                                    requested_merkle.append(tx_hash)
                    try:
                        r = self.queue.get(timeout=0.1)
       t@@ -105,7 +105,7 @@ class TxVerifier(util.DaemonThread):
                        continue
        
                    if r.get('error'):
       -                print_error('Verifier received an error:', r)
       +                self.print_error('Verifier received an error:', r)
                        continue
        
                    # 3. handle response
       t@@ -127,7 +127,7 @@ class TxVerifier(util.DaemonThread):
                header = self.network.get_header(tx_height)
                if not header: return
                if header.get('merkle_root') != merkle_root:
       -            print_error("merkle verification failed for", tx_hash)
       +            self.print_error("merkle verification failed for", tx_hash)
                    return
        
                # we passed all the tests
       t@@ -135,7 +135,7 @@ class TxVerifier(util.DaemonThread):
                timestamp = header.get('timestamp')
                with self.lock:
                    self.verified_tx[tx_hash] = (tx_height, timestamp, pos)
       -        print_error("verified %s"%tx_hash)
       +        self.print_error("verified %s"%tx_hash)
                self.storage.put('verified_tx3', self.verified_tx, True)
                self.network.trigger_callback('updated')
        
       t@@ -155,7 +155,7 @@ class TxVerifier(util.DaemonThread):
                for tx_hash, item in items:
                    tx_height, timestamp, pos = item
                    if tx_height >= height:
       -                print_error("redoing", tx_hash)
       +                self.print_error("redoing", tx_hash)
                        with self.lock:
                            self.verified_tx.pop(tx_hash)
                            if tx_hash in self.merkle_roots:
 (DIR) diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -948,10 +948,10 @@ class Abstract_Wallet(object):
                return True
        
            def start_threads(self, network):
       -        from verifier import TxVerifier
       +        from verifier import SPV
                self.network = network
                if self.network is not None:
       -            self.verifier = TxVerifier(self.network, self.storage)
       +            self.verifier = SPV(self.network, self.storage)
                    self.verifier.start()
                    self.set_verifier(self.verifier)
                    self.synchronizer = WalletSynchronizer(self, network)