aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-15 20:00:09 +0800
committerobscuren <geffobscura@gmail.com>2014-12-15 20:00:29 +0800
commit56dac74f71d4d1fffa3e240c7d3cee803dec788d (patch)
tree50ad3adbb32c6cea0e74a69a313d39dc54b4188b /eth
parentc7bc684909ab3d135d25a718d5ff2c725816e0fc (diff)
downloadgo-tangerine-56dac74f71d4d1fffa3e240c7d3cee803dec788d.tar
go-tangerine-56dac74f71d4d1fffa3e240c7d3cee803dec788d.tar.gz
go-tangerine-56dac74f71d4d1fffa3e240c7d3cee803dec788d.tar.bz2
go-tangerine-56dac74f71d4d1fffa3e240c7d3cee803dec788d.tar.lz
go-tangerine-56dac74f71d4d1fffa3e240c7d3cee803dec788d.tar.xz
go-tangerine-56dac74f71d4d1fffa3e240c7d3cee803dec788d.tar.zst
go-tangerine-56dac74f71d4d1fffa3e240c7d3cee803dec788d.zip
made mist in a compilable, workable state using the new refactored packages
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go4
-rw-r--r--eth/peer_util.go23
2 files changed, 27 insertions, 0 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 1d991b9ef..e275238bd 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -147,6 +147,10 @@ func (s *Ethereum) Peers() []*p2p.Peer {
return s.server.Peers()
}
+func (s *Ethereum) MaxPeers() int {
+ return s.server.MaxPeers
+}
+
// Start the ethereum
func (s *Ethereum) Start(seed bool) error {
err := s.server.Start()
diff --git a/eth/peer_util.go b/eth/peer_util.go
new file mode 100644
index 000000000..6cf80cde2
--- /dev/null
+++ b/eth/peer_util.go
@@ -0,0 +1,23 @@
+package eth
+
+import (
+ "encoding/json"
+
+ "github.com/ethereum/go-ethereum/ethutil"
+)
+
+func WritePeers(path string, addresses []string) {
+ if len(addresses) > 0 {
+ data, _ := json.MarshalIndent(addresses, "", " ")
+ ethutil.WriteFile(path, data)
+ }
+}
+
+func ReadPeers(path string) (ips []string, err error) {
+ var data string
+ data, err = ethutil.ReadAllFile(path)
+ if err != nil {
+ json.Unmarshal([]byte(data), &ips)
+ }
+ return
+}