mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-07-22 04:29:42 +00:00
* change all usage of std.options.Option[T] to results.Opt[T] * fix broken apps and examples (to validate refactor) * removed all std/options code added for libp2p v2 migration * add broker Opt codec to persistency/backend_comm.nim * add a readValue overload for Opt[T] in tools/confutils/cli_args.nim * keep Option where required (Presto, confutils' config_file.nim) * Change generateRlnProof error handling * Fix imports
33 lines
924 B
Nim
33 lines
924 B
Nim
import
|
|
sequtils, results, chronos, libp2p/crypto/crypto as libp2p_keys, eth/keys as eth_keys
|
|
|
|
import
|
|
logos_delivery/waku/[waku_enr, discovery/waku_discv5, waku_enr/sharding],
|
|
../testlib/wakucore
|
|
|
|
proc newTestEnrRecord*(
|
|
privKey: libp2p_keys.PrivateKey,
|
|
extIp: string,
|
|
tcpPort: uint16,
|
|
udpPort: uint16,
|
|
indices: seq[uint64] = @[],
|
|
flags = Opt.none(CapabilitiesBitfield),
|
|
): waku_enr.Record =
|
|
var builder = EnrBuilder.init(privKey)
|
|
builder.withIpAddressAndPorts(
|
|
ipAddr = Opt.some(parseIpAddress(extIp)),
|
|
tcpPort = Opt.some(Port(tcpPort)),
|
|
udpPort = Opt.some(Port(udpPort)),
|
|
)
|
|
|
|
if indices.len > 0:
|
|
let
|
|
byteSeq: seq[byte] = indices.mapIt(cast[byte](it))
|
|
relayShards = fromIndicesList(byteSeq).get()
|
|
discard builder.withWakuRelayShardingIndicesList(relayShards)
|
|
|
|
if flags.isSome():
|
|
builder.withWakuCapabilities(flags.get())
|
|
|
|
builder.build().tryGet()
|