fix address query handler

This commit is contained in:
Victor Shyba 2018-10-17 16:07:52 -03:00 committed by Lex Berezhny
parent 90e0694d2e
commit 8db7c15aa1

View file

@ -523,18 +523,15 @@ class LBRYcrdAddressQueryHandler:
self.peer = peer
request_handler.register_query_handler(self, self.query_identifiers)
@defer.inlineCallbacks
def handle_queries(self, queries):
def create_response(address):
if self.query_identifiers[0] in queries:
future = self.wallet.get_unused_address_for_peer(self.peer)
address = yield defer.Deferred.fromFuture(asyncio.ensure_future(future))
self.address = address
fields = {'lbrycrd_address': address}
return fields
if self.query_identifiers[0] in queries:
d = self.wallet.get_unused_address_for_peer(self.peer)
d.addCallback(create_response)
return d
if self.address is None:
raise Exception("Expected a request for an address, but did not receive one")
else:
return defer.succeed({})
return {}