543 Commits

Author SHA1 Message Date
Jamie Holdstock
cf8f791684 multi: Underscore unused func params. 2024-02-16 08:47:03 +08:00
jholdstock
1b9587c000 build: Use latest GitHub Actions 2024-01-12 08:51:54 +00:00
jholdstock
4ef193d63c build: Update gorilla/sessions to 1.2.2 2024-01-12 08:51:54 +00:00
jholdstock
0245d0f7c8 webapi: Update year to 2024 2024-01-12 08:51:54 +00:00
jholdstock
1650e97b41 LICENSE: Update year to 2024 2024-01-12 08:51:54 +00:00
Jamie Holdstock
4f892711fc
Add docs for listing on decred.org 2023-12-06 08:47:25 +00:00
David Hill
40673270fb build: bump bbolt dep 2023-11-22 12:04:37 +00:00
jholdstock
b50d91ae5b docs: Add 1.3.2 release note 2023-11-15 08:46:30 +00:00
jholdstock
1e66b6ff59 Downgrade dcrwallet dep to v3.
This downgrade changes StakePoolTicketFee back to the version which does
not consider DCP-0012 activation.

This resolves an issue where Decrediton sometimes fails to pay VSP fees,
caused by Decrediton and vspd independently calculating the fee amount
using different versions of the algorithm.

Releasing the new algorithm will need to be more carefully coordinated,
potentially requiring both client and server sides to be updated in
sync.
2023-11-08 09:01:36 +00:00
jholdstock
34cd9d2892 webapi: Wait for unknown outputs to propagate.
If broadcasting parent transaction of a ticket fails because it
references unknown outputs, there is a good chance that waiting a few
seconds will resolve the issue because the ancestor transactions will
propagate through the network and reach the mempool of the local dcrd
instance.
2023-11-08 08:52:52 +00:00
jholdstock
9ee95f98ab version: Bump to 1.4.0-pre 2023-09-29 09:20:53 +01:00
jholdstock
8fc72cdd15 docs: Add 1.3.1 release note 2023-09-29 09:20:37 +01:00
Jamie Holdstock
a254e943f7
webapi: Add missed tickets to admin page.
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.
2023-09-26 17:18:32 +01:00
Jamie Holdstock
d960898987
docs: Add 1.3.0 release note 2023-09-26 10:21:50 +01:00
jholdstock
4012b098fe vspd: Improve comment for update func.
A good comment explains what a function does, not when it is called.
2023-09-26 10:21:38 +01:00
jholdstock
f8bd606468 multi: Use const where possible. 2023-09-26 10:21:38 +01:00
jholdstock
e9cd529de5 webapi: Don't add extra context to dcrd errors.
The error returned by dcrd.Client() is already very descriptive and does
not need extra context.
2023-09-26 10:21:38 +01:00
jholdstock
a0d9cbf6b3 webapi: Remove deprecated css.
The overlay setting for overflow has been deprecated for quite some
time, and these days doesn't work on most browsers.
2023-09-26 10:21:38 +01:00
jholdstock
1e6b379864 v3tool: Remove hard-coded agenda ID.
Getting an agenda ID dynamically so that this doesnt need to be manually
updated for future vote versions.
2023-09-26 10:21:38 +01:00
jholdstock
7e810b12ba docs: Simplify curl example for status endpoint.
When invoked with -v, curl actually outputs a message to indicate that
this extra param is unnecessary:

"Note: Unnecessary use of -X or --request, GET is already inferred."
2023-09-26 10:21:38 +01:00
jholdstock
e1885bb7cb multi: Rename shutdownWg to wg.
The more verbose name was helpful in the past when some code was
handling more than one waitgroup, however that is no longer the case due
to refactoring so reverting to the more concise name makes sense.
2023-09-26 10:21:38 +01:00
jholdstock
fb1f250a74 vspd: Create shutdown context earlier.
Create the shutdown context earlier so process begins handling shutdown
signals earlier. Specifically, the context should be created before
creating any resources which need a graceful shutdown such as the
database. This is important because without explicit signal handling the
process will terminate immediately upon receiving a signal without
running deferred tasks.
2023-09-26 10:21:38 +01:00
Jamie Holdstock
81784accb6
Update main module dependencies 2023-09-26 09:23:32 +01:00
jholdstock
44b72603d8 client: Update to latest types.
This adds missed and expired ticket counts to VspInfoResponse.
Deprecates revoked count.
2023-09-24 08:40:15 +01:00
jholdstock
ed82998fe2 webapi: Only log "ticket added to wallet" once. 2023-09-20 09:21:33 +01:00
jholdstock
fde844e2e1 vspd: Make log format consistent.
Every log line which includes a ticket hash includes it in the end at in
brackets, not inline with the message.
2023-09-20 09:21:33 +01:00
jholdstock
f5b57f4169 vspd: Increase some logs to info level. 2023-09-20 09:21:33 +01:00
jholdstock
1f62d46bdd vspd: Reduce some logs to debug level. 2023-09-20 09:21:33 +01:00
jholdstock
2994d128fe vspd: Remove funcName from info/debug logs.
Including the funcName in informational log messages is not useful for
devs or admins, its just spam which bloats the log file.
2023-09-20 09:21:33 +01:00
jholdstock
12e61bab65 vspd: Remove unnecessary dcrd error logging.
The error returned by dcrd.Client() is already very descriptive and does
not need extra context.
2023-09-20 09:21:33 +01:00
jholdstock
c4de3d5d95 vspd: Pass dcrd RPC to findSpentTickets as a param
This allows RPC clients to be reused more easily in the case that the
caller of findSpentTickets already has a connected dcrd RPC client.
2023-09-19 18:01:43 +01:00
jholdstock
61c9c7087f vspd: Split update function.
The update function performs four distinct steps which can readily be
broken down into four separate functions.
2023-09-19 18:01:43 +01:00
jholdstock
01e88f39c6 vspd: Split vspd.go into smaller files.
This splits the code from vspd.go into various other files which broadly
represent the functional areas of vspd - the main update function,
database intgrity checks and voting wallet consistency checks.

Code is just moved without any modifications.
2023-09-19 18:01:43 +01:00
jholdstock
69b27ff1e6 vspd: Rename blockConnected to update.
The name blockConnected is not very accurate as this function is also
called when vspd is initializing. It doesnt depend on a block having
been connected at all, it can be called at any time.
2023-09-19 18:01:43 +01:00
jholdstock
841ac77890 webapi: Make debug warning banner more distinct.
Give the debug banner a unique look by changing its class to "danger",
and centering and bolding the text. This helps it to be more noticable
when displayed near other banners.
2023-09-19 18:00:05 +01:00
jholdstock
e263da08bd database: Remove RWMutex protecting ticket bucket.
The mutex was added to the ticket bucket as a pre-emptive safety
measure, but the bbolt project documentation seems to indicate that it
isn't necessary.

https://github.com/etcd-io/bbolt/blob/v1.3.7/README.md#transactions
2023-09-19 17:59:19 +01:00
jholdstock
57864ae58f main: POSIX compliant shebang for locating bash.
Improve portability of run_tests.sh and harness.sh by using the POSIX
compliant shebang for locating bash.
2023-09-19 17:59:07 +01:00
jholdstock
c7ebe28501 webapi: Try cache update before returning error.
Rather than immediately returning an error if the cache is not
initialized, attempt to initialize it first. Without this change there
is only an attempt to initialize the cache once per minute.
2023-09-19 17:58:59 +01:00
jholdstock
99dc97d6a3 webapi: Abort requests if web cache not ready.
A new middleware aborts any requests which require the data cache if the
cache is not yet initialized. An explicit error is returned so the admin
will be immediately aware what has gone wrong.

Previously, webpages were rendered and JSON responses were sent with
zero values, and with no indication of anything being wrong. This was
sometimes difficult to notice, and even when noticed the cause was not
immediately apparent.
2023-09-19 17:58:59 +01:00
jholdstock
d1eddafb52 v3tool: Use shutdown context.
Using the shutdown context provided by the internal signal package means
v3tool can exit cleanly if shutdown is requested by the user.
2023-09-19 08:33:42 +01:00
jholdstock
9660de7d9f vote-validator: Use shutdown context.
Using the shutdown context provided by the internal signal package means
vote-validator can exit cleanly if shutdown is requested by the user.
2023-09-19 08:33:42 +01:00
jholdstock
935dcaece2 multi: Move signal to internal package. 2023-09-19 08:33:42 +01:00
jholdstock
2faaa8b32b vspd: Support SIGTERM on Win and all unix variants
Go 1.14 added runtime support for handling the windows CTRL_CLOSE_EVENT,
CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT events by adding a definition
for syscall.SIGTERM to windows and converting the events to that signal.
It also added definitions for other common signals, including SIGHUP,
and treats them as NOOPs on windows.

Consequently, this modifies the logic that deals with conditionally
handling SIGTERM and SIGHUP to handle them for windows as well as all
unix-like operating systems, including newer ones that are supported by
Go since the code was originally written.

Although the additional signals could probably just be added
unconditionally without too much issue now due to the runtime adding
stubs to all operating systems the project officially supports, it is
safer to be explicit when dealing with syscall definitions since there
is no guarantee that they will exist for newly-added operating systems.
2023-09-19 08:33:42 +01:00
jholdstock
546a87fd5b vspd: Remove shutdownRequestChannel.
The removal of the requestShutdown function in a previous commit means
that the shutdownRequestChannel is no longer needed, so this commit
removes it.
2023-09-19 08:33:42 +01:00
jholdstock
d10e7daf74 vspd: Ensure backup loop runs forever.
Fixing a bug where the backup loop was not a loop - it was only running
one time.
2023-09-18 17:55:29 +01:00
jholdstock
b8cc99e4b6 webapi: Update netParams name in template.
netParams was renamed to Network in a prior commit, but this instance
was not updated.
2023-09-18 09:10:45 +01:00
jholdstock
74729c6cc9 multi: Consider DCP0012 in VSP fee calculations.
Upgrade the dcrwallet dependency to pick up the new version of
txrules.StakePoolTicketFee which considers the status of DCP0012 in its
fee calculation.
2023-09-16 08:36:41 +01:00
jholdstock
73ccfccda8 config: Add DCP12Active func.
The activation heights for DCP0012 are known for mainnet and testnet so
they can be hard-coded.
2023-09-16 08:36:41 +01:00
jholdstock
72b0411ee0 webapi: Refine server start/stop logging.
Don't log errors returned by server.Shutdown. They are exceedingly
unlikely, and there is nothing which can be done about them.

Moving the "Listening on..." log closer to where the server is actually
started reduces the chance of confusion. Also, logging the parsed
listener.Addr() string instead of the provided config string provides
extra debugging detail.
2023-09-16 08:29:17 +01:00
jholdstock
ee4a440534 multi: Move vspd to internal package. 2023-09-16 08:29:17 +01:00