Skip to content
Snippets Groups Projects
Commit 47896910 authored by Holger's avatar Holger
Browse files

Fix blocks with threads

parent 61ddd1e2
No related branches found
No related tags found
No related merge requests found
......@@ -378,7 +378,7 @@ class Blockchain(object):
pool = Pool(thread_num, batch_mode=True)
# disable autoclean
auto_clean = current_block.get_cache_auto_clean()
latest_block = start
latest_block = start - 1
result_block_nums = []
for blocknum in range(start, head_block + 1, thread_num):
# futures = []
......@@ -418,7 +418,7 @@ class Blockchain(object):
latest_block = int(b.identifier)
yield b
if latest_block < head_block:
if latest_block <= head_block:
for blocknum in range(latest_block, head_block + 1):
if blocknum not in result_block_nums:
block = Block(blocknum, only_ops=only_ops, only_virtual_ops=only_virtual_ops, steem_instance=self.steem)
......
......@@ -35,7 +35,7 @@ class Testcases(unittest.TestCase):
b = Blockchain(steem_instance=cls.bts)
num = b.get_current_block_num()
# num = 23346630
cls.start = num - 50
cls.start = num - 25
cls.stop = num
# cls.N_transfer = 121
# cls.N_vote = 2825
......@@ -47,7 +47,7 @@ class Testcases(unittest.TestCase):
ops_stream_no_threading = []
opNames = ["transfer", "vote"]
block_num_list = []
for op in b.stream(opNames=opNames, start=self.start, stop=self.stop, threading=True, thread_num=8):
for op in b.stream(opNames=opNames, start=self.start, stop=self.stop, threading=True, thread_num=2):
ops_stream.append(op)
if op["block_num"] not in block_num_list:
block_num_list.append(op["block_num"])
......@@ -69,7 +69,7 @@ class Testcases(unittest.TestCase):
blocks = []
last_id = self.start - 1
for block in b.blocks(start=self.start, stop=self.stop, threading=True, thread_num=8):
for block in b.blocks(start=self.start, stop=self.stop, threading=True, thread_num=2):
blocks.append(block)
self.assertEqual(block.identifier, last_id + 1)
last_id += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment