Skip to content
Snippets Groups Projects
Commit e595b772 authored by Jake Taylor's avatar Jake Taylor :lips:
Browse files

Merge branch 'hotfix/stale-registration' into 'release'

Exclude stale nodes from numRegistered

See merge request !63
parents 047b81be e183157c
No related branches found
No related tags found
2 merge requests!67Release,!63Exclude stale nodes from numRegistered
...@@ -595,19 +595,24 @@ func (c *Client) GetNodeRegistrationStatus() (int, int, error) { ...@@ -595,19 +595,24 @@ func (c *Client) GetNodeRegistrationStatus() (int, int, error) {
cmixStore := c.storage.Cmix() cmixStore := c.storage.Cmix()
var numRegistered int var numRegistered int
var numStale = 0
for i, n := range nodes { for i, n := range nodes {
nid, err := id.Unmarshal(n.ID) nid, err := id.Unmarshal(n.ID)
if err != nil { if err != nil {
return 0, 0, errors.Errorf("Failed to unmarshal node ID %v "+ return 0, 0, errors.Errorf("Failed to unmarshal node ID %v "+
"(#%d): %s", n.ID, i, err.Error()) "(#%d): %s", n.ID, i, err.Error())
} }
if n.Status == ndf.Stale {
numStale += 1
continue
}
if cmixStore.Has(nid) { if cmixStore.Has(nid) {
numRegistered++ numRegistered++
} }
} }
// Get the number of in progress node registrations // Get the number of in progress node registrations
return numRegistered, len(nodes), nil return numRegistered, len(nodes) - numStale, nil
} }
// DeleteContact is a function which removes a partner from Client's storage // DeleteContact is a function which removes a partner from Client's storage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment