electrum

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

commit 8b865983c6d4fcc5e0c84ac661ba6c10b2bd322a
parent f91dde55dd8bf710feadcef7d0c806218efa43c3
Author: thomasv <thomasv@gitorious>
Date:   Thu, 25 Oct 2012 16:03:16 +0200

make the Verifier class usable without a wallet instance

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

diff --git a/electrum b/electrum @@ -191,7 +191,7 @@ if __name__ == '__main__': interface.start() WalletSynchronizer(wallet, config).start() - WalletVerifier(wallet, config).start() + WalletVerifier(interface, config, wallet.get_tx_hashes).start() try: found = config.wallet_file_exists diff --git a/lib/verifier.py b/lib/verifier.py @@ -26,27 +26,22 @@ from bitcoin import * class WalletVerifier(threading.Thread): - def __init__(self, wallet, config): + def __init__(self, interface, config, get_transactions): threading.Thread.__init__(self) self.daemon = True self.config = config - self.wallet = wallet - self.interface = self.wallet.interface + self.interface = interface + self.get_transactions = get_transactions self.interface.register_channel('verifier') self.verified_tx = config.get('verified_tx',[]) self.merkle_roots = config.get('merkle_roots',{}) # hashed by me self.targets = config.get('targets',{}) # compute targets self.lock = threading.Lock() - self.pending_headers = [] # headers that have not been verified - self.height = 0 self.local_height = 0 self.set_local_numblocks() - #prev_header = self.read_header(0) - #print prev_header - #sys.exit() @@ -79,13 +74,13 @@ class WalletVerifier(threading.Thread): requested_headers.append(i) # request missing tx merkle - txlist = self.wallet.get_tx_hashes() + txlist = self.get_transactions() for tx in txlist: if tx not in self.verified_tx: if tx not in requested_merkle: requested_merkle.append(tx) self.request_merkle(tx) - break + #break try: r = self.interface.get_response('verifier',timeout=1)