Skip to content

Commit 2198c38

Browse files
committed
Tweak the way node RPC url is configured
1 parent 4f4b4a1 commit 2198c38

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

config.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ def instance(cls) -> 'Config':
2929
parser.add_argument('-p', '--prefix', type=str, help='Command prefix for bot commands', default='!')
3030
parser.add_argument('-l', '--log-file', type=str, help='Log file location', default='/tmp/graham_bot.log')
3131
parser.add_argument('-s', '--status', type=str, help="The bot's 'playing status'", default=None, required=False)
32-
parser.add_argument('-u', '--node-url', type=str, help='URL of the node', default='[::1]')
33-
parser.add_argument('-np', '--node-port', type=int, help='Port of the node', default=7072 if Env.banano() else 7076)
32+
parser.add_argument('-u', '--node-url', type=str, help='URL of the node, e.g.: http://[::1]:7072', default='http://[::1]:7072' if Env.banano() else 'http://[::1]:7076')
3433
parser.add_argument('--debug', action='store_true', help='Runs in debug mode if specified', default=False)
3534
options, unknown = parser.parse_known_args()
3635

@@ -53,7 +52,6 @@ def instance(cls) -> 'Config':
5352
exit(1)
5453

5554
cls.node_url = options.node_url
56-
cls.node_port = options.node_port
5755
return cls._instance
5856

5957
def has_yaml(self) -> bool:

rpc/client.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ def __init__(self):
1414
def instance(cls) -> 'RPCClient':
1515
if cls._instance is None:
1616
cls._instance = cls.__new__(cls)
17-
cls.node_url = Config.instance().node_url
18-
cls.node_port = Config.instance().node_port
1917
cls.wallet_id = Config.instance().wallet
20-
cls.ipv6 = '::' in cls.node_url
21-
cls.connector = aiohttp.TCPConnector(family=socket.AF_INET6 if cls.ipv6 else socket.AF_INET,resolver=aiohttp.AsyncResolver())
18+
cls.node_url = Config.instance().node_url
19+
cls.connector = aiohttp.TCPConnector(family=0 ,resolver=aiohttp.AsyncResolver())
2220
cls.session = aiohttp.ClientSession(connector=cls.connector, json_serialize=json.dumps)
2321
return cls._instance
2422

@@ -30,7 +28,7 @@ async def close(cls):
3028
cls._instance = None
3129

3230
async def make_request(self, req_json: dict):
33-
async with self.session.post("http://{0}:{1}".format(self.node_url, self.node_port),json=req_json, timeout=300) as resp:
31+
async with self.session.post(self.node_url ,json=req_json, timeout=300) as resp:
3432
return await resp.json()
3533

3634
async def account_create(self) -> str:

0 commit comments

Comments
 (0)