Skip to content

Commit d9e8e18

Browse files
committed
Define beacon chain network commands
1 parent f2d0d5d commit d9e8e18

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

trinity/protocol/bcc/__init__.py

Whitespace-only changes.

trinity/protocol/bcc/commands.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from rlp import sedes
2+
3+
from p2p.protocol import (
4+
Command,
5+
)
6+
7+
from trinity.rlp.sedes import HashOrNumber
8+
from eth.beacon.types.blocks import BaseBeaconBlock
9+
from eth.beacon.types.attestation_records import AttestationRecord
10+
11+
12+
class Status(Command):
13+
_cmd_id = 0
14+
structure = [
15+
('protocol_version', sedes.big_endian_int),
16+
('network_id', sedes.big_endian_int),
17+
('best_hash', sedes.binary),
18+
]
19+
20+
21+
class GetBeaconBlocks(Command):
22+
_cmd_id = 1
23+
structure = [
24+
('block_number_or_hash', HashOrNumber()),
25+
('max_headers', sedes.big_endian_int),
26+
]
27+
28+
29+
class BeaconBlocks(Command):
30+
_cmd_id = 2
31+
structure = sedes.CountableList(BaseBeaconBlock)
32+
33+
34+
class AttestationRecords(Command):
35+
_cmd_id = 3
36+
structure = sedes.CountableList(AttestationRecord)

0 commit comments

Comments
 (0)