@@ -48,6 +48,7 @@ type RemotePeerInfo* = ref object
4848 addrs* : seq [MultiAddress ]
4949 enr* : Option [enr.Record ]
5050 protocols* : seq [string ]
51+ shards* : seq [uint16 ]
5152
5253 agent* : string
5354 protoVersion* : string
@@ -73,6 +74,7 @@ proc init*(
7374 addrs: seq [MultiAddress ] = @ [],
7475 enr: Option [enr.Record ] = none (enr.Record ),
7576 protocols: seq [string ] = @ [],
77+ shards: seq [uint16 ] = @ [],
7678 publicKey: crypto.PublicKey = crypto.PublicKey (),
7779 agent: string = " " ,
7880 protoVersion: string = " " ,
@@ -88,6 +90,7 @@ proc init*(
8890 addrs: addrs,
8991 enr: enr,
9092 protocols: protocols,
93+ shards: shards,
9194 publicKey: publicKey,
9295 agent: agent,
9396 protoVersion: protoVersion,
@@ -105,9 +108,10 @@ proc init*(
105108 addrs: seq [MultiAddress ] = @ [],
106109 enr: Option [enr.Record ] = none (enr.Record ),
107110 protocols: seq [string ] = @ [],
111+ shards: seq [uint16 ] = @ [],
108112): T {.raises : [Defect , ResultError [cstring ], LPError ].} =
109113 let peerId = PeerID .init (peerId).tryGet ()
110- RemotePeerInfo (peerId: peerId, addrs: addrs, enr: enr, protocols: protocols)
114+ RemotePeerInfo (peerId: peerId, addrs: addrs, enr: enr, protocols: protocols, shards: shards )
111115
112116# # Parse
113117
@@ -327,6 +331,7 @@ converter toRemotePeerInfo*(peerInfo: PeerInfo): RemotePeerInfo =
327331 addrs: peerInfo.listenAddrs,
328332 enr: none (enr.Record ),
329333 protocols: peerInfo.protocols,
334+ shards: @ [],
330335 agent: peerInfo.agentVersion,
331336 protoVersion: peerInfo.protoVersion,
332337 publicKey: peerInfo.publicKey,
@@ -363,6 +368,9 @@ proc getAgent*(peer: RemotePeerInfo): string =
363368 return peer.agent
364369
365370proc getShards * (peer: RemotePeerInfo ): seq [uint16 ] =
371+ if peer.shards.len > 0 :
372+ return peer.shards
373+
366374 if peer.enr.isNone ():
367375 return @ []
368376
0 commit comments