fix bug with chunk requestor
This commit is contained in:
@@ -679,11 +679,12 @@ class ElectrumWindow(QMainWindow):
|
|||||||
self.history_list.clear()
|
self.history_list.clear()
|
||||||
for item in self.wallet.get_tx_history(self.current_account):
|
for item in self.wallet.get_tx_history(self.current_account):
|
||||||
tx_hash, conf, is_mine, value, fee, balance, timestamp = item
|
tx_hash, conf, is_mine, value, fee, balance, timestamp = item
|
||||||
|
time_str = _("unknown")
|
||||||
if conf > 0:
|
if conf > 0:
|
||||||
try:
|
try:
|
||||||
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
||||||
except:
|
except:
|
||||||
time_str = _("unknown")
|
time_str = _("error")
|
||||||
|
|
||||||
if conf == -1:
|
if conf == -1:
|
||||||
time_str = 'unverified'
|
time_str = 'unverified'
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ class Blockchain(threading.Thread):
|
|||||||
socket.setdefaulttimeout(30)
|
socket.setdefaulttimeout(30)
|
||||||
print_error("downloading ", self.headers_url )
|
print_error("downloading ", self.headers_url )
|
||||||
urllib.urlretrieve(self.headers_url, filename)
|
urllib.urlretrieve(self.headers_url, filename)
|
||||||
|
print_error("done.")
|
||||||
except:
|
except:
|
||||||
print_error( "download failed. creating file", filename )
|
print_error( "download failed. creating file", filename )
|
||||||
open(filename,'wb+').close()
|
open(filename,'wb+').close()
|
||||||
@@ -381,11 +382,12 @@ class Blockchain(threading.Thread):
|
|||||||
queue = Queue.Queue()
|
queue = Queue.Queue()
|
||||||
min_index = (self.local_height + 1)/2016
|
min_index = (self.local_height + 1)/2016
|
||||||
max_index = (height + 1)/2016
|
max_index = (height + 1)/2016
|
||||||
|
|
||||||
for n in range(min_index, max_index + 1):
|
for n in range(min_index, max_index + 1):
|
||||||
print_error( "requesting chunk", n )
|
|
||||||
i.send([ ('blockchain.block.get_chunk',[n])], lambda i,r:queue.put(r))
|
i.send([ ('blockchain.block.get_chunk',[n])], lambda i,r:queue.put(r))
|
||||||
requested_chunks.append(n)
|
requested_chunks.append(n)
|
||||||
break
|
|
||||||
|
print_error( "requested chunks:", requested_chunks )
|
||||||
|
|
||||||
while requested_chunks:
|
while requested_chunks:
|
||||||
try:
|
try:
|
||||||
@@ -406,6 +408,7 @@ class Blockchain(threading.Thread):
|
|||||||
try:
|
try:
|
||||||
self.verify_chunk(index, result)
|
self.verify_chunk(index, result)
|
||||||
except:
|
except:
|
||||||
|
print_error('Verify chunk failed!!')
|
||||||
return False
|
return False
|
||||||
requested_chunks.remove(index)
|
requested_chunks.remove(index)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user