nimbus-eth2/tests/test_discovery_helpers.nim
Zahary Karadjov ee7c2c9dff Unify the bootstrap nodes handling code
We no longer discriminate between ENR, MultiAddress or ENode
bootstrap records (all of them are remapped to ENodes).

The discovery loop will stochastically try to reconnect to
accidentally disconnected nodes.
2020-02-18 12:53:49 +02:00

18 lines
523 B
Nim

import
net, unittest, testutil,
eth/p2p/enode, libp2p/multiaddress,
../beacon_chain/eth2_discovery
suite "Discovery v5 utilities":
timedTest "Multiaddress to ENode":
let addrStr = "/ip4/178.128.140.61/tcp/9000/p2p/16Uiu2HAmL5A5DAiiupFi6sUTF6Zq1TCKf6Pd5T8oFt9opQJqLqTQ"
let ma = MultiAddress.init addrStr
let enode = ma.toENode
check:
enode.isOk
enode.value.address.tcpPort == Port(9000)
$enode.value.address.ip == "178.128.140.61"
enode.value.toMultiAddressStr == addrStr