mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
cmd/swarm/swarm-snapshot, swarm/network/simulations: removed redundant connection event check, fixed lint error
This commit is contained in:
parent
b866ba97b8
commit
e37ade0671
2 changed files with 4 additions and 21 deletions
|
|
@ -38,8 +38,6 @@ import (
|
|||
cli "gopkg.in/urfave/cli.v1"
|
||||
)
|
||||
|
||||
const noConnectionTimeout = 1 * time.Second
|
||||
|
||||
// create is used as the entry function for "create" app command.
|
||||
func create(ctx *cli.Context) error {
|
||||
log.PrintOrigins(true)
|
||||
|
|
@ -83,20 +81,6 @@ func createSnapshot(filename string, nodes int, services []string) (err error) {
|
|||
return fmt.Errorf("add nodes: %v", err)
|
||||
}
|
||||
|
||||
// wait for two some time to ensure no connections
|
||||
// are established
|
||||
events := make(chan *simulations.Event)
|
||||
sub := sim.Net.Events().Subscribe(events)
|
||||
select {
|
||||
case ev := <-events:
|
||||
//only catch node up events
|
||||
if ev.Type == simulations.EventTypeConn {
|
||||
return errors.New("unexpected connection events")
|
||||
}
|
||||
case <-time.After(noConnectionTimeout):
|
||||
}
|
||||
sub.Unsubscribe()
|
||||
|
||||
err = sim.Net.ConnectNodesRing(nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("connect nodes: %v", err)
|
||||
|
|
|
|||
|
|
@ -82,11 +82,10 @@ func getDbStore(nodeID string) (*state.DBStore, error) {
|
|||
}
|
||||
|
||||
var (
|
||||
nodeCount = flag.Int("nodes", 10, "number of nodes to create (default 10)")
|
||||
initCount = flag.Int("conns", 1, "number of originally connected peers (default 1)")
|
||||
loglevel = flag.Int("loglevel", 3, "verbosity of logs")
|
||||
rawlog = flag.Bool("rawlog", false, "remove terminal formatting from logs")
|
||||
serviceOverride = flag.String("services", "", "remove or add services to the node snapshot; prefix with \"+\" to add, \"-\" to remove; example: +pss,-discovery")
|
||||
nodeCount = flag.Int("nodes", 10, "number of nodes to create (default 10)")
|
||||
initCount = flag.Int("conns", 1, "number of originally connected peers (default 1)")
|
||||
loglevel = flag.Int("loglevel", 3, "verbosity of logs")
|
||||
rawlog = flag.Bool("rawlog", false, "remove terminal formatting from logs")
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue