514 Commits

Author SHA1 Message Date
jholdstock
be31d54dac database: Don't run unnecessary upgrades.
New databases are now created at the latest version by default, rather
than being version 1 and immediately requiring all upgrades to be
executed.
2024-06-07 13:10:17 +01:00
jholdstock
1a2b02466c vspd: Wrap RPC connection details in a struct.
Returning a single struct which contains multiple named fields reduces
the chance of a mistake in the calling code, as compared to returning
multiple unnamed values which are all of the same type.
2024-05-30 08:41:10 +01:00
jholdstock
086143fed2 vspd: Move config to internal package.
This enables the config to be reused in multiple binaries - eg. the
upcoming vsp admin binary which will be responsible for writing a
default config file for new vspd deployments.
2024-05-30 08:41:10 +01:00
jholdstock
10457e6110 vspd: Accessors for derived config values.
This enables the derived config values, which are not exported, to still
be accessed after config.go is moved to the internal vspd package.
2024-05-30 08:41:10 +01:00
jholdstock
ba5b1b2990 types: Remove Revoked from VSP info response.
This was marked as deprecated in the previous release and is now being
removed.
2024-05-29 11:02:50 +01:00
jholdstock
ecf2baa193 Begin module dev cycles.
Upcoming changes constitute breaking public API changes to both the
client and types modules, therefore this bumps the version numbers of
both modules and adds local replacements to go.mod files such that the
new versions can be used before they are publicly tagged.
2024-05-29 11:02:50 +01:00
jholdstock
1720fd2062 ci: Simplify run_test.sh script.
Run tests and linters against a hard-coded set of local submodules
instead of attempting to find submodules dynamically.

While this has the obvious drawback of needing to manually update the
list of submodules, it greatly simplifies the script by removing a bunch
of regexes and string manipulation. This trade-off seems worthwhile
because the list of submodules in this repo will not be something which
changes often.

This change makes the script less brittle because it is hard-coded to
always run against the local code, regardless of any changes to module
versionining or project dependencies.
2024-05-29 11:02:29 +01:00
jholdstock
6e558fb283 vspd: Decouple config loading & log initialization
Loading config and preparing loggers are two separate concepts which
should be handled individually. Nesting one inside the other makes
little sense and complicates reusing the code.
2024-05-23 08:39:24 +01:00
jholdstock
64ad28e19b database: Remove log param from CreateNew.
This logger did not write any useful information and all errors
generated by the func are already returned to the caller for logging.
2024-05-23 08:39:24 +01:00
jholdstock
17f993ae83 config: Initialize default config struct directly.
There is no need to declare a dozen different "default..." vars only to
immediately insert them into a default config struct when the struct
itself could just be initialized with the default values instead.
2024-05-23 08:28:42 +01:00
jholdstock
8b6b2e4fef config: Deprecate --configfile.
This removes the --configfile option from vspd. It introduced quite a
few weird edge cases (and a fair bit of code to deal with them) but
afaik nobody actually used it. Note that the --homedir option stays, so
it is still possible to run vspd with config in a non-default location
if required.
2024-05-21 08:44:59 +01:00
jholdstock
2bd340ba08 multi: Explicitly handle help requests.
Checking for --help as an explicit step before parsing any other configs
makes the code more intuitive by removing a convoluted bit of error
handling, which happened to be unnecessarily duplicated in three places.

Moving it to a function in the internal package makes it reusable by
multiple binaries.

This also enables the IgnoreUnknown option to be used whilst parsing for
help, which ensures the presence of --help will always result in the
help message being printed. This fixes a minor inconsistency where the
help message would be printed if the flag was placed before an invalid
config, but placing it after would cause an invalid config error to be
written instead. For example, `vspd --help --fakeflag` vs `vspd
--fakeflag --help`.
2024-05-18 08:42:06 +01:00
jholdstock
ea6f5e8d7e config: Introduce NetworkFromName.
This moves the mapping logic to a more obvious home and enables it to be
reused later.
2024-05-16 08:23:24 +01:00
jholdstock
92a0eb7d4a webapi: Remove unnecessary err check.
err has already been checked and is known to be nil at this point.
2024-05-16 08:22:36 +01:00
jholdstock
15590a6dda ci: Update GitHub actions. 2024-05-14 09:19:17 +01:00
jholdstock
2fef5d29eb ci: Update linter to 1.58.1. 2024-05-14 09:19:17 +01:00
jholdstock
ab5e564867 build: Update to bbolt 1.3.9.
Just bugfixes, no significant new features or API changes.
2024-05-14 07:28:09 +01:00
jholdstock
90e4d96f5b build: Update to gin-gonic 1.10.0.
Picking up some bug fixes and performance improvements. No significant
API changes or new features we can take advantage of.
2024-05-14 07:28:09 +01:00
jholdstock
17e97384e5 v3tool: Remove unnecessary err check.
err has already been checked and is known to be nil at this point.
2024-05-14 07:27:56 +01:00
Jamie Holdstock
cdd02dbd2e database: Use bytes.Clone instead of manual copy.
bytes.Clone was introduced in go 1.20 and removes the need to manually
copy byte slices.
2024-02-16 08:47:03 +08:00
Jamie Holdstock
6a72321ddb build: Update build to go 1.22. 2024-02-16 08:47:03 +08:00
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