status: wallet returns all servers rather than just available
This commit is contained in:
parent
4e13cf1d85
commit
6e3a25d255
1 changed files with 11 additions and 3 deletions
|
@ -115,13 +115,13 @@ class WalletComponent(Component):
|
||||||
best_hash = self.wallet_manager.get_best_blockhash()
|
best_hash = self.wallet_manager.get_best_blockhash()
|
||||||
progress = min(max(math.ceil(float(local_height) / float(remote_height) * 100), 0), 100)
|
progress = min(max(math.ceil(float(local_height) / float(remote_height) * 100), 0), 100)
|
||||||
return {
|
return {
|
||||||
'connected_servers': [
|
'servers': [
|
||||||
{
|
{
|
||||||
'host': session.server[0],
|
'host': session.server[0],
|
||||||
'port': session.server[1],
|
'port': session.server[1],
|
||||||
'latency': round(session.connection_latency, 2),
|
'latency': round(session.connection_latency, 2) if session.connection_latency else None,
|
||||||
|
'availability': session.available,
|
||||||
} for session in sessions
|
} for session in sessions
|
||||||
if session and session.available
|
|
||||||
],
|
],
|
||||||
'headers_synchronization_progress': progress,
|
'headers_synchronization_progress': progress,
|
||||||
'blocks': max(local_height, 0),
|
'blocks': max(local_height, 0),
|
||||||
|
@ -132,6 +132,14 @@ class WalletComponent(Component):
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
return {
|
return {
|
||||||
|
'servers': [
|
||||||
|
{
|
||||||
|
'host': session.server[0],
|
||||||
|
'port': session.server[1],
|
||||||
|
'latency': round(session.connection_latency, 2) if session.connection_latency else None,
|
||||||
|
'availability': session.available,
|
||||||
|
} for session in sessions
|
||||||
|
],
|
||||||
'known_servers': len(sessions),
|
'known_servers': len(sessions),
|
||||||
'available_servers': sum(s.available is True for s in sessions)
|
'available_servers': sum(s.available is True for s in sessions)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue