Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Fix testnet seeds (#807)
Browse files Browse the repository at this point in the history
* Update testnet seeds

* add changelog
  • Loading branch information
ixje authored Jan 10, 2019
1 parent 75a5f74 commit 1160696
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ All notable changes to this project are documented in this file.
- Fix ``getcontractstate`` JSON output to match neo-cli 2.9.2 `#746 <https://github.com/CityOfZion/neo-python/issues/746>`_
- Fix ``getrawtransaction`` JSON output to match neo-cli 2.9.2 `#751 <https://github.com/CityOfZion/neo-python/pull/751>`_
- Refactor CLI to be more user friendly and support better future extensibility `#805 <https://github.com/CityOfZion/neo-python/pull/805`_

- Update TestNet seeds

[0.8.2] 2018-10-31
-------------------
Expand Down
3 changes: 3 additions & 0 deletions neo/Network/NodeLeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from twisted.internet.protocol import ReconnectingClientFactory
from twisted.internet import reactor, task
from neo.logging import log_manager
from neo.Network.utils import is_ip_address, hostname_to_ip

logger = log_manager.getLogger('network')

Expand Down Expand Up @@ -124,6 +125,8 @@ def Start(self):
start_delay = 0
for bootstrap in settings.SEED_LIST:
host, port = bootstrap.split(":")
if not is_ip_address(host):
host = hostname_to_ip(host)
setupConnDeferred = task.deferLater(reactor, start_delay, self.SetupConnection, host, port)
setupConnDeferred.addErrback(self.onSetupConnectionErr)
start_delay += 1
Expand Down
15 changes: 15 additions & 0 deletions neo/Network/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import socket
import ipaddress


def hostname_to_ip(hostname):
return socket.gethostbyname(hostname)


def is_ip_address(hostname):
host = hostname.split(':')[0]
try:
ip = ipaddress.ip_address(host)
return True
except ValueError:
return False
20 changes: 15 additions & 5 deletions neo/data/protocol.testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@
"AddressVersion": 23,
"Magic": 1953787457,
"SeedList": [
"13.58.169.218:20333",
"13.58.33.157:20333",
"18.222.161.128:20333",
"18.191.171.240:20333",
"18.222.168.189:20333"
"seed1.ngd.network:20333",
"seed2.ngd.network:20333",
"seed3.ngd.network:20333",
"seed4.ngd.network:20333",
"seed5.ngd.network:20333",
"seed6.ngd.network:20333",
"seed7.ngd.network:20333",
"seed8.ngd.network:20333",
"seed9.ngd.network:20333",
"seed10.ngd.network:20333",
"seed1.neo.org:20333",
"seed2.neo.org:20333",
"seed3.neo.org:20333",
"seed4.neo.org:20333",
"seed5.neo.org:20333"
],
"RPCList": [
"http://18.221.221.195:8880",
Expand Down

0 comments on commit 1160696

Please sign in to comment.