32 Commits

Author SHA1 Message Date
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
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
4a207b15f8 Add missing copyright notices 2020-08-19 20:22:12 +00:00
jholdstock
4bcfa80dc4 Fix admin page load when no wallet clients connected. 2020-08-07 17:03:27 +00:00
jholdstock
bcb6fd5ec3 Don't export types unnecessarily 2020-08-07 17:03:03 +00:00
jholdstock
9d503e67ae Wallet consistency checks & setting ticket outcome 2020-07-28 20:09:23 +00:00
jholdstock
8c3cab7942 API versioning 2020-07-17 14:31:42 +00:00
jholdstock
08be1fa55a Log failing wallet client 2020-06-30 14:57:38 +00:00
jholdstock
5e8ef4e7f2 Prefix for dcrd/dcrwallet/db errors 2020-06-25 15:45:01 +00:00
jholdstock
0e953dc225 Add extra debug info to log messages 2020-06-25 15:45:01 +00:00
jholdstock
9d6cf57219 Add funcName to web api logs 2020-06-25 15:45:01 +00:00
jholdstock
ed21f0af64 Don't put request bytes into context. 2020-06-22 16:23:31 +00:00
jholdstock
5af2f595ac Remove //TODOs which are already resolved. 2020-06-15 13:32:05 +00:00
jholdstock
4f2766352b Improve handling of fee status.
- Fee tx status is now tracked using a dedicated field, with values none/received/broadcast/confirmed/error.
- Fee tx hex and hash are now both set in /payfee. The absense of txhash is no longer used to determine if a fee tx has been broadcast or not.
- setvotechoices can no longer be called before a fee is received.
- Remove `binding:required` from response types. It has no effect on responses, it is only needed on request types which are validated by gin.
2020-06-09 14:17:43 +00:00
jholdstock
9f48bae78e Return parsable error codes instead of just a string.
Also
- Check if VSP is closed before /payfee
2020-06-08 15:33:06 +00:00
jholdstock
a6d9b79619 Tolerate dcrwallet connection failures.
If at least 1 wallet connection succeeds, vspd should proceed to use the connected wallet(s). Only error out if all wallet connections fail.
2020-06-04 15:56:43 +00:00
jholdstock
c7835e8811 Update log level and add some TODOs 2020-06-04 15:04:39 +00:00
jholdstock
7da79c7561 Simplify dcrd and dcrwallet client creation. 2020-06-03 15:46:24 +00:00
jholdstock
86fdf888da Move to decred github org 2020-05-28 12:29:42 -05:00
jholdstock
225dcaf29e multi wallet support (#32)
* multiwallet

* print host

Co-authored-by: Jamie Holdstock <jholdstock@decred.org>
2020-05-28 12:52:06 +01:00
Jamie Holdstock
d275fddf1b
Remove votechoices from setVoteChoices response. (#81) 2020-05-28 06:58:26 +01:00
Jamie Holdstock
67dece7041
Rename to vspd. (#75) 2020-05-27 15:59:30 +01:00
Jamie Holdstock
d5c949b9ad
Split docs into seperate files (#72) 2020-05-27 15:36:21 +01:00
Jamie Holdstock
87500c3fef
Delay fee broadcast and adding tickets to wallets. (#62)
* Delay fee broadcast and adding tickets to wallets.

- Adds a `background` package which implements a dcrd notification handler.  On each blockconnected notification, tickets with 6+ confirmations are marked confirmed, relevant fee transactions are broadcast, and any fees with 6+ confirmations have their tickets added to voting wallets.
- VSP fee is now an absolute value measured in DCR rather than a percentage. This simplifies the code and is more appropriate for an MVP. We can re-add percentage based fees later.
- Database code for tickets is now simplified to just "Insert/Update", rather than having functions for updating particular fields.
- Pay fee response no longer includes the fee tx hash, because we dont necessarily broadcast the fee tx straight away.

* Const for required confs
2020-05-27 06:39:38 +01:00
Jamie Holdstock
86c4195931
Replace local fee wallet with dcrd. (#61) 2020-05-26 17:30:51 +01:00
Jamie Holdstock
ac488464c0
Rework client/server authentication. (#58)
* Rework client/server authentication.

- Remove Signature from all requests, and instead expect a signature in HTTP header "VSP-Client-Signature".
- Remove CommitmentSignatures from the database.
- Use a bool flag to indicate when a ticket is missing from the database rather than an error.

This commit introduces a lot of duplication into each of the authenticated HTTP handlers. This should be removed in future work which moves the authentication to a dedicated middleware.

* Introduce auth and rpc middleware.

This removed the duplication added in the previous commit, and also removes the duplication of RPC client error handling.
2020-05-26 14:14:38 +01:00
Jamie Holdstock
96608718a0
Cleaning up some TODOs (#50) 2020-05-22 18:42:51 +01:00
Jamie Holdstock
740b9c8e0f
Get relay fee from wallet (#47) 2020-05-22 15:09:51 +01:00
Jamie Holdstock
68e3fca59c
Add context to RPC wrapper (#53) 2020-05-22 14:58:28 +01:00
Jamie Holdstock
869b68fad5
Split voting wallet and fee wallet clients (#45) 2020-05-22 07:54:09 +01:00
Jamie Holdstock
bb416e8bc9
Set vote choices on voting wallets (#43) 2020-05-21 07:59:51 +01:00