1
0

start wallet threads from wallet class

This commit is contained in:
ThomasV
2013-09-01 18:44:19 +02:00
parent d47892b690
commit 046ec58d24
4 changed files with 33 additions and 48 deletions

View File

@@ -42,8 +42,8 @@ except:
from electrum.wallet import format_satoshis
from electrum.bitcoin import Transaction, is_valid
from electrum import mnemonic
from electrum import util, bitcoin, commands, Interface, Wallet, TxVerifier, WalletSynchronizer
from electrum import SimpleConfig, Wallet, WalletSynchronizer, WalletStorage
from electrum import util, bitcoin, commands, Interface, Wallet
from electrum import SimpleConfig, Wallet, WalletStorage
import bmp, pyqrnative
@@ -351,20 +351,11 @@ class ElectrumWindow(QMainWindow):
interface = self.wallet.interface
blockchain = self.wallet.verifier.blockchain
self.wallet.verifier.stop()
self.wallet.synchronizer.stop()
self.wallet.stop_threads()
# create wallet
# create new wallet
wallet = Wallet(storage)
wallet.interface = interface
verifier = TxVerifier(interface, blockchain, storage)
verifier.start()
wallet.set_verifier(verifier)
synchronizer = WalletSynchronizer(wallet)
synchronizer.start()
wallet.start_threads(interface, blockchain)
self.load_wallet(wallet)
@@ -2237,14 +2228,7 @@ class ElectrumGui:
else:
wallet = Wallet(storage)
wallet.interface = self.interface
verifier = TxVerifier(self.interface, self.blockchain, storage)
verifier.start()
wallet.set_verifier(verifier)
synchronizer = WalletSynchronizer(wallet)
synchronizer.start()
wallet.start_threads(self.interface, self.blockchain)
s = Timer()
s.start()
@@ -2260,7 +2244,6 @@ class ElectrumGui:
self.app.exec_()
verifier.stop()
synchronizer.stop()
wallet.stop_threads()

View File

@@ -5,14 +5,14 @@ _ = lambda x:x
from electrum.util import format_satoshis, set_verbosity
from electrum.bitcoin import is_valid
from electrum import Wallet, WalletVerifier, WalletSynchronizer, WalletStorage
from electrum import Wallet, WalletStorage
import tty, sys
class ElectrumGui:
def __init__(self, config, interface):
def __init__(self, config, interface, blockchain):
self.config = config
storage = WalletStorage(config)
@@ -20,15 +20,8 @@ class ElectrumGui:
print "Wallet not found. try 'electrum create'"
exit()
wallet = Wallet(storage)
wallet.interface = interface
self.wallet = wallet
verifier = WalletVerifier(interface, config)
verifier.start()
wallet.set_verifier(verifier)
synchronizer = WalletSynchronizer(wallet)
synchronizer.start()
self.wallet = Wallet(storage)
self.wallet.start_threads(interface, blockchain)
self.stdscr = curses.initscr()
curses.noecho()