fix wallet component

This commit is contained in:
Lex Berezhny 2018-10-16 16:00:12 -04:00
parent 3019a1c222
commit e02e2a249a
2 changed files with 4 additions and 5 deletions

View file

@ -329,19 +329,18 @@ class WalletComponent(Component):
def component(self):
return self.wallet_manager
@defer.inlineCallbacks
def get_status(self):
if self.wallet_manager:
local_height = self.wallet_manager.network.get_local_height()
remote_height = self.wallet_manager.network.get_server_height()
best_hash = yield f2d(self.wallet_manager.get_best_blockhash())
defer.returnValue({
best_hash = self.wallet_manager.get_best_blockhash()
return {
'blocks': max(local_height, 0),
'blocks_behind': max(remote_height - local_height, 0),
'best_blockhash': best_hash,
'is_encrypted': self.wallet_manager.wallet.use_encryption,
'is_locked': not self.wallet_manager.is_wallet_unlocked,
})
}
@defer.inlineCallbacks
def start(self):

View file

@ -457,7 +457,7 @@ class AuthJSONRPCServer(AuthorizedBase):
else:
d = defer.succeed(result)
except:
d = Failure(captureVars=Deferred.debug)
d = defer.fail(Failure(captureVars=Deferred.debug))
# finished_deferred will callback when the request is finished
# and errback if something went wrong. If the errback is