This commit is contained in:
Lex Berezhny 2020-07-27 11:52:24 -04:00
parent dbc0da2817
commit a1f3254261

View file

@ -812,7 +812,8 @@ class EventGenerator:
} }
} }
def blocks_main_finish(self): @staticmethod
def blocks_main_finish():
yield { yield {
"event": "blockchain.sync.blocks.main", "event": "blockchain.sync.blocks.main",
"data": {"id": 0, "done": (-1, -1)} "data": {"id": 0, "done": (-1, -1)}
@ -822,7 +823,8 @@ class EventGenerator:
for file in files: for file in files:
yield from self.blocks_file(*file) yield from self.blocks_file(*file)
def blocks_file(self, file, blocks, txs, steps): @staticmethod
def blocks_file(file, blocks, txs, steps):
for i, step in enumerate(steps): for i, step in enumerate(steps):
if i == 0: if i == 0:
yield { yield {
@ -864,7 +866,8 @@ class EventGenerator:
"units": ("claims",)} "units": ("claims",)}
} }
def claims_main_finish(self): @staticmethod
def claims_main_finish():
yield { yield {
"event": "blockchain.sync.claims.main", "event": "blockchain.sync.claims.main",
"data": {"id": 0, "done": (-1,)} "data": {"id": 0, "done": (-1,)}
@ -907,7 +910,8 @@ class EventGenerator:
} }
} }
def supports_main_finish(self): @staticmethod
def supports_main_finish():
yield { yield {
"event": "blockchain.sync.supports.main", "event": "blockchain.sync.supports.main",
"data": {"id": 0, "done": (-1,)} "data": {"id": 0, "done": (-1,)}
@ -917,7 +921,7 @@ class EventGenerator:
for start, end, total, count in heights: for start, end, total, count in heights:
yield from self.generate( yield from self.generate(
"blockchain.sync.supports.insert", ("supports",), start, "blockchain.sync.supports.insert", ("supports",), start,
f"add supprt {start}" if start==end else f"add supprt {start}- {end}", f"add supprt {start}" if start == end else f"add supprt {start}- {end}",
(total,), (count,) (total,), (count,)
) )
@ -926,7 +930,8 @@ class EventGenerator:
"blockchain.sync.supports.vacuum", ("steps",), 0, None, (1,), (1,) "blockchain.sync.supports.vacuum", ("steps",), 0, None, (1,), (1,)
) )
def generate(self, name, units, eid, label, total, steps): @staticmethod
def generate(name, units, eid, label, total, steps):
done = (0,)*len(total) done = (0,)*len(total)
while not all(d >= t for d, t in zip(done, total)): while not all(d >= t for d, t in zip(done, total)):
if done[0] == 0: if done[0] == 0: