From 5a83114efd96bb8debeb3a3fccc3e054069e5400 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 10 Feb 2014 20:59:31 +0100 Subject: [PATCH] Seed bootstrapping added --- ethereum.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ethereum.go b/ethereum.go index cc3f1695b..cac442dfc 100644 --- a/ethereum.go +++ b/ethereum.go @@ -6,8 +6,10 @@ import ( "github.com/ethereum/ethdb-go" "github.com/ethereum/ethutil-go" "github.com/ethereum/ethwire-go" + "io/ioutil" "log" "net" + "net/http" "strconv" "sync" "sync/atomic" @@ -243,6 +245,20 @@ func (s *Ethereum) Start() { // Start the tx pool s.TxPool.Start() + + resp, err := http.Get("http://www.ethereum.org/servers.poc2.txt") + if err != nil { + log.Println("Fetching seed failed:", err) + return + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + log.Println("Reading seed failed:", err) + return + } + + s.ConnectToPeer(string(body)) } func (s *Ethereum) peerHandler(listener net.Listener) {