deso-protocol / backend

HTTP API for a DeSo node
https://docs.deso.org
MIT License
134 stars 86 forks source link

Add simple status check for node to backend #608

Closed diamondhands0 closed 5 months ago

diamondhands0 commented 5 months ago

An endpoint that allows our validator hub to quickly tell you if your node is reachable by other validators.

Curl command to test it, assuming you're running backend on 18001 and a real node on 18000 (eg like we do with n0_test).

$ curl 'http://localhost:18001/api/v0/check-node-status'  -H 'content-type: application/json'  --data-raw '{"NodeHostPort":"localhost:18000"}'   --compressed

When successful returns:

{"Success":true}

When not successful returns:

{"error":"Problem connecting to dorsey.bitclout.com:18002: dial tcp 35.192.117.201:18002: i/o timeout"}
{"error":"Problem connecting to localhost:18003: dial tcp 127.0.0.1:18003: connect: connection refused"}