X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=blobdiff_plain;f=backends%2Flibbitcoin%2F__init__.py;h=aa13238234461c1e2128c17f65b59a6245276cf0;hp=ea7a631439f63a3ae901005ca46ab00486feacce;hb=dc6b846eb9e11146218abf3f13b8f5c36817bbc7;hpb=4f03cb3b82ce7ddd1f413e39931c782c13bf9547 diff --git a/backends/libbitcoin/__init__.py b/backends/libbitcoin/__init__.py index ea7a631..aa13238 100644 --- a/backends/libbitcoin/__init__.py +++ b/backends/libbitcoin/__init__.py @@ -109,10 +109,18 @@ class NumblocksSubscribe: def reorganize(self, ec, fork_point, arrivals, replaced): latest = fork_point + len(arrivals) self.latest.set(latest) - response = {"method": "numblocks.subscribe", "result": latest} + response = {"id": None, "method": "blockchain.numblocks.subscribe", + "result": latest} self.processor.push_response(response) self.backend.blockchain.subscribe_reorganize(self.reorganize) + def subscribe(self, request): + latest = self.latest.get() + response = {"id": request["id"], + "method": "blockchain.numblocks.subscribe", + "result": latest, + "error": None} + self.processor.push_response(response) class AddressGetHistory: @@ -174,7 +182,7 @@ class BlockchainProcessor(Processor): def process(self, request): print "New request (lib)", request if request["method"] == "blockchain.numblocks.subscribe": - self.numblocks_subscribe.subscribe(session, request) + self.numblocks_subscribe.subscribe(request) elif request["method"] == "blockchain.address.subscribe": pass elif request["method"] == "blockchain.address.get_history":