Onionr/src/gossip/commands.py

14 lines
278 B
Python

from enum import IntEnum, auto
class GossipCommands(IntEnum):
PING = 1
ANNOUNCE = auto()
PEER_EXCHANGE = auto()
STREAM_BLOCKS = auto()
PUT_BLOCKS = auto()
CLOSE = auto()
def command_to_byte(cmd: GossipCommands):
return int(cmd).to_bytes(1, 'big')