* 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.
This check was added to InsertNewTicket pre-emptivly as a sanity check. It is not strictly required because the fee address itself is also checked, and there is no scenario where we would expect a fee address and its index not to match.
Removing this check eases the route forward to improving database performance.
- Use bootstrap to improve layout.
- Add warning banners for webserver debug mode and vspd closed.
Admin page:
- Replace listing of all tickets with form to search by ticket hash
- Fee tx status is now tracked using a dedicated field, with values none/received/broadcast/confirmed/error.
- Fee tx hex and hash are now both set in /payfee. The absense of txhash is no longer used to determine if a fee tx has been broadcast or not.
- setvotechoices can no longer be called before a fee is received.
- Remove `binding:required` from response types. It has no effect on responses, it is only needed on request types which are validated by gin.
* Calculate fee from percentage.
- Reverted config to accept a fee percentage, not absolute value.
- The fee amount to be paid is now included in the `getfeeaddress` response. The current best block is used to calculate the fee percentage, and new blocks may be mined before the fee is paid, so the fee expiry period is shortened from 24 hours to 1 hour to mitigate this.
- Rename ticket db field to FeeAmount so it is more representative of the data it holds.
- API fields renamed to "FeePercentage" and "FeeAmount"
- Relay fee is still hard coded.
* Use getbestblockhash
* 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
* Remove unnecessary error handling.
* Generate fee addresses in dcrvsp, not dcrwallet
* Break loop if multiple invalid children are generated.
* Use Mutex instead of RWMutex
* Rework client/server authentication.
- Remove Signature from all requests, and instead expect a signature in HTTP header "VSP-Client-Signature".
- Remove CommitmentSignatures from the database.
- Use a bool flag to indicate when a ticket is missing from the database rather than an error.
This commit introduces a lot of duplication into each of the authenticated HTTP handlers. This should be removed in future work which moves the authentication to a dedicated middleware.
* Introduce auth and rpc middleware.
This removed the duplication added in the previous commit, and also removes the duplication of RPC client error handling.