153 Commits

Author SHA1 Message Date
Jamie Holdstock
c1ba46347e
Be more specific about consensus vote choices. (#278)
* 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.
2021-07-05 09:16:08 -05:00
Jamie Holdstock
844d1a0736 Add comment to explain hard-coded relay fee. 2021-06-25 20:39:22 +08:00
Jamie Holdstock
36acb8c04a Vertical ticket search form. 2021-06-15 10:18:25 +08:00
Jamie Holdstock
ab5ee2857f Vertical login form and improve error appearance. 2021-06-15 10:18:25 +08:00
Jamie Holdstock
2b7903f7d5 Add database and logout tabs to admin page.
Buttons to logout and download DB backup are now moved into new tabs. Also the database size is displayed in the database tab.
2021-06-15 10:18:25 +08:00
Jamie Holdstock
fd4f2b2dad Add commas for large ticket counts. 2021-06-15 10:18:25 +08:00
Jamie Holdstock
5deb1abcfc Prevent dividing by zero when pool has no voted tickets. 2021-06-15 10:18:25 +08:00
Jamie Holdstock
fc131e926d
Refactor gui cache
* Remove static cfg values from GUI cache.

Theres no need for these values to be copied into the cache when templates could simply access the config struct directly.

This also changes the cache accessor so it returns a copy of the cache rather than a pointer, which removes a potential race.

* Rename and move cache.

Cache code was previous in `homepage.go`, but its used in multiple places and not just on the homepage. Its enough code to go into its own dedicated `cache.go`.
2021-06-12 09:54:53 +08:00
Jamie Holdstock
d1a838bf7f Add vspclosedmsg config.
If vspclosed is set to true, the provided message will be displayed on the webpage and returned by the status API endpoint.
2021-06-10 09:45:22 +08:00
Jamie Holdstock
f4adcfeaf0 Add version to bootstrap.css filename. 2021-06-09 21:25:05 +08:00
Jamie Holdstock
b9d4db40e9 Use vspd version as cache buster for .css files.
This will ensure when VSP admins update to a new version of vspd, web visitors will not use cached old .css files.
2021-06-09 21:25:05 +08:00
Jamie Holdstock
25ae1b89d6 Use a single cache buster string for favicon.
Previously two different strings were used as cache busters in favicon files. Only one is required. Using multiple increases the chance of making mistakes when updating the cachebuster in future.
2021-06-09 21:25:05 +08:00
Jamie Holdstock
9867f78385
Add network proportion to homepage and /vspinfo (and revoked proportion) (#264)
* Add network proportion to homepage and /vspinfo.

Proportion is calculated using the number of tickets  currently registered with the VSP, divided by the total size of the network ticket pool as reported by `getblockheader`.

The value will only ever be an estimate because:

- it's possible for a single ticket to be added to multiple VSPs.
- vspd does not distinguish between immature and live tickets, whereas `getblockheader` only reports live tickets.
- `getblockheader` is reporting the size of the ticket pool as of the previous block, not the current block.

* xaur suggestions

* Show missed ticket %, not just the raw number.
2021-06-08 08:47:07 -05:00
Jamie Holdstock
978b78e745
Compare scripts rather than addresses. (#267)
* Decode fee address with stdaddr.

Compare script and script versions rather than just comparing address strings.

Also move the fee amount check higher, so it is with the rest of the fee validating code.

* Compare voting addr scripts rather than addrs.

Rather than comparing the address strings, ensure both voting script and script version match.
2021-06-08 08:46:16 -05:00
Jamie Holdstock
dad662b0f0 Display fee in DCR rather than atoms. 2021-06-01 07:17:54 +08:00
Jamie Holdstock
c3eeb1eb5c Block explorer link for commitment address 2021-06-01 07:17:54 +08:00
Jamie Holdstock
a1091015ff Split ticket info into ticket, fee and voting info 2021-06-01 07:17:54 +08:00
Jamie Holdstock
2cdc5a74b5 Split admin page into tabs.
Previously the voting wallet status and the ticket search were stacked on top of eachother, making the page very long and awkward to navigate. This introduces tabbed navigation which allows just one to be displayed at a time.
2021-06-01 07:17:54 +08:00
Jamie Holdstock
7edbd02d4e Use proper background color. 2021-06-01 07:17:54 +08:00
Jamie Holdstock
32c5c7a524 Indent JSON on admin screen. 2021-06-01 07:17:54 +08:00
Jamie Holdstock
851d3137e5 Improve voting wallet status aesthetics. 2021-06-01 07:17:54 +08:00
Jamie Holdstock
e05ced391a Various minor cleanups.
- Updating and adding some copyrights which were missed recently.
- Slight improvements to some commenting and naming.
2021-06-01 07:17:11 +08:00
Jamie Holdstock
20cb546e74
Store each ticket in its own DB bucket.
**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.
2021-05-24 17:45:47 +08:00
Jamie Holdstock
1988322cac Add timezone to GUI timestamps 2021-05-20 13:04:33 +08:00
Jamie Holdstock
a8c0ae95ac
Use a custom Recovery middleware. (#255) 2021-05-18 07:27:12 +01:00
Jamie Holdstock
b050fc3100
Set and display ticket purchase height (#250)
* Ensure purchase height set for confirmed tickets.

* Show purchase height in admin screen.

Only show purchase height when the ticket is confirmed, because if a ticket is not confirmed, its purchase height is not yet known.
2021-05-14 21:19:01 -05:00
Jamie Holdstock
08fafdaf31
Remove relayFee todo. (#256)
Accepting this as a hard-coded value. It will not be retrieved from RPC or config.
2021-05-14 21:09:24 -05:00
Jamie Holdstock
ef472ffe5d
Include best block height in /vspinfo response (#254) 2021-05-14 21:09:03 -05:00
jholdstock
3a97c9214b Show formatted date for fee expiry 2021-05-13 12:16:08 +01:00
jholdstock
b5a65a9e78 Add block explorer links to tx hashes and fee addr 2021-05-13 12:16:08 +01:00
jholdstock
7cb0ded1fe Use a proper type for admin page search results. 2021-05-13 12:16:08 +01:00
Jamie Holdstock
4810802fa9 Make log rotator params configurable.
Maintaining the dafault max log file size of 10MB, but increasing the default number of retained files from 3 to 20.
2021-05-13 02:20:18 +01:00
Jamie Holdstock
5f8ad656f7
Add framework for database upgrades. (#242)
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.
2021-05-05 08:54:51 -05:00
Jamie Holdstock
391e436a71 Add missing error handling to /getfeeaddress.
Failing to generate a fee address for a ticket is a critical error, and should be handled as such.
2021-04-30 21:37:31 +01:00
Jamie Holdstock
4858af2682
Upgrade deps (#239)
* Update to latest deps.

Includes using the dcrd stdaddr package instead of dcrutil.

* Use stdaddr.Hash160
2021-04-26 09:12:23 -05:00
David Hill
707ded57df
webapi: put error checking where it belongs (#228) 2021-01-22 10:25:51 +00:00
Jamie Holdstock
c71fbb024b
Make ticket parent mandatory (#218)
* Make ticket parent mandatory

* Reduce scope of request types which arent reused.
2021-01-04 14:55:21 +00:00
Jamie Holdstock
49982533ab
Don't log err which is always nil. (#221) 2020-12-30 12:36:27 +00:00
Jamie Holdstock
ac8e20f3c1
Use actual request in response, dont reserialize. (#220)
Reserializing the client request can result in different bytes because
the order of iteration over a map is not guaranteed to be the same every
time.
2020-12-30 12:36:06 +00:00
Jamie Holdstock
fe286a5d1a
Reject reused or old timestamps. (#215)
* Reject reused or old timestamps.

* Refine error mesage
2020-12-27 15:22:17 +00:00
David Hill
2a096d81f9
fix errorlint warnings (#193) 2020-11-25 15:14:18 +00:00
David Hill
1c6f962e2b
api: add optional parent transaction to feeaddress (#205) 2020-11-20 13:10:13 +00:00
jholdstock
0f657eb4fe Register tickets with invalid vote choices.
/payfee will no longer reject tickets with invalid vote choices. The tickets will be registered with the VSP and added to voting wallets, but their voting choices will be empty. A warning will be added to server logs.
2020-11-16 14:00:17 +00:00
Jamie Holdstock
b40681d38e
HTTP 428 when fee tx references unknown outputs. (#195)
JSON body will be `{"code": 16, "message":"fee transaction could not be broadcast due to unknown outputs"}`
2020-10-27 11:15:39 +00:00
David Hill
c83a2a0085
rpc: verify dcrwallet's have --manualtickets set. (#187) 2020-09-25 09:55:53 +01:00
jholdstock
825a717ca7 Store records of vote choice changes 2020-09-17 16:05:07 +00:00
jholdstock
d0c3abf258 Make funcNames constant.
Aside from just being a sensible thing to do, this also prevents a local stack allocation.
2020-09-17 14:21:17 +00:00
jholdstock
f2ae9a81ea Dont underline logo on hover 2020-08-31 17:18:30 +00:00
jholdstock
c7f8cea4dc webapi: base64 encode server signature 2020-08-31 17:14:33 +00:00
jholdstock
5a8bc49c22 Unique error for fee broadcast failure 2020-08-21 12:46:58 +00:00