30 Commits

Author SHA1 Message Date
Jamie Holdstock
4db50a4439 Helpers for bool<>[]byte conversion. 2021-06-09 21:25:21 +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
2d0db6f6b3 Remove confirmed fee tx hex.
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.
2021-05-20 13:33:41 +08: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
David Hill
2a096d81f9
fix errorlint warnings (#193) 2020-11-25 15:14:18 +00:00
jholdstock
825a717ca7 Store records of vote choice changes 2020-09-17 16:05:07 +00:00
jholdstock
4a207b15f8 Add missing copyright notices 2020-08-19 20:22:12 +00:00
jholdstock
e2483b6cea Fix backup file mode 2020-08-17 19:14:57 +00:00
jholdstock
6c12ddeb31 Write a backup after closing the db, not before 2020-08-17 19:14:57 +00:00
jholdstock
ba77d39f35 Comment exported methods 2020-08-07 17:03:03 +00:00
David Hill
4f0c980aca
database: protect access with a mutex (#150) 2020-07-06 10:06:43 +01:00
jholdstock
5a1a1b487e Dont use byte slices outside of db tx. 2020-06-16 13:29:32 +00:00
Jamie Holdstock
bfeddd25d1 Download db backup from admin page. 2020-06-12 13:35:43 +00:00
jholdstock
a304fc9890 Close the database after web server is stopped.
Previously all of the shutdown tasks were running concurrently, which meant the db could be closed before the webserver is finished using it.
2020-06-12 13:23:55 +00:00
jholdstock
b50615bc6f Add very basic admin page. 2020-06-08 15:24:49 +00:00
jholdstock
c7835e8811 Update log level and add some TODOs 2020-06-04 15:04:39 +00:00
Jamie Holdstock
d407af35c0
Accept feexpub once at startup. (#97) 2020-06-03 18:10:30 +01:00
jholdstock
81a6bf1ea8 Reject unvotable tickets.
/payfee and /getaddress will now only accept tickets which are immature or live.
2020-06-03 12:49:14 +00:00
Jamie Holdstock
6b6bc20522
Periodically write a database backup. (#76) 2020-05-28 06:58:34 +01:00
Jamie Holdstock
9151f4f221
Generate fee addresses in dcrvsp, not dcrwallet (#59)
* Remove unnecessary error handling.

* Generate fee addresses in dcrvsp, not dcrwallet

* Break loop if multiple invalid children are generated.

* Use Mutex instead of RWMutex
2020-05-26 14:51:05 +01:00
Jamie Holdstock
1ff55f4b30
Add some stats to homepage (#51) 2020-05-22 18:43:41 +01:00
David Hill
fff8132b13
Store signing key in db. (#34) 2020-05-19 14:24:02 +01:00
Jamie Holdstock
6ca2f620b7
Use a waitgroup to wait for shutdown tasks (#21) 2020-05-18 09:05:10 +01:00
Jamie Holdstock
8768014348
Add shutdown context. (#20) 2020-05-17 07:49:53 +01:00
Jamie Holdstock
57dfc1ed6d
Add decred logging and config (#8) 2020-05-14 19:02:45 +01:00
Jamie Holdstock
d0236e5c04
Implement ticket storage and retrieval (#5) 2020-05-14 14:04:14 +01:00
Jamie Holdstock
b45bbf8896
Enable CI through GitHub Actions (#4) 2020-05-14 13:53:48 +01:00
jholdstock
fcd068deb3 Rename Fees => Tickets 2020-05-13 21:48:59 +01:00
jholdstock
f919d4d8fc Add missing db stubs and begin db implementation 2020-05-13 21:25:35 +01:00