Use namedtuple for blockinfo and network sync result (#577)

This commit is contained in:
Jonathan Zernik 2021-01-07 23:17:52 -08:00 committed by GitHub
parent 1a64281d68
commit e24eca5bf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View file

@ -1,10 +1,8 @@
from dataclasses import dataclass
from typing import NamedTuple
@dataclass
class BlockInfo:
class BlockInfo(NamedTuple):
"""Class for getting block info from blockchain."""
block_height: int
block_hash: bytes
block_header: bytes

View file

@ -1,24 +1,22 @@
import logging
import queue
import threading
from dataclasses import dataclass
from typing import Any
from typing import List
from typing import NamedTuple
from squeaknode.sync.network_sync import NetworkSync
logger = logging.getLogger(__name__)
@dataclass
class PeerSyncResult:
class PeerSyncResult(NamedTuple):
completed_peer_id: Any = None
failed_peer_id: Any = None
timeout: Any = None
@dataclass
class NetworkSyncResult:
class NetworkSyncResult(NamedTuple):
completed_peer_ids: List[int]
failed_peer_ids: List[int]
timeout_peer_ids: List[int]