19 Commits

Author SHA1 Message Date
jholdstock
618cfc7cf1 vspd: Remove simnet params.
Simnet params were added in the very first commit of vspd purely because
of copy/pasting from another project.

vspd has never actually been tested on simnet, so its possible
(probable) that it won't even operate correctly without additional dev
work. If we want simnet to be a properly supported network it can be
re-added and tested in the future.
2023-08-26 09:33:30 +01:00
jholdstock
49b9db1a64 rpc: Fix block connected handler.
Fix a bug where it appeared as though a notification handler was being
attached to the dcrd RPC client, but actually no notifications were
received until the client was disconnected a new one was created.

Now, rather than delaying attaching the notification handler, it is
attached immediately upon client creation and vspd does not start
handling the received notifications until it is ready.
2023-08-24 07:27:04 +01:00
jholdstock
bac0dcef71 multi: Hoist database integrity checks up to vspd.
Moving the existing integrity checks up into vspd removes the
depdendancy on rpc clients from the database client, and also creates a
natural home for future integrity checks to be added.
2023-08-23 12:48:19 +01:00
jholdstock
b1fbced17c vspd: Move vspd code to its own file.
Moving all vspd code into its own vspd.go file (fka background.go). This
leaves main.go as a minimal entry point for the vspd executable.
2023-08-23 12:32:14 +01:00
jholdstock
4419ae3a6e vspd: Introduce vspd struct.
Storing all of the essential resources such as db, rpcs and logger in a
vspd struct enables vspd functions to be called without passing a bunch
of parameters unnecessarily. This will be increasingly useful later when
further changes are introduced.
2023-08-23 12:32:14 +01:00
jholdstock
c039dc86cb multi: Use const instead of var when possible. 2023-08-22 15:58:48 +01:00
jholdstock
bca2a32a30 database: Add TicketList struct.
This enables a func to find the earliest purchase height to be reused in
multiple packages.
2023-08-22 15:58:48 +01:00
jholdstock
8b50fe619a vspd: Simplify shutdown listener.
The existing signal.go was inherited directly from dcrwallet, and was
slightly more flexible/complicated than required for vspd. This brings
the code more inline with the dcrd implementation which can be
instantiated in one line and with only one parameter.
2023-08-22 15:10:03 +01:00
jholdstock
350a3f5bb2 vspd: Create context and waitgroup near usage.
Creating these closer to where they are needed tidies things up a bit,
and reduces the chance of them being used unnecessarily (as was being
done previously).
2023-08-21 08:33:54 +01:00
jholdstock
bd41dbee63 vspd: Listen for dcrd notifs after startup.
Only attach the dcrd notification listener after all other startup tasks
have been completed.

Attaching the listener before this can result in the notification
handler being invoked whilst startup tasks are still running, which
isn't necessarily a problem, but it is unnecessary and makes a mess of
logging.
2023-08-21 08:33:54 +01:00
Jamie Holdstock
f46ffcb60d
docs: Review and polish existing docs. (#390)
Also includes a couple of updates to comments in webapi code.
2023-06-13 13:22:57 -05:00
Jamie Holdstock
203bf7d2e6
build: Update linter to 1.53.2 (#384)
* build: Update linter to 1.53.2

* database: Rename helpers.go to encoding.go

* database: Ignore json.Marshal errors.
2023-06-05 09:39:01 -05:00
Jamie Holdstock
08ea48f7a3
Update decred dependencies. (#378)
* webapi: Use types 2.0.0

* v3tool: Use types 2.0.0

* Update decred dependencies.
2023-04-12 08:16:29 -05:00
Jamie Holdstock
6b99c5d2b5
webapi: Use types 2.0.0 (#376)
* webapi: Use types 2.0.0

* v3tool: Use types 2.0.0
2023-04-12 08:12:53 -05:00
Jamie Holdstock
b5ac64891e
Add v3tool. (#366)
This commit adds a new executable - v3tool - a developer testing tool which hits endpoints of the vspd API.
2023-03-24 13:10:44 -05:00
Jamie Holdstock
d00ba70f94
vspd: Fix invalid default config log level. (#371)
* vspd: Fix invalid default config log level.

slog.LevelDebug.String() returns "DBG" which is not valid per the config validation rules specified below. Hard-code "debug" instead.

* Update year.
2023-02-24 09:55:25 -05:00
Jamie Holdstock
8bb868a5a5
Add vote-validator tool. (#335)
vote-validator is a tool for VSP admins to verify that their vspd deployment
is voting correctly according to user preferences.
2022-11-18 15:05:38 -05:00
jholdstock
32790984fe Make database backups optional.
Periodic database backups are no longer started automatically in database.Open(), and the backup written by database.Close() can now be disabled.

Only vspd itself requires backups, they are not useful for test code or future upcoming tools such as vote-validator.
2022-09-29 14:54:40 +01:00
Jamie Holdstock
11401c5369
Move vspd into cmd directory. (#352)
* Update linter to 1.49.0

* Move vspd into cmd directory.

This is standard practise in Decred golang repos. Especially useful when multiple executables are built from a single repo.

* Ignore bins in new dir.
2022-09-27 08:54:23 -05:00