diff options
author | Felix Lange <fjl@twurst.com> | 2015-04-18 07:50:31 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-04-30 20:57:33 +0800 |
commit | fc747ef4a649cd90aec5193a8af6b7accb5eb03f (patch) | |
tree | b81f4b1fb00abd2bf05b4d586b0b3f08d2011cd5 /p2p/discover/database_test.go | |
parent | 3fef60190384106af390dd23a65384b9cc6e4a28 (diff) | |
download | dexon-fc747ef4a649cd90aec5193a8af6b7accb5eb03f.tar.gz dexon-fc747ef4a649cd90aec5193a8af6b7accb5eb03f.tar.zst dexon-fc747ef4a649cd90aec5193a8af6b7accb5eb03f.zip |
p2p/discover: new endpoint format
This commit changes the discovery protocol to use the new "v4" endpoint
format, which allows for separate UDP and TCP ports and makes it
possible to discover the UDP address after NAT.
Diffstat (limited to 'p2p/discover/database_test.go')
-rw-r--r-- | p2p/discover/database_test.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/p2p/discover/database_test.go b/p2p/discover/database_test.go index f327cf73b..0cc0dec32 100644 --- a/p2p/discover/database_test.go +++ b/p2p/discover/database_test.go @@ -6,6 +6,7 @@ import ( "net" "os" "path/filepath" + "reflect" "testing" "time" ) @@ -86,9 +87,10 @@ func TestNodeDBInt64(t *testing.T) { func TestNodeDBFetchStore(t *testing.T) { node := &Node{ - ID: MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"), - IP: net.IP([]byte{192, 168, 0, 1}), - TCPPort: 30303, + ID: MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"), + IP: net.IP([]byte{192, 168, 0, 1}), + UDP: 30303, + TCP: 30303, } inst := time.Now() @@ -124,7 +126,7 @@ func TestNodeDBFetchStore(t *testing.T) { } if stored := db.node(node.ID); stored == nil { t.Errorf("node: not found") - } else if !bytes.Equal(stored.ID[:], node.ID[:]) || !stored.IP.Equal(node.IP) || stored.TCPPort != node.TCPPort { + } else if !reflect.DeepEqual(stored, node) { t.Errorf("node: data mismatch: have %v, want %v", stored, node) } } |