mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-15 12:50:47 +02:00
Use namedtuple for blockinfo and network sync result (#577)
This commit is contained in:
parent
1a64281d68
commit
e24eca5bf0
2 changed files with 5 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue