Onionr/src/gossip/commands.py

14 lines
278 B
Python
Raw Normal View History

2022-02-22 20:34:19 +00:00
from enum import IntEnum, auto
2022-02-22 20:34:19 +00:00
class GossipCommands(IntEnum):
PING = 1
ANNOUNCE = auto()
PEER_EXCHANGE = auto()
STREAM_BLOCKS = auto()
PUT_BLOCKS = auto()
2022-02-22 20:34:19 +00:00
CLOSE = auto()
def command_to_byte(cmd: GossipCommands):
return int(cmd).to_bytes(1, 'big')