11""" Stuff to control a bitcoind-instance.
22"""
3+
34import atexit
45import json
56import logging
67import os
78import platform
8- import re
99import shutil
1010import signal
1111import subprocess
@@ -48,7 +48,7 @@ def __init__(
4848
4949 @property
5050 def ipaddress (self ):
51- if self ._ipaddress == None :
51+ if self ._ipaddress is None :
5252 raise Exception ("ipadress is none" )
5353 else :
5454 return self ._ipaddress
@@ -73,7 +73,7 @@ def get_rpc(self):
7373 return rpc
7474
7575 def render_url (self , password_mask = False ):
76- if password_mask == True :
76+ if password_mask is True :
7777 password = "xxxxxx"
7878 else :
7979 password = self .rpcpassword
@@ -226,7 +226,7 @@ def stop_node(self):
226226
227227 def mine (self , address = None , block_count = 1 ):
228228 """Does mining to the attached address with as many as block_count blocks"""
229- if address == None :
229+ if address is None :
230230 if self .node_impl == "bitcoin" :
231231 address = "mruae2834buqxk77oaVpephnA5ZAxNNJ1r"
232232 else :
@@ -358,17 +358,14 @@ def construct_node_cmd(
358358 if network != "mainnet" and network != "main" :
359359 btcd_cmd += " -{} " .format (network )
360360 btcd_cmd += " -fallbackfee=0.0002 "
361- btcd_cmd += " -port={} -rpcport={} -rpcbind=0.0.0.0 -rpcbind=0.0.0.0" .format (
362- rpcconn .rpcport - 1 , rpcconn .rpcport
363- )
361+ btcd_cmd += " -port={} -rpcport={}" .format (rpcconn .rpcport - 1 , rpcconn .rpcport )
364362 btcd_cmd += " -rpcuser={} -rpcpassword={} " .format (
365363 rpcconn .rpcuser , rpcconn .rpcpassword
366364 )
367- btcd_cmd += " -rpcallowip=0.0.0.0/0 -rpcallowip=172.17.0.0/16 "
368365 if not run_docker :
369366 if not log_stdout :
370367 btcd_cmd += " -noprinttoconsole"
371- if datadir == None :
368+ if datadir is None :
372369 datadir = tempfile .mkdtemp (prefix = "bitcoind_datadir" )
373370 btcd_cmd += ' -datadir="{}" ' .format (datadir )
374371 if extra_args :
@@ -412,7 +409,7 @@ def _start_node(
412409 log_stdout = False ,
413410 extra_args = [],
414411 ):
415- if datadir == None :
412+ if datadir is None :
416413 datadir = tempfile .mkdtemp (
417414 prefix = f"specter_{ self .node_impl } _regtest_plain_datadir_"
418415 )
@@ -484,7 +481,7 @@ def cleanup_node(self, cleanup_hard=None, datadir=None):
484481 if not hasattr (self , "datadir" ):
485482 self .datadir = None
486483
487- if cleanup_hard == None :
484+ if cleanup_hard is None :
488485 cleanup_hard = self .cleanup_hard
489486 if not hasattr (self , "node_proc" ):
490487 logger .info ("node process was not running" )
0 commit comments