File tree 1 file changed +12
-11
lines changed
1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -3047,18 +3047,19 @@ def get_node_statistics(self):
3047
3047
:return: stats for collated/validated blocks since round beggining and stats for ls queries for the last minute
3048
3048
"""
3049
3049
stats = self .local .db .get ('statistics' , {}).get ('node' )
3050
- result = {
3051
- 'collated' : {
3052
- 'ok' : 0 ,
3053
- 'error' : 0 ,
3054
- },
3055
- 'validated' : {
3056
- 'ok' : 0 ,
3057
- 'error' : 0 ,
3058
- }
3059
- }
3050
+ result = {}
3060
3051
if stats is not None and len (stats ) == 3 and stats [0 ] is not None :
3061
3052
for k in ['master' , 'shard' ]:
3053
+ result = {
3054
+ 'collated' : {
3055
+ 'ok' : 0 ,
3056
+ 'error' : 0 ,
3057
+ },
3058
+ 'validated' : {
3059
+ 'ok' : 0 ,
3060
+ 'error' : 0 ,
3061
+ }
3062
+ }
3062
3063
collated_ok = stats [2 ]['collated_blocks' ][k ]['ok' ] - stats [0 ]['collated_blocks' ][k ]['ok' ]
3063
3064
collated_error = stats [2 ]['collated_blocks' ][k ]['error' ] - stats [0 ]['collated_blocks' ][k ]['error' ]
3064
3065
validated_ok = stats [2 ]['validated_blocks' ][k ]['ok' ] - stats [0 ]['validated_blocks' ][k ]['ok' ]
@@ -3075,7 +3076,7 @@ def get_node_statistics(self):
3075
3076
result ['collated' ]['error' ] += collated_error
3076
3077
result ['validated' ]['ok' ] += validated_ok
3077
3078
result ['validated' ]['error' ] += validated_error
3078
- if stats is not None and len (stats ) >= 2 :
3079
+ if stats is not None and len (stats ) >= 2 and stats [ 0 ] is not None :
3079
3080
result ['ls_queries' ] = {
3080
3081
'ok' : stats [- 1 ]['ls_queries' ]['ok' ] - stats [- 2 ]['ls_queries' ]['ok' ],
3081
3082
'error' : stats [- 1 ]['ls_queries' ]['error' ] - stats [- 2 ]['ls_queries' ]['error' ],
You can’t perform that action at this time.
0 commit comments