swarm/network: Fix NewAddrFromNodeId

Signed-off-by: Lewis Marshall <lewis@lmars.net>
This commit is contained in:
Lewis Marshall 2017-05-17 10:40:23 -07:00
parent 584d6e7876
commit c9d42b9cf3

View file

@ -20,6 +20,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"net"
"sync" "sync"
"time" "time"
@ -347,5 +348,8 @@ func NewNodeIdFromAddr(addr Addr) *adapters.NodeId {
// the overlay address is derived as the hash of the nodeId // the overlay address is derived as the hash of the nodeId
func NewAddrFromNodeId(n *adapters.NodeId) *bzzAddr { func NewAddrFromNodeId(n *adapters.NodeId) *bzzAddr {
id := n.NodeID id := n.NodeID
return &bzzAddr{crypto.Keccak256(id[:]), id[:]} return &bzzAddr{
OAddr: crypto.Keccak256(id[:]),
UAddr: []byte(discover.NewNode(id, net.IP{127, 0, 0, 1}, 30303, 30303).String()),
}
} }