Push network calls into network module
Eventually all network calls should go through the network module without resorting to using raw protocol strings. This, then, makes adding an other backend easier. Please note that the behaviour slightly changed. Initially the caller received an unmodified response from the ElectrumX server. In it the scripthash is present. This change replaces that scripthash with the original address.
This commit is contained in:
@@ -647,8 +647,7 @@ class Commands:
|
|||||||
util.print_error('Got Response for %s' % address)
|
util.print_error('Got Response for %s' % address)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
util.print_error(str(e))
|
util.print_error(str(e))
|
||||||
h = self.network.addr_to_scripthash(address)
|
self.network.subscribe_to_addresses([addr], callback)
|
||||||
self.network.send([('blockchain.scripthash.subscribe', [h])], callback)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@command('wn')
|
@command('wn')
|
||||||
|
|||||||
@@ -84,9 +84,7 @@ class WsClientThread(util.DaemonThread):
|
|||||||
l = self.subscriptions.get(addr, [])
|
l = self.subscriptions.get(addr, [])
|
||||||
l.append((ws, amount))
|
l.append((ws, amount))
|
||||||
self.subscriptions[addr] = l
|
self.subscriptions[addr] = l
|
||||||
h = self.network.addr_to_scripthash(addr)
|
self.network.subscribe_to_addresses([addr], self.response_queue.put)
|
||||||
self.network.send([('blockchain.scripthash.subscribe', [h])], self.response_queue.put)
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
threading.Thread(target=self.reading_thread).start()
|
threading.Thread(target=self.reading_thread).start()
|
||||||
|
|||||||
Reference in New Issue
Block a user