diff --git a/hathor/consensus/consensus.py b/hathor/consensus/consensus.py index 185288751..43d5c4c55 100644 --- a/hathor/consensus/consensus.py +++ b/hathor/consensus/consensus.py @@ -21,6 +21,7 @@ from hathor.profiler import get_cpu_profiler from hathor.pubsub import HathorEvents, PubSubManager from hathor.transaction import BaseTransaction +from hathor.util import not_none logger = get_logger() settings = HathorSettings() @@ -135,7 +136,8 @@ def _unsafe_update(self, base: BaseTransaction) -> None: reorg_size=reorg_size) # finally signal an index update for all affected transactions - for tx_affected in context.txs_affected: + sorted_txs_affected = sorted(context.txs_affected, key=lambda tx: not_none(tx.hash)) + for tx_affected in sorted_txs_affected: assert tx_affected.storage is not None assert tx_affected.storage.indexes is not None tx_affected.storage.indexes.update(tx_affected) diff --git a/tests/event/test_event_reorg.py b/tests/event/test_event_reorg.py index d106f47e1..c7c4b5560 100644 --- a/tests/event/test_event_reorg.py +++ b/tests/event/test_event_reorg.py @@ -1,9 +1,10 @@ +from typing import Any from hathor.conf import HathorSettings from hathor.event.model.event_type import EventType from hathor.event.storage import EventMemoryStorage from tests import unittest -from tests.utils import add_new_blocks, get_genesis_key, zip_chunkify +from tests.utils import add_new_blocks, get_genesis_key settings = HathorSettings() @@ -47,76 +48,58 @@ def test_reorg_events(self): # check events actual_events = list(self.event_storage.iter_from_event(0)) - # events are separated into portions that are sorted (indicated by using lists) and portions that are unsorted - # (indicated by using a custom class), the unsorted parts mean that the given events must be present, but not - # necessarily in the given order, to check that we sort both the expected and actual events by tx hash to be - # able to match them, but only for the "unsorted" portions will, for the "sorted" portions the order is - # expected to be the given one - class unsorted(list): - pass - expected_events_grouped = [ - [ - (EventType.LOAD_STARTED, {}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': settings.GENESIS_BLOCK_HASH.hex()}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': settings.GENESIS_TX1_HASH.hex()}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': settings.GENESIS_TX2_HASH.hex()}), - (EventType.LOAD_FINISHED, {}) - ], - # XXX: the order of the following events can vary depending on which genesis is spent/confirmed first - unsorted([ + expected_events = [ + (EventType.LOAD_STARTED, {}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': settings.GENESIS_BLOCK_HASH.hex()}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': settings.GENESIS_TX1_HASH.hex()}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': settings.GENESIS_TX2_HASH.hex()}), + (EventType.LOAD_FINISHED, {}), + *sorted_by_hash( + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[0].hash_hex}), (EventType.VERTEX_METADATA_CHANGED, {'hash': settings.GENESIS_TX1_HASH.hex()}), (EventType.VERTEX_METADATA_CHANGED, {'hash': settings.GENESIS_TX2_HASH.hex()}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[0].hash_hex}), - ]), - # XXX: these events must always have this order - [ - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[0].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[1].hash_hex}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[1].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[2].hash_hex}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[2].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[3].hash_hex}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[3].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[4].hash_hex}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[4].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[5].hash_hex}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[5].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[6].hash_hex}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[6].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[7].hash_hex}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[7].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[8].hash_hex}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[8].hash_hex}), + ), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[0].hash_hex}), + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[1].hash_hex}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[1].hash_hex}), + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[2].hash_hex}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[2].hash_hex}), + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[3].hash_hex}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[3].hash_hex}), + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[4].hash_hex}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[4].hash_hex}), + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[5].hash_hex}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[5].hash_hex}), + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[6].hash_hex}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[6].hash_hex}), + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[7].hash_hex}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[7].hash_hex}), + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[8].hash_hex}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[8].hash_hex}), + (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[9].hash_hex}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[9].hash_hex}), + (EventType.REORG_STARTED, {'reorg_size': 2, 'previous_best_block': blocks[9].hash_hex, + 'new_best_block': b0.hash_hex}), + *sorted_by_hash( + (EventType.VERTEX_METADATA_CHANGED, {'hash': b0.hash_hex}), (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[9].hash_hex}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': blocks[9].hash_hex}), - (EventType.REORG_STARTED, {'reorg_size': 2, 'previous_best_block': blocks[9].hash_hex, - 'new_best_block': b0.hash_hex}), - ], - # XXX: for some reason the metadata update order of these events isn't always the same - unsorted([ (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[8].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': blocks[9].hash_hex}), - (EventType.VERTEX_METADATA_CHANGED, {'hash': b0.hash_hex}), - ]), - # XXX: these events must always have this order - [ - (EventType.REORG_FINISHED, {}), - (EventType.NEW_VERTEX_ACCEPTED, {'hash': b0.hash_hex}), - ], + ), + (EventType.REORG_FINISHED, {}), + (EventType.NEW_VERTEX_ACCEPTED, {'hash': b0.hash_hex}), ] - for actual_events, expected_events in zip_chunkify(actual_events, expected_events_grouped): - if isinstance(expected_events, unsorted): - actual_events.sort(key=lambda i: i.data.hash) - expected_events.sort(key=lambda i: i[1].get('hash', '')) + for actual_event, expected_event in zip(actual_events, expected_events): + expected_event_type, expected_partial_data = expected_event + + self.assertEqual(EventType(actual_event.type), expected_event_type) - for actual_event, expected_event in zip(actual_events, expected_events): - expected_event_type, expected_partial_data = expected_event + for expected_data_key, expected_data_value in expected_partial_data.items(): + self.assertEqual(actual_event.data.dict()[expected_data_key], expected_data_value) - self.assertEqual(EventType(actual_event.type), expected_event_type) - for expected_data_key, expected_data_value in expected_partial_data.items(): - self.assertEqual(actual_event.data.dict()[expected_data_key], expected_data_value) +def sorted_by_hash(*events: tuple[EventType, dict[str, Any]]) -> list[tuple[EventType, dict[str, Any]]]: + return sorted(events, key=lambda event: event[1]['hash']) class SyncV1EventReorgTest(unittest.SyncV1Params, BaseEventReorgTest): diff --git a/tests/event/test_event_simulation_scenarios.py b/tests/event/test_event_simulation_scenarios.py index fea2548ec..d673042b6 100644 --- a/tests/event/test_event_simulation_scenarios.py +++ b/tests/event/test_event_simulation_scenarios.py @@ -25,7 +25,6 @@ MemoryEventSimulationTester, RocksDBEventSimulationTester, ) -from tests.utils import zip_chunkify class BaseEventSimulationScenariosTest(BaseEventSimulationTester): @@ -54,7 +53,7 @@ def test_only_load(self) -> None: EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=4, timestamp=1578878880.0, type=EventType.LOAD_FINISHED, data=EmptyData(), group_id=None), latest_event_id=4) # noqa: E501 ] - assert responses == expected + assert responses == expected, f'expected: {expected}\n\nactual: {responses}' def test_single_chain_one_block(self): miner = self.simulator.create_miner(self.manager, hashpower=1e6) @@ -71,29 +70,23 @@ def test_single_chain_one_block(self): responses = self._get_success_responses() expected = [ - [ - # LOAD_STATED - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=0, timestamp=1578878880.0, type=EventType.LOAD_STARTED, data=EmptyData(), group_id=None), latest_event_id=8), # noqa E501 - # One NEW_VERTEX_ACCEPTED for each genesis (1 block and 2 txs) - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=1, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', nonce=0, timestamp=1572636343, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=100000000000, script='dqkU/QUFm2AGJJVDuC82h2oXxz/SJnuIrA==', token_data=0)], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa: E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=2, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa: E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=3, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa: E501 - # LOAD_FINISHED - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=4, timestamp=1578878880.0, type=EventType.LOAD_FINISHED, data=EmptyData(), group_id=None), latest_event_id=8), # noqa E501 - ], - UnorderedList([ - # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=7, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360'], twins=[], accumulated_weight=2.0, score=2.0, first_block='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=5, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360'], twins=[], accumulated_weight=2.0, score=2.0, first_block='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=6, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa E501 - ]), - [ - # One NEW_VERTEX_ACCEPTED for a new block - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=8, timestamp=1578878910.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=8) # noqa E501 - ] + # LOAD_STATED + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=0, timestamp=1578878880.0, type=EventType.LOAD_STARTED, data=EmptyData(), group_id=None), latest_event_id=8), # noqa E501 + # One NEW_VERTEX_ACCEPTED for each genesis (1 block and 2 txs) + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=1, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', nonce=0, timestamp=1572636343, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=100000000000, script='dqkU/QUFm2AGJJVDuC82h2oXxz/SJnuIrA==', token_data=0)], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa: E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=2, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa: E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=3, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa: E501 + # LOAD_FINISHED + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=4, timestamp=1578878880.0, type=EventType.LOAD_FINISHED, data=EmptyData(), group_id=None), latest_event_id=8), # noqa E501 + # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=5, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360'], twins=[], accumulated_weight=2.0, score=2.0, first_block='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=6, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360'], twins=[], accumulated_weight=2.0, score=2.0, first_block='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=7, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=8), # noqa E501 + # One NEW_VERTEX_ACCEPTED for a new block + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=8, timestamp=1578878910.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=8) # noqa E501 ] - _assert_equal_events(responses, expected) + assert responses == expected, f'expected: {expected}\n\nactual: {responses}' def test_single_chain_blocks_and_transactions(self): miner = self.simulator.create_miner(self.manager, hashpower=1e6) @@ -122,73 +115,57 @@ def test_single_chain_blocks_and_transactions(self): responses = self._get_success_responses() expected = [ - [ - # LOAD_STATED - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=0, timestamp=1578878880.0, type=EventType.LOAD_STARTED, data=EmptyData(), group_id=None), latest_event_id=36), # noqa E501 - # One NEW_VERTEX_ACCEPTED for each genesis (1 block and 2 txs) - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=1, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', nonce=0, timestamp=1572636343, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=100000000000, script='dqkU/QUFm2AGJJVDuC82h2oXxz/SJnuIrA==', token_data=0)], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa: E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=2, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa: E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=3, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa: E501 - # LOAD_FINISHED - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=4, timestamp=1578878880.0, type=EventType.LOAD_FINISHED, data=EmptyData(), group_id=None), latest_event_id=36), # noqa E501 - ], - UnorderedList([ - # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=5, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360'], twins=[], accumulated_weight=2.0, score=2.0, first_block='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=6, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360'], twins=[], accumulated_weight=2.0, score=2.0, first_block='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=7, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - ]), - [ - # One NEW_VERTEX_ACCEPTED for a new block - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=8, timestamp=1578878910.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - # One VERTEX_METADATA_CHANGED and one NEW_VERTEX_ACCEPTED for 10 new blocks - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=9, timestamp=1578878910.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', nonce=1279407725, timestamp=1578878911, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUXRFxfhIYOXURHjiAlx9XPuMh7E2IrA==', token_data=0)], parents=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.321928094887363, first_block=None, height=2, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=10, timestamp=1578878910.5, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', nonce=1279407725, timestamp=1578878911, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUXRFxfhIYOXURHjiAlx9XPuMh7E2IrA==', token_data=0)], parents=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.321928094887363, first_block=None, height=2, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=11, timestamp=1578878910.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', nonce=1529920189, timestamp=1578878912, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUu9S/kjy3HbglEu3bA4JargdORiiIrA==', token_data=0)], parents=['967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.584962500721156, first_block=None, height=3, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=12, timestamp=1578878910.75, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', nonce=1529920189, timestamp=1578878912, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUu9S/kjy3HbglEu3bA4JargdORiiIrA==', token_data=0)], parents=['967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.584962500721156, first_block=None, height=3, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=13, timestamp=1578878911.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', nonce=1828786391, timestamp=1578878913, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUzskI6jayLvTobJDhpVZiuMu7zt+IrA==', token_data=0)], parents=['68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.807354922057604, first_block=None, height=4, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=14, timestamp=1578878911.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', nonce=1828786391, timestamp=1578878913, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUzskI6jayLvTobJDhpVZiuMu7zt+IrA==', token_data=0)], parents=['68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.807354922057604, first_block=None, height=4, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=15, timestamp=1578878911.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', nonce=1915673046, timestamp=1578878914, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkU7B7Cf/pnj2DglfhnqyiRzxNg+K2IrA==', token_data=0)], parents=['0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.0, first_block=None, height=5, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=16, timestamp=1578878911.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', nonce=1915673046, timestamp=1578878914, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkU7B7Cf/pnj2DglfhnqyiRzxNg+K2IrA==', token_data=0)], parents=['0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.0, first_block=None, height=5, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=17, timestamp=1578878911.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', nonce=1279525218, timestamp=1578878915, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUZmTJ0of2Ce9iuycIVpFCVU08WmKIrA==', token_data=0)], parents=['79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.169925001442312, first_block=None, height=6, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=18, timestamp=1578878911.5, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', nonce=1279525218, timestamp=1578878915, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUZmTJ0of2Ce9iuycIVpFCVU08WmKIrA==', token_data=0)], parents=['79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.169925001442312, first_block=None, height=6, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=19, timestamp=1578878911.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', nonce=4136633663, timestamp=1578878916, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPNN8M/qangqd2wYSzu0u+3OmwDmIrA==', token_data=0)], parents=['0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.321928094887363, first_block=None, height=7, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=20, timestamp=1578878911.75, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', nonce=4136633663, timestamp=1578878916, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPNN8M/qangqd2wYSzu0u+3OmwDmIrA==', token_data=0)], parents=['0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.321928094887363, first_block=None, height=7, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=21, timestamp=1578878912.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', nonce=945260546, timestamp=1578878917, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUxbNqvpWbgNtk9km/VuYhzHHMp76IrA==', token_data=0)], parents=['3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.459431618637297, first_block=None, height=8, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=22, timestamp=1578878912.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', nonce=945260546, timestamp=1578878917, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUxbNqvpWbgNtk9km/VuYhzHHMp76IrA==', token_data=0)], parents=['3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.459431618637297, first_block=None, height=8, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=23, timestamp=1578878912.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', nonce=2222918728, timestamp=1578878918, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkU48C0XcFpiaWq2gwTICyEVdvJXcCIrA==', token_data=0)], parents=['282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.584962500721156, first_block=None, height=9, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=24, timestamp=1578878912.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', nonce=2222918728, timestamp=1578878918, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkU48C0XcFpiaWq2gwTICyEVdvJXcCIrA==', token_data=0)], parents=['282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.584962500721156, first_block=None, height=9, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=25, timestamp=1578878912.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', nonce=3090209358, timestamp=1578878919, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUmQRjqRyxq26raJZnhnpRJsrS9n2IrA==', token_data=0)], parents=['4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.700439718141092, first_block=None, height=10, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=26, timestamp=1578878912.5, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', nonce=3090209358, timestamp=1578878919, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUmQRjqRyxq26raJZnhnpRJsrS9n2IrA==', token_data=0)], parents=['4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.700439718141092, first_block=None, height=10, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=27, timestamp=1578878912.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', nonce=3024981275, timestamp=1578878920, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUYFHjcujZZHs0JWZkriEbn5jTv/aIrA==', token_data=0)], parents=['47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.807354922057604, first_block=None, height=11, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=28, timestamp=1578878912.75, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', nonce=3024981275, timestamp=1578878920, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUYFHjcujZZHs0JWZkriEbn5jTv/aIrA==', token_data=0)], parents=['47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.807354922057604, first_block=None, height=11, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - ], - UnorderedList([ - # One VERTEX_METADATA_CHANGED for a new tx (below), and one VERTEX_METADATA_CHANGED for a block, adding the new tx as spending their output # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=30, timestamp=1578879395.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[SpentOutput(index=0, tx_ids=['bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c'])], conflict_with=[], voided_by=[], received_by=[], children=['967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6'], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=29, timestamp=1578879395.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', nonce=0, timestamp=1578879395, version=1, weight=18.648830153779993, inputs=[TxInput(tx_id='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', index=0, data='RjBEAiBQAVgs/jYpndowN3/JMI07fM886ergyyGA2xXaHCu5BQIgf58pdc8S9ABgzkUx8qDQUtV3FcYCMMzHs90q36L0J+whA0zN7LEgxcswPkHbbW7mdnkS5yviaZFgjID1mhpSZSQf')], outputs=[TxOutput(value=2132, script='dqkUutgaVG8W5OnzgAEVUqB4XgmDgm2IrA==', token_data=0), TxOutput(value=4268, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=18.648830153779993, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - ]), - [ - # One NEW_VERTEX_ACCEPTED for a new tx - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=31, timestamp=1578879395.5, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', nonce=0, timestamp=1578879395, version=1, weight=18.648830153779993, inputs=[TxInput(tx_id='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', index=0, data='RjBEAiBQAVgs/jYpndowN3/JMI07fM886ergyyGA2xXaHCu5BQIgf58pdc8S9ABgzkUx8qDQUtV3FcYCMMzHs90q36L0J+whA0zN7LEgxcswPkHbbW7mdnkS5yviaZFgjID1mhpSZSQf')], outputs=[TxOutput(value=2132, script='dqkUutgaVG8W5OnzgAEVUqB4XgmDgm2IrA==', token_data=0), TxOutput(value=4268, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=18.648830153779993, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - ], - UnorderedList([ - # One VERTEX_METADATA_CHANGED for a new tx (below), and one VERTEX_METADATA_CHANGED for a block, adding the new tx as spending their output # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=32, timestamp=1578879429.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', nonce=0, timestamp=1578879395, version=1, weight=18.648830153779993, inputs=[TxInput(tx_id='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', index=0, data='RjBEAiBQAVgs/jYpndowN3/JMI07fM886ergyyGA2xXaHCu5BQIgf58pdc8S9ABgzkUx8qDQUtV3FcYCMMzHs90q36L0J+whA0zN7LEgxcswPkHbbW7mdnkS5yviaZFgjID1mhpSZSQf')], outputs=[TxOutput(value=2132, script='dqkUutgaVG8W5OnzgAEVUqB4XgmDgm2IrA==', token_data=0), TxOutput(value=4268, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', spent_outputs=[SpentOutput(index=0, tx_ids=['47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea']), SpentOutput(index=1, tx_ids=['47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea'])], conflict_with=[], voided_by=[], received_by=[], children=['47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea'], twins=[], accumulated_weight=18.648830153779993, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=33, timestamp=1578879429.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea', nonce=0, timestamp=1578879423, version=1, weight=19.563446104298656, inputs=[TxInput(tx_id='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', index=0, data='RzBFAiANP0tUHsWIPFnkwG0Io7W53viGaXgWfyniIsyJHIva7AIhAIij02z4JPki4RT5b/UkJoKVgazA7QWIq1Zwvik2xhXZIQOnBXShvpioJZgNxYy4lgCg4o84Uw9ncOQuv9mxPWEqeg=='), TxInput(tx_id='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', index=1, data='RjBEAiAj6I8PifTvE1J7eAqxHLu2YqFThzc4C4YzIzq+aX1fBQIgdH+xu08lWjdGiRjuaYgf/S9EZYw8U1HJQ2//WtERx9chA9euCC5MDnVV3I2e5yKj1Q65BsqgN2+IwojZqatIF3T8')], outputs=[TxOutput(value=2764, script='dqkUmkey79Rbhjq4BtHYCm2mT8hDprWIrA==', token_data=0), TxOutput(value=3636, script='dqkUFgE9a6rVMusN303z18sYfjdpYGqIrA==', token_data=0)], parents=['bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=19.563446104298656, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - ]), - [ - # One NEW_VERTEX_ACCEPTED for a new tx - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=34, timestamp=1578879429.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea', nonce=0, timestamp=1578879423, version=1, weight=19.563446104298656, inputs=[TxInput(tx_id='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', index=0, data='RzBFAiANP0tUHsWIPFnkwG0Io7W53viGaXgWfyniIsyJHIva7AIhAIij02z4JPki4RT5b/UkJoKVgazA7QWIq1Zwvik2xhXZIQOnBXShvpioJZgNxYy4lgCg4o84Uw9ncOQuv9mxPWEqeg=='), TxInput(tx_id='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', index=1, data='RjBEAiAj6I8PifTvE1J7eAqxHLu2YqFThzc4C4YzIzq+aX1fBQIgdH+xu08lWjdGiRjuaYgf/S9EZYw8U1HJQ2//WtERx9chA9euCC5MDnVV3I2e5yKj1Q65BsqgN2+IwojZqatIF3T8')], outputs=[TxOutput(value=2764, script='dqkUmkey79Rbhjq4BtHYCm2mT8hDprWIrA==', token_data=0), TxOutput(value=3636, script='dqkUFgE9a6rVMusN303z18sYfjdpYGqIrA==', token_data=0)], parents=['bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=19.563446104298656, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - ], - [ - # One VERTEX_METADATA_CHANGED and one NEW_VERTEX_ACCEPTED for a new block - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=35, timestamp=1578879429.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='f2d1327e556ac534e0d934c4e884af3ffe5ecdfd7c5045e30a123a8171500990', nonce=2907562093, timestamp=1578878921, version=0, weight=8.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='f2d1327e556ac534e0d934c4e884af3ffe5ecdfd7c5045e30a123a8171500990', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=8.0, score=8.285402218862249, first_block=None, height=12, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=36, timestamp=1578879429.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='f2d1327e556ac534e0d934c4e884af3ffe5ecdfd7c5045e30a123a8171500990', nonce=2907562093, timestamp=1578878921, version=0, weight=8.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='f2d1327e556ac534e0d934c4e884af3ffe5ecdfd7c5045e30a123a8171500990', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=8.0, score=8.285402218862249, first_block=None, height=12, validation='full'), aux_pow=None), group_id=None), latest_event_id=36) # noqa E501 - ] + # LOAD_STATED + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=0, timestamp=1578878880.0, type=EventType.LOAD_STARTED, data=EmptyData(), group_id=None), latest_event_id=36), # noqa E501 + # One NEW_VERTEX_ACCEPTED for each genesis (1 block and 2 txs) + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=1, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', nonce=0, timestamp=1572636343, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=100000000000, script='dqkU/QUFm2AGJJVDuC82h2oXxz/SJnuIrA==', token_data=0)], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa: E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=2, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa: E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=3, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa: E501 + # LOAD_FINISHED + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=4, timestamp=1578878880.0, type=EventType.LOAD_FINISHED, data=EmptyData(), group_id=None), latest_event_id=36), # noqa E501 + # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=5, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360'], twins=[], accumulated_weight=2.0, score=2.0, first_block='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=6, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360'], twins=[], accumulated_weight=2.0, score=2.0, first_block='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=7, timestamp=1578878910.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + # One NEW_VERTEX_ACCEPTED for a new block + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=8, timestamp=1578878910.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + # One VERTEX_METADATA_CHANGED and one NEW_VERTEX_ACCEPTED for 10 new blocks + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=9, timestamp=1578878910.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', nonce=1279407725, timestamp=1578878911, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUXRFxfhIYOXURHjiAlx9XPuMh7E2IrA==', token_data=0)], parents=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.321928094887363, first_block=None, height=2, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=10, timestamp=1578878910.5, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', nonce=1279407725, timestamp=1578878911, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUXRFxfhIYOXURHjiAlx9XPuMh7E2IrA==', token_data=0)], parents=['53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.321928094887363, first_block=None, height=2, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=11, timestamp=1578878910.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', nonce=1529920189, timestamp=1578878912, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUu9S/kjy3HbglEu3bA4JargdORiiIrA==', token_data=0)], parents=['967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.584962500721156, first_block=None, height=3, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=12, timestamp=1578878910.75, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', nonce=1529920189, timestamp=1578878912, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUu9S/kjy3HbglEu3bA4JargdORiiIrA==', token_data=0)], parents=['967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.584962500721156, first_block=None, height=3, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=13, timestamp=1578878911.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', nonce=1828786391, timestamp=1578878913, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUzskI6jayLvTobJDhpVZiuMu7zt+IrA==', token_data=0)], parents=['68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.807354922057604, first_block=None, height=4, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=14, timestamp=1578878911.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', nonce=1828786391, timestamp=1578878913, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUzskI6jayLvTobJDhpVZiuMu7zt+IrA==', token_data=0)], parents=['68585cc41a0cc261e97e5cf9d035e4950a9897b9fba18cbec194824522c03c7b', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.807354922057604, first_block=None, height=4, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=15, timestamp=1578878911.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', nonce=1915673046, timestamp=1578878914, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkU7B7Cf/pnj2DglfhnqyiRzxNg+K2IrA==', token_data=0)], parents=['0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.0, first_block=None, height=5, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=16, timestamp=1578878911.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', nonce=1915673046, timestamp=1578878914, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkU7B7Cf/pnj2DglfhnqyiRzxNg+K2IrA==', token_data=0)], parents=['0ed0c5540b258485199d1938646bcf10fc3b086da1110af41806c6d0792f413e', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.0, first_block=None, height=5, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=17, timestamp=1578878911.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', nonce=1279525218, timestamp=1578878915, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUZmTJ0of2Ce9iuycIVpFCVU08WmKIrA==', token_data=0)], parents=['79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.169925001442312, first_block=None, height=6, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=18, timestamp=1578878911.5, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', nonce=1279525218, timestamp=1578878915, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUZmTJ0of2Ce9iuycIVpFCVU08WmKIrA==', token_data=0)], parents=['79c4da1aa12adbb3e384f3e631cf0f8898922db6a7a157c878d6dd5d27b62e77', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.169925001442312, first_block=None, height=6, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=19, timestamp=1578878911.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', nonce=4136633663, timestamp=1578878916, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPNN8M/qangqd2wYSzu0u+3OmwDmIrA==', token_data=0)], parents=['0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.321928094887363, first_block=None, height=7, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=20, timestamp=1578878911.75, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', nonce=4136633663, timestamp=1578878916, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPNN8M/qangqd2wYSzu0u+3OmwDmIrA==', token_data=0)], parents=['0c88949d8b9eef81bf0896aabe875c4bd1172bc834b7bc4cc1c756a3d243ec52', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.321928094887363, first_block=None, height=7, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=21, timestamp=1578878912.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', nonce=945260546, timestamp=1578878917, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUxbNqvpWbgNtk9km/VuYhzHHMp76IrA==', token_data=0)], parents=['3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.459431618637297, first_block=None, height=8, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=22, timestamp=1578878912.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', nonce=945260546, timestamp=1578878917, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUxbNqvpWbgNtk9km/VuYhzHHMp76IrA==', token_data=0)], parents=['3624a05261b604d4ff46b0157892b2ff48a7fb1e31fe65e58fbbfe88cadcbdd4', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.459431618637297, first_block=None, height=8, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=23, timestamp=1578878912.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', nonce=2222918728, timestamp=1578878918, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkU48C0XcFpiaWq2gwTICyEVdvJXcCIrA==', token_data=0)], parents=['282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.584962500721156, first_block=None, height=9, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=24, timestamp=1578878912.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', nonce=2222918728, timestamp=1578878918, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkU48C0XcFpiaWq2gwTICyEVdvJXcCIrA==', token_data=0)], parents=['282d65827ecc485b1c8b916f71605da0f15f353325feb9a1a87fe320c1ebc915', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.584962500721156, first_block=None, height=9, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=25, timestamp=1578878912.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', nonce=3090209358, timestamp=1578878919, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUmQRjqRyxq26raJZnhnpRJsrS9n2IrA==', token_data=0)], parents=['4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.700439718141092, first_block=None, height=10, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=26, timestamp=1578878912.5, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', nonce=3090209358, timestamp=1578878919, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUmQRjqRyxq26raJZnhnpRJsrS9n2IrA==', token_data=0)], parents=['4978ebbeb98dccae64f3d32269e1a1030892c82b023448cafd649cad73e9127a', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.700439718141092, first_block=None, height=10, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=27, timestamp=1578878912.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', nonce=3024981275, timestamp=1578878920, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUYFHjcujZZHs0JWZkriEbn5jTv/aIrA==', token_data=0)], parents=['47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.807354922057604, first_block=None, height=11, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=28, timestamp=1578878912.75, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', nonce=3024981275, timestamp=1578878920, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUYFHjcujZZHs0JWZkriEbn5jTv/aIrA==', token_data=0)], parents=['47ced60615a9d5d4fc1ca26d9dbc71ca89b8b35541b31d8e75a65d4badfa99c7', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=5.807354922057604, first_block=None, height=11, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + # One VERTEX_METADATA_CHANGED for a new tx (below), and one VERTEX_METADATA_CHANGED for a block, adding the new tx as spending their output # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=29, timestamp=1578879395.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', nonce=105631935, timestamp=1578878910, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', spent_outputs=[SpentOutput(index=0, tx_ids=['bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c'])], conflict_with=[], voided_by=[], received_by=[], children=['967f7d6577e5b301d7facaf7fecd87f18586acfd24fc52e49251c9c4195b49f6'], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=30, timestamp=1578879395.5, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', nonce=0, timestamp=1578879395, version=1, weight=18.648830153779993, inputs=[TxInput(tx_id='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', index=0, data='RjBEAiBQAVgs/jYpndowN3/JMI07fM886ergyyGA2xXaHCu5BQIgf58pdc8S9ABgzkUx8qDQUtV3FcYCMMzHs90q36L0J+whA0zN7LEgxcswPkHbbW7mdnkS5yviaZFgjID1mhpSZSQf')], outputs=[TxOutput(value=2132, script='dqkUutgaVG8W5OnzgAEVUqB4XgmDgm2IrA==', token_data=0), TxOutput(value=4268, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=18.648830153779993, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + # One NEW_VERTEX_ACCEPTED for a new tx + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=31, timestamp=1578879395.5, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', nonce=0, timestamp=1578879395, version=1, weight=18.648830153779993, inputs=[TxInput(tx_id='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', index=0, data='RjBEAiBQAVgs/jYpndowN3/JMI07fM886ergyyGA2xXaHCu5BQIgf58pdc8S9ABgzkUx8qDQUtV3FcYCMMzHs90q36L0J+whA0zN7LEgxcswPkHbbW7mdnkS5yviaZFgjID1mhpSZSQf')], outputs=[TxOutput(value=2132, script='dqkUutgaVG8W5OnzgAEVUqB4XgmDgm2IrA==', token_data=0), TxOutput(value=4268, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=18.648830153779993, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + # One VERTEX_METADATA_CHANGED for a new tx (below), and one VERTEX_METADATA_CHANGED for a block, adding the new tx as spending their output # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=32, timestamp=1578879429.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea', nonce=0, timestamp=1578879423, version=1, weight=19.563446104298656, inputs=[TxInput(tx_id='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', index=0, data='RzBFAiANP0tUHsWIPFnkwG0Io7W53viGaXgWfyniIsyJHIva7AIhAIij02z4JPki4RT5b/UkJoKVgazA7QWIq1Zwvik2xhXZIQOnBXShvpioJZgNxYy4lgCg4o84Uw9ncOQuv9mxPWEqeg=='), TxInput(tx_id='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', index=1, data='RjBEAiAj6I8PifTvE1J7eAqxHLu2YqFThzc4C4YzIzq+aX1fBQIgdH+xu08lWjdGiRjuaYgf/S9EZYw8U1HJQ2//WtERx9chA9euCC5MDnVV3I2e5yKj1Q65BsqgN2+IwojZqatIF3T8')], outputs=[TxOutput(value=2764, script='dqkUmkey79Rbhjq4BtHYCm2mT8hDprWIrA==', token_data=0), TxOutput(value=3636, script='dqkUFgE9a6rVMusN303z18sYfjdpYGqIrA==', token_data=0)], parents=['bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=19.563446104298656, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=33, timestamp=1578879429.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', nonce=0, timestamp=1578879395, version=1, weight=18.648830153779993, inputs=[TxInput(tx_id='53c5fe57a6d79ab4a8eca660bd0a9935fe9f82d2506d80e0c48339c42c234360', index=0, data='RjBEAiBQAVgs/jYpndowN3/JMI07fM886ergyyGA2xXaHCu5BQIgf58pdc8S9ABgzkUx8qDQUtV3FcYCMMzHs90q36L0J+whA0zN7LEgxcswPkHbbW7mdnkS5yviaZFgjID1mhpSZSQf')], outputs=[TxOutput(value=2132, script='dqkUutgaVG8W5OnzgAEVUqB4XgmDgm2IrA==', token_data=0), TxOutput(value=4268, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', spent_outputs=[SpentOutput(index=0, tx_ids=['47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea']), SpentOutput(index=1, tx_ids=['47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea'])], conflict_with=[], voided_by=[], received_by=[], children=['47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea'], twins=[], accumulated_weight=18.648830153779993, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + # One NEW_VERTEX_ACCEPTED for a new tx + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=34, timestamp=1578879429.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea', nonce=0, timestamp=1578879423, version=1, weight=19.563446104298656, inputs=[TxInput(tx_id='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', index=0, data='RzBFAiANP0tUHsWIPFnkwG0Io7W53viGaXgWfyniIsyJHIva7AIhAIij02z4JPki4RT5b/UkJoKVgazA7QWIq1Zwvik2xhXZIQOnBXShvpioJZgNxYy4lgCg4o84Uw9ncOQuv9mxPWEqeg=='), TxInput(tx_id='bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', index=1, data='RjBEAiAj6I8PifTvE1J7eAqxHLu2YqFThzc4C4YzIzq+aX1fBQIgdH+xu08lWjdGiRjuaYgf/S9EZYw8U1HJQ2//WtERx9chA9euCC5MDnVV3I2e5yKj1Q65BsqgN2+IwojZqatIF3T8')], outputs=[TxOutput(value=2764, script='dqkUmkey79Rbhjq4BtHYCm2mT8hDprWIrA==', token_data=0), TxOutput(value=3636, script='dqkUFgE9a6rVMusN303z18sYfjdpYGqIrA==', token_data=0)], parents=['bd1c5ae097470eecfe10b3f25e02c0f8358b95706484b2174c6ea0ff930cc25c', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='47b26240891fb57320d72cbd708f5287ca056e73f4b19bb295e6b19d984c07ea', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=19.563446104298656, score=0.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + # One VERTEX_METADATA_CHANGED and one NEW_VERTEX_ACCEPTED for a new block + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=35, timestamp=1578879429.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='f2d1327e556ac534e0d934c4e884af3ffe5ecdfd7c5045e30a123a8171500990', nonce=2907562093, timestamp=1578878921, version=0, weight=8.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='f2d1327e556ac534e0d934c4e884af3ffe5ecdfd7c5045e30a123a8171500990', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=8.0, score=8.285402218862249, first_block=None, height=12, validation='full'), aux_pow=None), group_id=None), latest_event_id=36), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=36, timestamp=1578879429.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='f2d1327e556ac534e0d934c4e884af3ffe5ecdfd7c5045e30a123a8171500990', nonce=2907562093, timestamp=1578878921, version=0, weight=8.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUBvl1aaAtzoh8a9vaZoqXA6JxK4OIrA==', token_data=0)], parents=['15599c25cb30892add963558e06c97c2a838a8a5c047aee416dc9a3617d59baa', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='f2d1327e556ac534e0d934c4e884af3ffe5ecdfd7c5045e30a123a8171500990', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=8.0, score=8.285402218862249, first_block=None, height=12, validation='full'), aux_pow=None), group_id=None), latest_event_id=36) # noqa E501 ] - _assert_equal_events(responses, expected) + assert responses == expected, f'expected: {expected}\n\nactual: {responses}' def test_reorg(self): miner1 = self.simulator.create_miner(self.manager, hashpower=1e6) @@ -220,84 +197,43 @@ def test_reorg(self): responses = self._get_success_responses() expected = [ - [ - # LOAD_STATED - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=0, timestamp=1578878880.0, type=EventType.LOAD_STARTED, data=EmptyData(), group_id=None), latest_event_id=20), # noqa E501 - # One NEW_VERTEX_ACCEPTED for each genesis (1 block and 2 txs) - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=1, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', nonce=0, timestamp=1572636343, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=100000000000, script='dqkU/QUFm2AGJJVDuC82h2oXxz/SJnuIrA==', token_data=0)], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa: E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=2, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa: E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=3, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa: E501 - # LOAD_FINISHED - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=4, timestamp=1578878880.0, type=EventType.LOAD_FINISHED, data=EmptyData(), group_id=None), latest_event_id=20), # noqa E501 - ], - UnorderedList([ - # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=5, timestamp=1578878940.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3'], twins=[], accumulated_weight=2.0, score=2.0, first_block='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=7, timestamp=1578878940.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3'], twins=[], accumulated_weight=2.0, score=2.0, first_block='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=6, timestamp=1578878940.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', nonce=2246536493, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 - ]), - [ - # One NEW_VERTEX_ACCEPTED for a new block from manager1 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=8, timestamp=1578878940.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', nonce=2246536493, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 - ], - UnorderedList([ - # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 - # Also one VERTEX_METADATA_CHANGED for the previous block, voiding it - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=9, timestamp=1578878949.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', '4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7'], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=12, timestamp=1578878949.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', '4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7'], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=11, timestamp=1578878949.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', nonce=2246536493, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', spent_outputs=[], conflict_with=[], voided_by=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3'], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=10, timestamp=1578878949.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', nonce=1279525218, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUfBo1MGBHkHtXDktO+BxtBdh5T5GIrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', spent_outputs=[], conflict_with=[], voided_by=['4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7'], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 - ]), - [ - # One NEW_VERTEX_ACCEPTED for a new block from manager2 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=13, timestamp=1578878949.75, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', nonce=1279525218, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUfBo1MGBHkHtXDktO+BxtBdh5T5GIrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', spent_outputs=[], conflict_with=[], voided_by=['4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7'], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 - # REORG_STARTED caused by a new block from manager2 (below) - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=14, timestamp=1578878950.0, type=EventType.REORG_STARTED, data=ReorgData(reorg_size=1, previous_best_block='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', new_best_block='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', common_block='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792'), group_id=0), latest_event_id=20), # noqa E501 - ], - UnorderedList([ - # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 - # Also one VERTEX_METADATA_CHANGED for the previous block, un-voiding it as it's now part of the best blockchain # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=15, timestamp=1578878950.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', '4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', 'a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4'], twins=[], accumulated_weight=2.0, score=2.0, first_block='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', height=0, validation='full'), aux_pow=None), group_id=0), latest_event_id=20), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=18, timestamp=1578878950.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', '4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', 'a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4'], twins=[], accumulated_weight=2.0, score=2.0, first_block='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', height=0, validation='full'), aux_pow=None), group_id=0), latest_event_id=20), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=17, timestamp=1578878950.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', nonce=1279525218, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUfBo1MGBHkHtXDktO+BxtBdh5T5GIrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4'], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=0), latest_event_id=20), # noqa E501 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=16, timestamp=1578878950.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', nonce=4136633663, timestamp=1578878941, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUgQrqLefPfPVpkXlfvvAp943epyOIrA==', token_data=0)], parents=['4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.321928094887363, first_block=None, height=2, validation='full'), aux_pow=None), group_id=0), latest_event_id=20), # noqa E501 - ]), - [ - # REORG_FINISHED - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=19, timestamp=1578878950.0, type=EventType.REORG_FINISHED, data=EmptyData(), group_id=0), latest_event_id=20), # noqa E501 - # One NEW_VERTEX_ACCEPTED for a new block from manager2 - EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=20, timestamp=1578878950.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', nonce=4136633663, timestamp=1578878941, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUgQrqLefPfPVpkXlfvvAp943epyOIrA==', token_data=0)], parents=['4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.321928094887363, first_block=None, height=2, validation='full'), aux_pow=None), group_id=None), latest_event_id=20) # noqa E501 - ] + # LOAD_STATED + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=0, timestamp=1578878880.0, type=EventType.LOAD_STARTED, data=EmptyData(), group_id=None), latest_event_id=20), # noqa E501 + # One NEW_VERTEX_ACCEPTED for each genesis (1 block and 2 txs) + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=1, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', nonce=0, timestamp=1572636343, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=100000000000, script='dqkU/QUFm2AGJJVDuC82h2oXxz/SJnuIrA==', token_data=0)], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa: E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=2, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa: E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=3, timestamp=1578878880.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa: E501 + # LOAD_FINISHED + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=4, timestamp=1578878880.0, type=EventType.LOAD_FINISHED, data=EmptyData(), group_id=None), latest_event_id=20), # noqa E501 + # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=5, timestamp=1578878940.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3'], twins=[], accumulated_weight=2.0, score=2.0, first_block='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=6, timestamp=1578878940.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3'], twins=[], accumulated_weight=2.0, score=2.0, first_block='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=7, timestamp=1578878940.25, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', nonce=2246536493, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 + # One NEW_VERTEX_ACCEPTED for a new block from manager1 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=8, timestamp=1578878940.25, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', nonce=2246536493, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 + # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 + # Also one VERTEX_METADATA_CHANGED for the previous block, voiding it + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=9, timestamp=1578878949.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', '4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7'], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=10, timestamp=1578878949.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', '4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7'], twins=[], accumulated_weight=2.0, score=2.0, first_block=None, height=0, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=11, timestamp=1578878949.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', nonce=2246536493, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUPXOcGnrN0ZB2WrnPVcjdCCcacL+IrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', spent_outputs=[], conflict_with=[], voided_by=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3'], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=12, timestamp=1578878949.75, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', nonce=1279525218, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUfBo1MGBHkHtXDktO+BxtBdh5T5GIrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', spent_outputs=[], conflict_with=[], voided_by=['4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7'], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 + # One NEW_VERTEX_ACCEPTED for a new block from manager2 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=13, timestamp=1578878949.75, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', nonce=1279525218, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUfBo1MGBHkHtXDktO+BxtBdh5T5GIrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', spent_outputs=[], conflict_with=[], voided_by=['4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7'], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=None), latest_event_id=20), # noqa E501 + # REORG_STARTED caused by a new block from manager2 (below) + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=14, timestamp=1578878950.0, type=EventType.REORG_STARTED, data=ReorgData(reorg_size=1, previous_best_block='3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', new_best_block='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', common_block='339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792'), group_id=0), latest_event_id=20), # noqa E501 + # One VERTEX_METADATA_CHANGED for a new block (below), and one VERTEX_METADATA_CHANGED for each genesis tx (2), adding the new block as their child # noqa E501 + # Also one VERTEX_METADATA_CHANGED for the previous block, un-voiding it as it's now part of the best blockchain # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=15, timestamp=1578878950.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', nonce=6, timestamp=1572636344, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', '4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', 'a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4'], twins=[], accumulated_weight=2.0, score=2.0, first_block='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', height=0, validation='full'), aux_pow=None), group_id=0), latest_event_id=20), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=16, timestamp=1578878950.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', nonce=2, timestamp=1572636345, version=1, weight=2.0, inputs=[], outputs=[], parents=[], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['3cfde60f140d2838581d885e656af1049fa8eab964defc5bca3d883b83c9afc3', '4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', 'a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4'], twins=[], accumulated_weight=2.0, score=2.0, first_block='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', height=0, validation='full'), aux_pow=None), group_id=0), latest_event_id=20), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=17, timestamp=1578878950.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', nonce=1279525218, timestamp=1578878940, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUfBo1MGBHkHtXDktO+BxtBdh5T5GIrA==', token_data=0)], parents=['339f47da87435842b0b1b528ecd9eac2495ce983b3e9c923a37e1befbe12c792', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=['a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4'], twins=[], accumulated_weight=2.0, score=4.0, first_block=None, height=1, validation='full'), aux_pow=None), group_id=0), latest_event_id=20), # noqa E501 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=18, timestamp=1578878950.0, type=EventType.VERTEX_METADATA_CHANGED, data=TxData(hash='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', nonce=4136633663, timestamp=1578878941, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUgQrqLefPfPVpkXlfvvAp943epyOIrA==', token_data=0)], parents=['4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.321928094887363, first_block=None, height=2, validation='full'), aux_pow=None), group_id=0), latest_event_id=20), # noqa E501 + # REORG_FINISHED + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=19, timestamp=1578878950.0, type=EventType.REORG_FINISHED, data=EmptyData(), group_id=0), latest_event_id=20), # noqa E501 + # One NEW_VERTEX_ACCEPTED for a new block from manager2 + EventResponse(type='EVENT', event=BaseEvent(peer_id=self.peer_id, id=20, timestamp=1578878950.0, type=EventType.NEW_VERTEX_ACCEPTED, data=TxData(hash='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', nonce=4136633663, timestamp=1578878941, version=0, weight=2.0, inputs=[], outputs=[TxOutput(value=6400, script='dqkUgQrqLefPfPVpkXlfvvAp943epyOIrA==', token_data=0)], parents=['4f0b3d13966f95f461d4edc6389c8440955e13a75f87c6bc2a4b455d813fb2f7', '16ba3dbe424c443e571b00840ca54b9ff4cff467e10b6a15536e718e2008f952', '33e14cb555a96967841dcbe0f95e9eab5810481d01de8f4f73afb8cce365e869'], tokens=[], token_name=None, token_symbol=None, metadata=TxMetadata(hash='a729a7abb4248dffa492dd2c2634aa6d92b3e1e05bfa6614118b6ba97bfba5c4', spent_outputs=[], conflict_with=[], voided_by=[], received_by=[], children=[], twins=[], accumulated_weight=2.0, score=4.321928094887363, first_block=None, height=2, validation='full'), aux_pow=None), group_id=None), latest_event_id=20) # noqa E501 ] - _assert_equal_events(responses, expected) - - -class UnorderedList(list): - pass - - -def _assert_equal_events(actual_events: list[EventResponse], expected_events: list[list[EventResponse]]) -> None: - for actual_events_chunk, expected_events_chunk in zip_chunkify(actual_events, expected_events): - if isinstance(expected_events_chunk, UnorderedList): - actual_events_chunk = _sorted_by_hash_without_id(actual_events_chunk) - expected_events_chunk = _sorted_by_hash_without_id(expected_events_chunk) - - assert expected_events_chunk == actual_events_chunk, ( - f'different chunks:\n\nexpected: {expected_events_chunk}\n\nactual: {actual_events_chunk}\n' - ) - - -def _sorted_by_hash_without_id(responses: list[EventResponse]) -> list[EventResponse]: - responses_without_id = [response.copy(exclude={'event': {'id'}}) for response in responses] - - def key(response: EventResponse) -> str: - assert isinstance(response.event.data, TxData), ( - f'only tx events can be sorted. event.data type: {type(response.event.data)}' - ) - return response.event.data.hash - - return sorted(responses_without_id, key=key) + assert responses == expected, f'expected: {expected}\n\nactual: {responses}' class MemoryEventSimulationScenariosTest(BaseEventSimulationScenariosTest, MemoryEventSimulationTester): diff --git a/tests/utils.py b/tests/utils.py index 9d5e16f77..64c578ea6 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -6,7 +6,7 @@ import time import urllib.parse from dataclasses import dataclass -from typing import Iterator, Optional, TypeVar, cast +from typing import Optional, cast import requests from hathorlib.scripts import DataScript @@ -717,48 +717,3 @@ def create_event(cls, event_id: int) -> BaseEvent: type=EventType.VERTEX_METADATA_CHANGED, data=cls.tx_data ) - - -T = TypeVar('T') - - -def zip_chunkify(flat_list: list[T], chunked_list: list[list[T]]) -> Iterator[tuple[list[T], list[T]]]: - """ - Takes two lists, one flat and one chunked. Chunks the first one into chunks of the same size as the second. - Returns a zipped list where each item is a tuple of chunks, one from each list. - - >>> list(zip_chunkify([], [])) - [] - >>> list(zip_chunkify([], [[]])) - [([], [])] - >>> list(zip_chunkify([], [[], []])) - [([], []), ([], [])] - >>> list(zip_chunkify([1], [[2]])) - [([1], [2])] - >>> list(zip_chunkify([1, 1], [[2]])) - Traceback (most recent call last): - ... - ValueError: lists should have the same amount of items - >>> list(zip_chunkify([1], [[2], [2]])) - Traceback (most recent call last): - ... - ValueError: lists should have the same amount of items - >>> list(zip_chunkify([1, 1], [[2], [2]])) - [([1], [2]), ([1], [2])] - >>> list(zip_chunkify([0, 2, 4, 6, 8, 10, 12], [[1], [3, 5], [7], [9, 11, 13]])) - [([0], [1]), ([2, 4], [3, 5]), ([6], [7]), ([8, 10, 12], [9, 11, 13])] - """ - - flat_list_len = len(flat_list) - chunked_list_len = sum(map(len, chunked_list)) - - if flat_list_len != chunked_list_len: - raise ValueError(f'lists should have the same amount of items. ' - f'{flat_list_len} (flat) != {chunked_list_len} (chunked)') - - flat_iter = iter(flat_list) - - for chunk in chunked_list: - items = [next(flat_iter) for _ in chunk] - - yield items, chunk