Fee xpub key and last used address index are now wrapped into a struct,
with both fields being set and retrieved together rather than
individually.
The underlying format for storing these values in the database does not
change. The only change is the interface between the database code and
the caller.
A new tab on the admin page displays a list of all tickets which were
registered with the VSP but missed their votes. Clicking on the ticket
hash redirects to the Ticket Search tab with the details of the missed
ticket displayed.
Using a single select loop for background tasks removes a lot of
duplicated boilerplate code and helps to simplify shutdown logic. This
does reduce the amount of things which can run in parallel, but that
isn't of concern for vspd. The web server still runs in its own
goroutine so its responsiveness won't be affected.
Any tickets in the database which are currently revoked should be
updated to either expired or missed.
This is achieved with a heuristic based on the expiry height and
revoke height of the tickets. It is not guaranteed to be 100% correct
but should be pretty close.
The web api is not yet updated to reflect this change, missed/expired
tickets will continue to be counted as revoked.
Moving the existing integrity checks up into vspd removes the
depdendancy on rpc clients from the database client, and also creates a
natural home for future integrity checks to be added.
Only fatal errors should result in data integrity checks being stopped.
If a single ticket encounters an error, that error should be logged and
other tickets should still be attempted.
This check was added preemptively, the error has never actually been observed in dev, testing, or production.
It does not scale well. Its takes almost 500ms to insert into a database containing 100k tickets.
Periodic database backups are no longer started automatically in database.Open(), and the backup written by database.Close() can now be disabled.
Only vspd itself requires backups, they are not useful for test code or future upcoming tools such as vote-validator.
This removes all of the global loggers from the project and replaces them with loggers which are instantiated in vspd.go and passed down as params.
To support this, the background package was removed. It only contained one file so it was a bit pointless anyway. It only existed so background tasks could have their own named logger.
- Rename all instances to "shutdownCtx" to be really explicit. This context is special in that it can be closed at any time without warning, so it should be obvious to the reader.
- Don't use shutdownCtx in RPC clients. Clients should not stop working immediately when shutdown is signalled, they need to keep working while the process is shutting down.
No reason for this to be a standalone func with a param when it can be a method of VspDatabase. This will be useful later when VspDatabase contains its own logger.
* Remove global cache variable.
Rather than maintaining cached data in a global variable, instantiate a cache struct and keep it in the `Server` struct.
* Store net params in RPC clients.
This means net params only need to be supplied once at startup, and also removes a global instance of net params in `background.go`.
This allows both tspend and treasury policies to be set by clients on a per-ticket basis. Preferences can be set when initially registering a ticket with `/payfee`, and can be later updated using `/setvotechoices`.
Any requests which alter treasury/tspend policy will be stored in the database using the existing accountability system.
**Note:** This does not include consistency checking, it will need to be added later when dcrwallet has an RPC to retrieve policies in batches.
This renames "Voting wallet status" to "VSP status" and it now includes the status of the local dcrd instance. This change impacts both the /admin page of the UI, and the response of the /admin/status API endpoint.
To allow signing with addresses other than the commitment address, add
an alternate signature address. In order to continue to prove that the
address was chosen by the user, add an alternate signature history. Only
allow one record per ticket to be saved to cap needed db space.
* Use features from Go 1.16 tooling.
- GO111MODULE environment variable now defaults to "on"
- "go build" and "go test" now exit with an error rather than silently modifying go.mod or go.sum files
- Update README.md
* Don't use deprecated ioutil package.
* Be more specific about consensus vote choices.
Rather than referring to just "Vote choices", refer specifically to "consensus vote choices".
This will be useful when treasury and tspend vote choices are added, and the distinction becomes more important.
* dnldd suggestion.
**NOTE: This contains a backwards incompatible database migration, so if you plan to test it, please make a copy of your database first.**
Moves tickets from a single database bucket containing JSON encoded strings, to a bucket for each ticket.
This change is to preemptively deal with scaling issues seen with databases containing tens of thousands of tickets.
This PR introduces a database migration which deletes any raw fee transactions which remain in the database after already having been confirmed on-chain. There is no need to keep these, and they take up a lot of space.
There is also a change in the background handler to ensure that in future, tx hex is always removed from the database when the tx is confirmed.
Plus a few other miscellaneous pieces which will be usedful soon:
- Remove `Get` from func names `GetCookieSecret` and `GetFeeXPub`.
- Add helpers to encode/decode integers/bytes.
Use randomly generated values of the correct length in test Tickets, rather than using hard-coded and unrealistic values. This code was produced to aid with benchmarking DB performance.
Also fixing some minor typos/errors noticed while working in this file.