547 Commits

Author SHA1 Message Date
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
6caaac0442 Remove global dcrd/dcrwallet clients 2020-06-09 13:12:43 +00:00
jholdstock
591437658d Don't shutdown if dcrd or dcrwallet rpc fails 2020-06-09 13:12:43 +00:00
jholdstock
10258f9c29 Mention ssl in deployment docs. 2020-06-09 13:11:46 +00:00
David Hill
83514385d6
change feeamount from float64 to int64/atoms (#121) 2020-06-09 08:08:14 +01:00
David Hill
873d89e412
remove fee transactions if dcrd rejects it. (#114) 2020-06-08 17:31:22 +01: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
b50615bc6f Add very basic admin page. 2020-06-08 15:24:49 +00:00
jholdstock
144060c3cb Add adminpass config item. 2020-06-08 15:24:49 +00:00
jholdstock
9f02063c86 Sign error responses. 2020-06-08 15:21:23 +00:00
jholdstock
0318eded95 Move feeAddressExpiration into webapi package. 2020-06-08 12:27:45 +00:00
jholdstock
443db9a7b9 Log dcrutil.Amount rather than float 2020-06-06 23:15:19 +00:00
jholdstock
3136038746 Shorten db keys 2020-06-05 17:21:26 +00:00
jholdstock
4d47bc6df8 Handle "transaction already exists" error 2020-06-05 16:19:46 +00:00
jholdstock
e3d7ab6e75 Run background tasks immediately on startup. 2020-06-05 16:17:43 +00:00
David Hill
eeaefab280
webapi: validate script version in fee transaction (#112) 2020-06-05 17:00:13 +01:00
jholdstock
1c92856303 Ensure provided private key matches ticket 2020-06-05 15:33:56 +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
8a4053f29f Reinstate check for confirmed tickets. 2020-06-04 15:04:39 +00:00
jholdstock
fc5749545d Reverse order of addtx and importprivkey 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
dcfc2e969d Check if fee already paid before checking if ticket is votable 2020-06-03 15:48:21 +00:00
jholdstock
fb4dd039d8 Prompt before wiping harness directory 2020-06-03 15:46:57 +00:00
jholdstock
7da79c7561 Simplify dcrd and dcrwallet client creation. 2020-06-03 15:46:24 +00:00
jholdstock
fb6ea54f15 Add tmux test harness. 2020-06-03 12:50:16 +00:00
jholdstock
381cf9e5a2 Add deployment guide. 2020-06-03 12:49:43 +00:00
jholdstock
4feed5e884 Fix off-by-one 2020-06-03 12:49:14 +00: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
jholdstock
1270f77fd6 Return err if fee tx already received. 2020-06-03 12:45:42 +00:00
jholdstock
2488623435 Make default config match docs. 2020-06-03 12:43:14 +00:00
jholdstock
2a476d9589 Validate fee config 2020-06-03 12:43:14 +00:00
jholdstock
85a806fb3a Tidy docs 2020-05-29 19:09:25 +00:00
jholdstock
2956285e61 Fix link 2020-05-29 19:09:25 +00:00
jholdstock
86fdf888da Move to decred github org 2020-05-28 12:29:42 -05:00
Jamie Holdstock
4b2a68ea48
Populate ticket status response. (#82) 2020-05-28 18:05:56 +01:00
Jamie Holdstock
1a507badc2
Multi wallet fix (#83)
* Fix min required check

* Remove duplicated host logging on conn errors.

* Show confirmed tickets on homepage.
2020-05-28 15:01:44 +01: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
6a100811f4
Enable pool closure (#80)
* Enable pool closure.

* Move homepage to its own file

* Docs and rename status>info
2020-05-28 07:07:33 +01:00
Jamie Holdstock
e65a7fdbf3
Set values early to prevent races (#77) 2020-05-28 06:58:44 +01:00
Jamie Holdstock
6b6bc20522
Periodically write a database backup. (#76) 2020-05-28 06:58:34 +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
d5eb18f557
Add support email and pubkey to GUI (#74)
* Add support email to gui.

* Use Decred fonts

* Use Decred favicon

* Add pubkey to homepage. Use properly typed struct for template data.

* go mod tidy
2020-05-27 15:36:11 +01:00
Jamie Holdstock
d0dedd3af0
Resolving some TODOs (#71)
* Dont allow duplicate fee addresses

* Load webapi keypair in webapi package.

* Split database test file

* Add extra DB testing.
2020-05-27 14:55:59 +01:00
Jamie Holdstock
e1a18804ac
Check dcrwallet and dcrd config (#70)
* Verify dcrd network and txindex

* Verify dcrwallet network
2020-05-27 14:45:06 +01:00
Jamie Holdstock
ccafd8dec4
Calculate fee from percentage. (#69)
* Calculate fee from percentage.

- Reverted config to accept a fee percentage, not absolute value.
- The fee amount to be paid is now included in the `getfeeaddress` response. The current best block is used to calculate the fee percentage, and new blocks may be mined before the fee is paid, so the fee expiry period is shortened from 24 hours to 1 hour to mitigate this.
- Rename ticket db field to FeeAmount so it is more representative of the data it holds.
- API fields renamed to "FeePercentage" and "FeeAmount"
- Relay fee is still hard coded.

* Use getbestblockhash
2020-05-27 14:44:40 +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