swarm/network: remove everything related to pivot from Simulation

As the concept and the related functionality was not used anywhere.
This commit is contained in:
Ferenc Szabo 2018-12-20 15:06:41 +01:00
parent f8c18644a9
commit 52afcb09f6
3 changed files with 0 additions and 59 deletions

View file

@ -241,25 +241,6 @@ func (s *Simulation) UploadSnapshot(snapshotFile string, opts ...AddNodeOption)
return nil
}
// SetPivotNode sets the NodeID of the network's pivot node.
// Pivot node is just a specific node that should be treated
// differently then other nodes in test. SetPivotNode and
// PivotNodeID are just a convenient functions to set and
// retrieve it.
func (s *Simulation) SetPivotNode(id enode.ID) {
s.mu.Lock()
defer s.mu.Unlock()
s.pivotNodeID = &id
}
// PivotNodeID returns NodeID of the pivot node set by
// Simulation.SetPivotNode method.
func (s *Simulation) PivotNodeID() (id *enode.ID) {
s.mu.Lock()
defer s.mu.Unlock()
return s.pivotNodeID
}
// StartNode starts a node by NodeID.
func (s *Simulation) StartNode(id enode.ID) (err error) {
return s.Net.Start(id)

View file

@ -314,45 +314,6 @@ func TestUploadSnapshot(t *testing.T) {
log.Debug("Done.")
}
func TestPivotNode(t *testing.T) {
sim := New(noopServiceFuncMap)
defer sim.Close()
id, err := sim.AddNode()
if err != nil {
t.Fatal(err)
}
id2, err := sim.AddNode()
if err != nil {
t.Fatal(err)
}
if sim.PivotNodeID() != nil {
t.Error("expected no pivot node")
}
sim.SetPivotNode(id)
pid := sim.PivotNodeID()
if pid == nil {
t.Error("pivot node not set")
} else if *pid != id {
t.Errorf("expected pivot node %s, got %s", id, *pid)
}
sim.SetPivotNode(id2)
pid = sim.PivotNodeID()
if pid == nil {
t.Error("pivot node not set")
} else if *pid != id2 {
t.Errorf("expected pivot node %s, got %s", id2, *pid)
}
}
func TestStartStopNode(t *testing.T) {
sim := New(noopServiceFuncMap)
defer sim.Close()

View file

@ -46,7 +46,6 @@ type Simulation struct {
serviceNames []string
cleanupFuncs []func()
buckets map[enode.ID]*sync.Map
pivotNodeID *enode.ID
shutdownWG sync.WaitGroup
done chan struct{}
mu sync.RWMutex