mirror of https://github.com/status-im/nim-eth.git
Use the new enr.Record constructor
This commit is contained in:
parent
a1a6862c7c
commit
9908e84935
|
@ -35,14 +35,10 @@ proc whoareyouMagic(toNode: NodeId): array[32, byte] =
|
||||||
|
|
||||||
proc newProtocol*(privKey: PrivateKey, db: Database, port: Port): Protocol =
|
proc newProtocol*(privKey: PrivateKey, db: Database, port: Port): Protocol =
|
||||||
result = Protocol(privateKey: privKey, db: db)
|
result = Protocol(privateKey: privKey, db: db)
|
||||||
var a: Address
|
let a = Address(ip: parseIpAddress("127.0.0.1"), udpPort: port)
|
||||||
a.ip = parseIpAddress("127.0.0.1")
|
|
||||||
a.udpPort = port
|
|
||||||
var ipAddr: int32
|
|
||||||
bigEndian32(addr ipAddr, addr a.ip.address_v4)
|
|
||||||
|
|
||||||
result.localNode = newNode(initENode(result.privateKey.getPublicKey(), a))
|
result.localNode = newNode(initENode(result.privateKey.getPublicKey(), a))
|
||||||
result.localNode.record = initRecord(12, result.privateKey, {"udp": int(a.udpPort), "ip": ipAddr})
|
result.localNode.record = enr.Record.init(12, result.privateKey, a)
|
||||||
|
|
||||||
result.whoareyouMagic = whoareyouMagic(result.localNode.id)
|
result.whoareyouMagic = whoareyouMagic(result.localNode.id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue