diff --git a/node/config_test.go b/node/config_test.go index c0eda72c23..b81d3d6120 100644 --- a/node/config_test.go +++ b/node/config_test.go @@ -25,6 +25,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/p2p" ) // Tests that datadirs can be successfully created, be them manually configured @@ -109,7 +110,7 @@ func TestNodeKeyPersistency(t *testing.T) { if err != nil { t.Fatalf("failed to generate one-shot node key: %v", err) } - config := &Config{Name: "unit-test", DataDir: dir, PrivateKey: key} + config := &Config{Name: "unit-test", DataDir: dir, P2P: p2p.Config{PrivateKey: key}} config.NodeKey() if _, err := os.Stat(filepath.Join(keyfile)); err == nil { t.Fatalf("one-shot node key persisted to data directory") diff --git a/node/node_example_test.go b/node/node_example_test.go index d2872cf381..ee06f4065c 100644 --- a/node/node_example_test.go +++ b/node/node_example_test.go @@ -22,7 +22,6 @@ import ( "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/rpc" ) @@ -42,23 +41,8 @@ func (s *SampleService) Start(*p2p.Server) error { fmt.Println("Service starti func (s *SampleService) Stop() error { fmt.Println("Service stopping..."); return nil } func ExampleService() { - // Create a network node to run protocols with the default values. The below list - // is only used to display each of the configuration options. All of these could - // have been omitted if the default behavior is desired. - nodeConfig := &node.Config{ - DataDir: "", // Empty uses ephemeral storage - PrivateKey: nil, // Nil generates a node key on the fly - Name: "", // Any textual node name is allowed - NoDiscovery: false, // Can disable discovering remote nodes - BootstrapNodes: []*discover.Node{}, // List of bootstrap nodes to use - ListenAddr: ":0", // Network interface to listen on - NAT: nil, // UPnP port mapper to use for crossing firewalls - Dialer: nil, // Custom dialer to use for establishing peer connections - NoDial: false, // Can prevent this node from dialing out - MaxPeers: 0, // Number of peers to allow - MaxPendingPeers: 0, // Number of peers allowed to handshake concurrently - } - stack, err := node.New(nodeConfig) + // Create a network node to run protocols with the default values. + stack, err := node.New(&node.Config{}) if err != nil { log.Fatalf("Failed to create network node: %v", err) } diff --git a/node/node_test.go b/node/node_test.go index 408d4cfcbc..2880efa619 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -35,8 +35,8 @@ var ( func testNodeConfig() *Config { return &Config{ - PrivateKey: testNodeKey, - Name: "test node", + Name: "test node", + P2P: p2p.Config{PrivateKey: testNodeKey}, } }