SomberNight 7 years ago
parent
commit
81666bf9ac
  1. 6
      lib/synchronizer.py
  2. 5
      lib/verifier.py
  3. 3
      lib/wallet.py

6
lib/synchronizer.py

@ -84,6 +84,8 @@ class Synchronizer(ThreadJob):
return bh2u(hashlib.sha256(status.encode('ascii')).digest())
def on_address_status(self, response):
if self.wallet.synchronizer is None:
return # we have been killed, this was just an orphan callback
params, result = self.parse_response(response)
if not params:
return
@ -98,6 +100,8 @@ class Synchronizer(ThreadJob):
self.requested_addrs.remove(addr)
def on_address_history(self, response):
if self.wallet.synchronizer is None:
return # we have been killed, this was just an orphan callback
params, result = self.parse_response(response)
if not params:
return
@ -127,6 +131,8 @@ class Synchronizer(ThreadJob):
self.requested_histories.pop(addr)
def tx_response(self, response):
if self.wallet.synchronizer is None:
return # we have been killed, this was just an orphan callback
params, result = self.parse_response(response)
if not params:
return

5
lib/verifier.py

@ -65,6 +65,8 @@ class SPV(ThreadJob):
self.undo_verifications()
def verify_merkle(self, r):
if self.wallet.verifier is None:
return # we have been killed, this was just an orphan callback
if r.get('error'):
self.print_error('received an error:', r)
return
@ -95,7 +97,8 @@ class SPV(ThreadJob):
self.print_error("verified %s" % tx_hash)
self.wallet.add_verified_tx(tx_hash, (tx_height, header.get('timestamp'), pos))
def hash_merkle_root(self, merkle_s, target_hash, pos):
@classmethod
def hash_merkle_root(cls, merkle_s, target_hash, pos):
h = hash_decode(target_hash)
for i in range(len(merkle_s)):
item = merkle_s[i]

3
lib/wallet.py

@ -912,7 +912,8 @@ class Abstract_Wallet(PrintError):
# make tx local
self.unverified_tx.pop(tx_hash, None)
self.verified_tx.pop(tx_hash, None)
self.verifier.merkle_roots.pop(tx_hash, None)
if self.verifier:
self.verifier.merkle_roots.pop(tx_hash, None)
# but remove completely if not is_mine
if self.txi[tx_hash] == {}:
# FIXME the test here should be for "not all is_mine"; cannot detect conflict in some cases

Loading…
Cancel
Save