print_help(parser)
-def run_command(cmd, password=None, args=[]):
- import socket
+def run_command(cmd, password=None, args=None):
+ if args is None:
+ args = [] # Do not use mutables as default values!
if cmd.requires_network and not options.offline:
network = NetworkProxy(config)
if not network.start(start_daemon= (True if cmd.name!='daemon' else False)):
print "Daemon not running"
sys.exit(1)
-
-
if wallet:
wallet.start_threads(network)
wallet.update()
return h
- def get_target(self, index, chain=[]):
+ def get_target(self, index, chain=None):
+ if chain is None:
+ chain = [] # Do not use mutables as default values!
max_target = 0x00000000FFFF0000000000000000000000000000000000000000000000000000
if index == 0: return 0x1d00ffff, max_target
# connects to daemon
# sends requests, runs callbacks
- def __init__(self, config = {}):
+ def __init__(self, config=None):
+ if config is None:
+ config = {} # Do not use mutables as default arguments!
threading.Thread.__init__(self)
self.daemon = True
self.config = SimpleConfig(config) if type(config) == type({}) else config
class Network(threading.Thread):
- def __init__(self, config = {}):
+ def __init__(self, config=None):
+ if config is None:
+ config = {} # Do not use mutables as default values!
threading.Thread.__init__(self)
self.daemon = True
self.config = SimpleConfig(config) if type(config) == type({}) else config