server: Hint data parameter of make_msg (#11876)

This commit is contained in:
dustinface 2022-06-13 18:41:22 +02:00 committed by GitHub
parent a9fa0b0541
commit a221726770
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -50,6 +50,9 @@ class PayloadType(Protocol):
def __init__(self, identifier: PlotSyncIdentifier, *args: object) -> None:
...
def __bytes__(self) -> bytes:
pass
T = TypeVar("T", bound=PayloadType)

View File

@ -1,6 +1,6 @@
from dataclasses import dataclass
from enum import IntEnum
from typing import Any, Optional
from typing import Optional, SupportsBytes, Union
from chia.protocols.protocol_message_types import ProtocolMessageTypes
from chia.util.ints import uint8, uint16
@ -41,5 +41,5 @@ class Message(Streamable):
data: bytes
def make_msg(msg_type: ProtocolMessageTypes, data: Any) -> Message:
def make_msg(msg_type: ProtocolMessageTypes, data: Union[bytes, SupportsBytes]) -> Message:
return Message(uint8(msg_type.value), None, bytes(data))