Use dcrd and GCS filters to find voted/revoked tickets rather than using
the dcrwallet TicketInfo RPC.
Using TicketInfo was a bit flakey because wallets do not always
correctly detect votes/revokes, and as a result VSP admins may notice
that with this change vspd detects some historic voted/revoked tickets
which TicketInfo never detected.
* Remove helper func getCommitmentAddress.
This function is only used in one place so removing it does not introduce any duplication. Removing the func also removes the need for errors.Is comparison, which will be very useful in upcoming changes.
* Rename apiError to ErrorCode.
* Don't use inline type for API errors.
* Export webapi errors.
* Export webapi request/responses.
* Add types module for API requests/responses/errors
* ci: Update GitHub actions and linter.
* Update go deps.
* Include commit ID in build info.
Introduced in go 1.18, debug.ReadBuildInfo allows a go process to discover the git commit it was built from.
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.
vspd will now call dcrd RPC `getblockchaininfo` to determine if DCP-0010 is active, and take that information into consideration when calculating ticket registration fee.
This pulls a fix which enables vspd to determine remote client IP using header `X-Forwarded-For` or `X-Real-Ip`.
This depends on the reverse proxy setting those headers appropriately, which can be achieved in nginx 1.20 using the following:
```
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
```
This commit marks the point at which vspd will stop working against dcrd 1.6 and start to target master.
The dcrwallet RPC version has not changed, so vspd continues to work with dcrwallet 1.6 or master.
* Delay fee broadcast and adding tickets to wallets.
- Adds a `background` package which implements a dcrd notification handler. On each blockconnected notification, tickets with 6+ confirmations are marked confirmed, relevant fee transactions are broadcast, and any fees with 6+ confirmations have their tickets added to voting wallets.
- VSP fee is now an absolute value measured in DCR rather than a percentage. This simplifies the code and is more appropriate for an MVP. We can re-add percentage based fees later.
- Database code for tickets is now simplified to just "Insert/Update", rather than having functions for updating particular fields.
- Pay fee response no longer includes the fee tx hash, because we dont necessarily broadcast the fee tx straight away.
* Const for required confs