Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodes marked online incorrectly #123

Open
tokudan opened this issue Feb 8, 2021 · 5 comments
Open

Nodes marked online incorrectly #123

tokudan opened this issue Feb 8, 2021 · 5 comments

Comments

@tokudan
Copy link

tokudan commented Feb 8, 2021

We (FFHH) had nodes marked as online despite them never beeing part of the network.
I traced back the issue to the line

return Math.abs((node.lastseen ? new Date(node.lastseen) : new Date()) - new Date()) < config.offlineTime * 1000

and the same line in other providers.
That line basically says: If a node does not have a valid node.lastseen object, treat it as just having a lastseen object that equals now.
We inject node names and location data from an aliases.json file, so nodes usually show up in the aliases.json file first before actually coming online and being detected through announced and it's common to have nodes being registered on our backend without them ever coming online.
I've replaced that line in hopglass.js and other providers with the following line and these nodes are correctly reported as offline now:
return Math.abs((node.lastseen ? new Date(node.lastseen) : new Date(0)) - new Date()) < config.offlineTime * 1000
This treats nodes without a valid node.lastseen object as being last seen on 1.1.1970.

@ghost
Copy link

ghost commented Feb 8, 2021

The behavior you are seeing is intended. Most other communities use aliases.json to display supernodes that do not have any kind of respondd, so they have no valid lastseen but should always be displayed as online.
Maybe we can add some way to specify if it should be online regardless of lastseen in aliases.json.

@tokudan
Copy link
Author

tokudan commented Feb 9, 2021

I think that would be a good idea.
I do wonder if other communities actually want those supernodes marked as having just been introduced to the network, which is what happened with our nodes.

@anoymouserver
Copy link
Collaborator

You can avoid it appearing in the 'New Nodes' section by setting a firstseen timestamp in the aliases.json:

{
  "deadbeef0001": {
    "nodeinfo": {
      "node_id": "deadbeef0001",
      "hostname": "supernode1"
    },
    "firstseen": "2017-04-13T15:32:41"
  }
}

@tokudan
Copy link
Author

tokudan commented Feb 9, 2021

@anoymouserver that works for supernodes. setting firstseen or lastseen in the aliases.json would overwrite the info gathered through respondd and thus basically make that information useless for us.

@ghost
Copy link

ghost commented Feb 9, 2021

Yeah, maybe another solution would be to make two seperate files, one "overlay" and one "underlay". Things from the overlay overwrite actual node data, things from the underlay don't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants