|
|
@ -43,19 +43,24 @@ func (s *PublicHarmonyService) ProtocolVersion( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Syncing returns false in case the node is in sync with the network
|
|
|
|
// Syncing returns false in case the node is in sync with the network
|
|
|
|
// With the current network height as well as the difference
|
|
|
|
// If it is syncing, it returns:
|
|
|
|
|
|
|
|
// starting block, current block, and network height
|
|
|
|
func (s *PublicHarmonyService) Syncing( |
|
|
|
func (s *PublicHarmonyService) Syncing( |
|
|
|
ctx context.Context, |
|
|
|
ctx context.Context, |
|
|
|
) (interface{}, error) { |
|
|
|
) (interface{}, error) { |
|
|
|
|
|
|
|
// difference = target - current
|
|
|
|
inSync, target, difference := s.hmy.NodeAPI.SyncStatus(s.hmy.ShardID) |
|
|
|
inSync, target, difference := s.hmy.NodeAPI.SyncStatus(s.hmy.ShardID) |
|
|
|
|
|
|
|
if inSync { |
|
|
|
|
|
|
|
return false, nil |
|
|
|
|
|
|
|
} |
|
|
|
return struct { |
|
|
|
return struct { |
|
|
|
InSync bool `json:"in-sync"` |
|
|
|
Start uint64 `json:"startingBlock"` |
|
|
|
Target uint64 `json:"network-height"` |
|
|
|
Current uint64 `json:"currentBlock"` |
|
|
|
Delta uint64 `json:"difference"` |
|
|
|
Target uint64 `json:"highestBlock"` |
|
|
|
}{ |
|
|
|
}{ |
|
|
|
InSync: inSync, |
|
|
|
// Start: 0, // TODO
|
|
|
|
Target: target, |
|
|
|
Current: target - difference, |
|
|
|
Delta: difference, |
|
|
|
Target: target, |
|
|
|
}, nil |
|
|
|
}, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|