decred / dcrstakepool

Stakepool for Decred.
Other
72 stars 75 forks source link

VSP "working" flag in API #628

Open degeri opened 4 years ago

degeri commented 4 years ago

Implement an end point "vspworking" that indicates to the user/client that the VSP is working and is currently available.

Client can check this before ticket purchase.

This can be changed in the admin panel and would be useful -

  1. When VSP has plans to shutdown

  2. VSP is momentarily down / Scheduled maintenance (It might not be able to process the user fee payment after ticket purchase)

  3. Maybe it can also return blockhight / dcrdversion so that the user can ensure VSP are updated and are in sync.

If this returns false or is not available then the ticket purchase will not be done and user can be shown the appropriate error.

This can be part of the #574 changes.

xaur commented 4 years ago

I would name the boolean flag operational or up. But yeah it can be generalized from a boolean to a enum called status with more than 2 values. Or even a status object like

{
    "up": false,
    "info": "Planned maintenance until 2020-05-10 10:15 UTC. Upgrading software."
}

or

{
    "up": true,
    "accepting_new_tickets": false,
    "info": "The VSP is shutting down on 2020-12-20 UTC. Please don't buy any more tickets."
}

Block height would be a nice addition to know for certain that the VSP is in sync with the network.

In any case, I hope the protocol is versioned so that the values of this new flag/enum/object will be correctly interpreted even if it is changed/extended later.