check network exists on jsonrpc_status call

This commit is contained in:
jobevers 2017-02-21 15:30:36 -06:00
parent d4900fd607
commit d359949a5c
2 changed files with 4 additions and 1 deletions

View file

@ -8,6 +8,8 @@ can and probably will change functionality and break backwards compatability
at anytime.
## [Unreleased]
### Changed
* Add blockchain status to jsonrpc_status
## [0.8.7] - 2017-02-21

View file

@ -1116,7 +1116,8 @@ class Daemon(AuthJSONRPCServer):
Returns:
daemon status
"""
has_wallet = self.session and self.session.wallet
# on startup, the wallet or network won't be available but we still need this call to work
has_wallet = self.session and self.session.wallet and self.session.wallet.network
local_height = self.session.wallet.network.get_local_height() if has_wallet else 0
remote_height = self.session.wallet.network.get_server_height() if has_wallet else 0
best_hash = (yield self.session.wallet.get_best_blockhash()) if has_wallet else None