Merge commit '3f740d375c1d767681e44d4a22ab89b6e0cb7ad0' into checkpoint/long_lived_atari_from_main_3f740d375c1d767681e44d4a22ab89b6e0cb7ad0

This commit is contained in:
Amine Khaldi 2022-08-01 16:27:59 +01:00
commit baf09aaf0b
No known key found for this signature in database
GPG Key ID: B1C074FFC904E2D9
2 changed files with 16 additions and 3 deletions

View File

@ -14,7 +14,7 @@ from chia.plot_sync.exceptions import (
PlotSyncException,
SyncIdsMatchError,
)
from chia.plot_sync.util import ErrorCodes, State
from chia.plot_sync.util import ErrorCodes, State, T_PlotSyncMessage
from chia.protocols.harvester_protocol import (
Plot,
PlotSyncDone,
@ -29,7 +29,6 @@ from chia.server.ws_connection import ProtocolMessageTypes, WSChiaConnection, ma
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.ints import int16, uint32, uint64
from chia.util.misc import get_list_or_len
from chia.util.streamable import _T_Streamable
log = logging.getLogger(__name__)
@ -140,7 +139,7 @@ class Receiver:
return self._total_plot_size
async def _process(
self, method: Callable[[_T_Streamable], Any], message_type: ProtocolMessageTypes, message: Any
self, method: Callable[[T_PlotSyncMessage], Any], message_type: ProtocolMessageTypes, message: T_PlotSyncMessage
) -> None:
log.debug(
f"_process: node_id {self.connection().peer_node_id}, message_type: {message_type}, message: {message}"

View File

@ -1,4 +1,9 @@
from enum import IntEnum
from typing import TypeVar
from typing_extensions import Protocol
from chia.protocols.harvester_protocol import PlotSyncIdentifier
class Constants:
@ -25,3 +30,12 @@ class ErrorCodes(IntEnum):
plot_already_available = 5
plot_not_available = 6
sync_ids_match = 7
class PlotSyncMessage(Protocol):
@property
def identifier(self) -> PlotSyncIdentifier:
pass
T_PlotSyncMessage = TypeVar("T_PlotSyncMessage", bound=PlotSyncMessage)