diff options
author | Felix Lange <fjl@twurst.com> | 2015-04-23 18:11:21 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-04-30 21:02:23 +0800 |
commit | 72ab6d325555c742c6b70202d865ec23b50734d6 (patch) | |
tree | 92522e695c39ab4ee31321b5b469611f001fd684 /p2p/discover/udp_test.go | |
parent | b34a8ef624499e15cc3a2a51bddd94391f9b993e (diff) | |
download | go-tangerine-72ab6d325555c742c6b70202d865ec23b50734d6.tar go-tangerine-72ab6d325555c742c6b70202d865ec23b50734d6.tar.gz go-tangerine-72ab6d325555c742c6b70202d865ec23b50734d6.tar.bz2 go-tangerine-72ab6d325555c742c6b70202d865ec23b50734d6.tar.lz go-tangerine-72ab6d325555c742c6b70202d865ec23b50734d6.tar.xz go-tangerine-72ab6d325555c742c6b70202d865ec23b50734d6.tar.zst go-tangerine-72ab6d325555c742c6b70202d865ec23b50734d6.zip |
p2p/discover: track sha3(ID) in Node
Diffstat (limited to 'p2p/discover/udp_test.go')
-rw-r--r-- | p2p/discover/udp_test.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/p2p/discover/udp_test.go b/p2p/discover/udp_test.go index 378edaaa7..167a5439b 100644 --- a/p2p/discover/udp_test.go +++ b/p2p/discover/udp_test.go @@ -159,12 +159,12 @@ func TestUDP_findnode(t *testing.T) { // ensure there's a bond with the test node, // findnode won't be accepted otherwise. - test.table.db.updateNode(&Node{ - ID: PubkeyID(&test.remotekey.PublicKey), - IP: test.remoteaddr.IP, - UDP: uint16(test.remoteaddr.Port), - TCP: 99, - }) + test.table.db.updateNode(newNode( + PubkeyID(&test.remotekey.PublicKey), + test.remoteaddr.IP, + uint16(test.remoteaddr.Port), + 99, + )) // check that closest neighbors are returned. test.packetIn(nil, findnodePacket, &findnode{Target: testTarget, Expiration: futureExp}) test.waitPacketOut(func(p *neighbors) { @@ -211,8 +211,12 @@ func TestUDP_findnodeMultiReply(t *testing.T) { MustParseNode("enode://9bffefd833d53fac8e652415f4973bee289e8b1a5c6c4cbe70abf817ce8a64cee11b823b66a987f51aaa9fba0d6a91b3e6bf0d5a5d1042de8e9eeea057b217f8@10.0.1.36:30301?discport=17"), MustParseNode("enode://1b5b4aa662d7cb44a7221bfba67302590b643028197a7d5214790f3bac7aaa4a3241be9e83c09cf1f6c69d007c634faae3dc1b1221793e8446c0b3a09de65960@10.0.1.16:30303"), } - test.packetIn(nil, neighborsPacket, &neighbors{Expiration: futureExp, Nodes: list[:2]}) - test.packetIn(nil, neighborsPacket, &neighbors{Expiration: futureExp, Nodes: list[2:]}) + rpclist := make([]rpcNode, len(list)) + for i := range list { + rpclist[i] = nodeToRPC(list[i]) + } + test.packetIn(nil, neighborsPacket, &neighbors{Expiration: futureExp, Nodes: rpclist[:2]}) + test.packetIn(nil, neighborsPacket, &neighbors{Expiration: futureExp, Nodes: rpclist[2:]}) // check that the sent neighbors are all returned by findnode select { |