X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=blobdiff_plain;f=backends%2Flibbitcoin%2F__init__.py;h=f1664c9368bff5caf24a48a85765602489eb894f;hp=8e511693e0ece7bf763d5a18283c8d441f1cbd88;hb=4565e5be9d30d3d28f9319f613cd5311081fc4d7;hpb=608eb0b73118735c11f10468b51d607ac6d02232 diff --git a/backends/libbitcoin/__init__.py b/backends/libbitcoin/__init__.py index 8e51169..f1664c9 100644 --- a/backends/libbitcoin/__init__.py +++ b/backends/libbitcoin/__init__.py @@ -89,7 +89,7 @@ class MonitorAddress: self.cache.clear(affected_addrs) self.notify(affected_addrs) - def tx_confirmed(self, tx_desc): + def tx_confirmed(self, tx): tx_hash, previous_outputs, addrs = self.unpack(tx) with self.lock: affected_addrs = self.affected[tx_hash] @@ -109,16 +109,14 @@ class MonitorAddress: del self.monitor_output[prevout] def notify(self, affected_addrs): - templ_response = {"id": None, - "method": "blockchain.address.subscribe", - "params": []} service = self.backend.mempool_service chain = self.backend.blockchain txpool = self.backend.transaction_pool memory_buff = self.backend.memory_buffer for address in affected_addrs: - response = templ_response.copy() - response["params"].append(address) + response = {"id": None, + "method": "blockchain.address.subscribe", + "params": [str(address)]} history.payment_history(service, chain, txpool, memory_buff, address, bind(self.send_notify, _1, _2, response)) @@ -139,6 +137,7 @@ class MonitorAddress: if ec: print "Error: Monitor.send_notify()", ec return + assert len(response["params"]) == 1 response["params"].append(self.mempool_n(result)) self.processor.push_response(response) @@ -351,7 +350,7 @@ class BlockchainProcessor(Processor): self.broadcast_transaction(request) def broadcast_transaction(self, request): - raw_tx = bitcoin.data_chunk(str(request["params"])) + raw_tx = bitcoin.data_chunk(str(request["params"][0])) exporter = bitcoin.satoshi_exporter() try: tx = exporter.load_transaction(raw_tx)