X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=lib%2Fnetwork.py;h=f07846aa09fe093afc2868229f5ef2348486d952;hb=8997c760a2cdfdc4a78e093c143788938fa68407;hp=51b840799fc16d14e8c04d83d732b3f6a1c43907;hpb=80a988e3375c6b2c1e6d307275de3ac8038236f3;p=electrum-nvc.git diff --git a/lib/network.py b/lib/network.py index 51b8407..f07846a 100644 --- a/lib/network.py +++ b/lib/network.py @@ -72,7 +72,9 @@ from simple_config import SimpleConfig 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 @@ -371,8 +373,11 @@ class Network(threading.Thread): def on_header(self, i, r): result = r.get('result') - if not result: return + if not result: + return height = result.get('block_height') + if not height: + return self.heights[i.server] = height self.merkle_roots[i.server] = result.get('merkle_root') self.utxo_roots[i.server] = result.get('utxo_root')