Onionr/src/gossip/commands.py

13 lines
259 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()
def command_to_byte(cmd: GossipCommands):
return int(cmd).to_bytes(1, 'big')