address PR comments

This commit is contained in:
Elad Nachmias 2018-12-13 21:16:17 +05:30
parent 376bb369e0
commit 65f1e816c5
3 changed files with 5 additions and 10 deletions

View file

@ -29,9 +29,9 @@ var (
) )
// ConnectToPivotNode connects the node with provided NodeID // ConnectToPivotNode connects the node with provided NodeID
// to the pivot node, already set by Connections.SetPivotNode method. // to the pivot node, already set by Network.SetPivotNode method.
// It is useful when constructing a star network topology // It is useful when constructing a star network topology
// when Connections adds and removes nodes dynamically. // when Network adds and removes nodes dynamically.
func (net *Network) ConnectToPivotNode(id enode.ID) (err error) { func (net *Network) ConnectToPivotNode(id enode.ID) (err error) {
pivot := net.PivotNodeID() pivot := net.PivotNodeID()
if pivot == nil { if pivot == nil {

View file

@ -91,12 +91,7 @@ func TestConnectToLastNode(t *testing.T) {
} }
if net.GetConn(first, id) != nil { if net.GetConn(first, id) != nil {
t.Errorf( t.Errorf("connection must not exits with node(ind: %v, id: %v)", i, id)
"connection must not exits with node(ind: %v, id: %v)",
i,
id,
)
} }
} }

View file

@ -248,7 +248,7 @@ func runSim(conf *synctestConfig, ctx context.Context, sim *simulation.Simulatio
//get the node at that index //get the node at that index
//this is the node selected for upload //this is the node selected for upload
node := sim.RandomUpNode() node := sim.Net.RandomUpNode()
item, ok := sim.NodeItem(node.ID(), bucketKeyStore) item, ok := sim.NodeItem(node.ID(), bucketKeyStore)
if !ok { if !ok {
return fmt.Errorf("No localstore") return fmt.Errorf("No localstore")
@ -453,7 +453,7 @@ func testSyncingViaDirectSubscribe(t *testing.T, chunkCount int, nodeCount int)
} }
} }
//select a random node for upload //select a random node for upload
node := sim.RandomUpNode() node := sim.Net.RandomUpNode()
item, ok := sim.NodeItem(node.ID(), bucketKeyStore) item, ok := sim.NodeItem(node.ID(), bucketKeyStore)
if !ok { if !ok {
return fmt.Errorf("No localstore") return fmt.Errorf("No localstore")