Commit Graph

16 Commits

Author SHA1 Message Date
Tim Flynn
0d324eafa8 rpcgovernance improvements (#1052)
* rpcgovernance improvements
 - Modified govject get to return full object data along with vote counts
 - Cleaned up vote count reporting code

* Added cached flags to gobject get output
2016-09-30 05:48:18 +04:00
Tim Flynn
ce28ad4206 Fixes to rpcgovernance.cpp (#1030)
* Fixes to rpcgovernance.cpp
 - Replaced use of non-unique public key with vin in vote-conf, vote-alias and vote-many
 - Replaced use of non-threadsafe CmasternodeMan::Find function with Get
 - Added LOCK(cs_main) to getgovernanceinfo

* Fixed rpcgovernance.cpp voting error messages
2016-09-19 01:11:03 +04:00
Tim Flynn
fcb985a93f Governance changes (#1029)
* Implemented several governance changes
 - Limit strData size to avoid propagation of very large messages
 - Remove unused CGovernanceObject::SetData method
 - Remove CGovernanceObject::strName field to avoid data redundancy

* Fixed parameter count bug in gobject prepare
2016-09-17 23:37:48 +04:00
Tim Flynn
4e6bb6a375 Fixed incorrect rpcgovernance error/usage message (#1023) 2016-09-16 11:43:15 +04:00
Tim Flynn
906c62e01c Fixes for a number of issues with governance object validation and propagation (#1018)
* Remove unnecessary call to IsCollateralValid and hence allow superblocks
to propagate

* Added CMasternodeMan::Get overload for masternode vin

* Use vin as masternode identifier instead of public key

* Fixed missing member in copy constructor, improved logging

* Added logging for MasternodeRateCheck failures

* Removed pubkeyMasternode field from CGovernanceObject

* Impose MN trigger creation rate limit only when MN info is synced

* Improve rpcgovernance error handling
 - Prevent attempts to prepare trigger objects (and waste the collateral)
 - Improve clarity of gobject submit error messages
2016-09-15 10:49:24 +04:00
UdjinM6
f5738c001f (trivial) governance cleanup (#1011)
* trivial governance cleanup:
- spaces
- names
- no "using namespace std;"
- few log and rpc messages adjusted
- remove unused
- use defined types
- move few members to private

* fixing after code review
2016-09-12 11:40:00 +04:00
Nathan Marley
1043252d43 consistent JSON return value for failed vote (#1001)
* consistent JSON return value for failed vote

* make JSON output for voting results consistent

* result should be either 'success' or 'failed'
* error message belongs in 'errorMessage' field
2016-09-12 05:17:41 +04:00
Nathan Marley
b31ee8441a restore vote-many (#1003) 2016-09-11 21:58:17 +04:00
Tim Flynn
d81e729b0a Governance bug fix (#998)
* Added more specific error message about attempts to submit superblocks by
non-masternodes

* Fixed governance object validation bug

* Fixed logic bug in governance object submission
2016-09-09 19:52:10 +04:00
Tim Flynn
f76f6fbb8e Governance Fixes/Refactoring Pack (#995)
* Improved exception handling
 - Removed attempts to catch exceptions in intermediate helper function calls
 - Made helper functions for JSON parsing private

* Governance voting fixes
 - Converted voting defines to enums for better type safety
 - Enabled gobject voteraw rpc command
 - Removed unused parameter from gobject getvotes rpc command

* Fixed help message for gobject get

* Improved encapsulation of CGovernanceVote objects
 - CGovernanceVote data members are now private
 - Necessary to ensure that enum values are used for signals and outcomes since data members remain int's for compatibility with serialiation code

* Removed unused cs_budget mutex (has been replaced with governance.cs)

* Fix code review issues
 - Restored early return in ConvertVoteSignal
 - Removed special case for "none" string to make clear that NONE is
   for invalid strings
 - Removed commented defines (informational comments preserved)

* Fixed code review issues
 - Fixed error messages for vote-conf, vote-alias and voteraw
 - Removed voteraw from gobject command list and help messages because
   it is actually a top-level command
 - Fixed parameter indices for voteraw
2016-09-08 15:40:19 +04:00
crowning-
a6a0f75614 Merge #982: [RPC] new command 'getsuperblockheight'
1080018 [RPC] new command 'getsuperblockheight' to return the last/next superblock height
2436067 [RPC] new command 'getsuperblockheight' [update 1]
753e00d [RPC] new command 'getsuperblockheight' [update 2]
1ec9289 [RPC] new command 'getsuperblockheight' [update 2]
dbac6e6 [RPC] new command 'getsuperblockheight' [update 3]
e1b7b15 [RPC] new command 'getsuperblockheight' [obsolete include removed]
ee85293 Code review results changes
2016-09-08 13:33:25 +02:00
Tim Flynn
5e564e17d3 Bug fixes for the governance rpc interface (#993)
* Bug fixes for the governance rpc interface
 - Allow use of the gobject getvotes command
 - Fix order of arguments to CGovernanceVote constructor

* Added getvotes to gobject help message and fixed parameter name in the
error/usage message.
2016-09-07 16:02:24 +04:00
Tim Flynn
8c09a459b1 V0.12.1.x governance fees pr (#988)
* Implemented different fees for different types of governance objects

* Added fee amounts to object returned by getgovernanceinfo

* Implement new requireents for Superblock creation
 - Superblocks creation requires a valid masternode signature
 - Superblock creation no longer requires a collateral fee
 - Superblock creation rate is limited to roughly 1 per masternode per cycle

* Fixed getgovernanceinfo help message

* Removed old governance fee constant

* Fixed bug in IsSignatureValid and added debugging code

* Fixed parent hash variable index and added debugging code

* Modified GetBudgetSystemCollateralTX to take fee amount parameter

* Changes due to code review comments
 - Naming changes
 - Removed confusing comment
2016-09-05 03:44:10 +04:00
Tim Flynn
0c65204ee6 Merge #967: V0.12.1.x sentinel pr 1 (#967)
d371930 Added nMinGivernanceQuorum chain parameter

6e24c9c Replace hardcoded minimum with nMinGovernanceQuorum parameter

66c0d9e Added new RPC calls needed by Sentinel
 - getsuperblockcycle
 - getsuperblockbudget
 - getmingovernancequorum

6bb2338 Replaced two new RPC calls with getgovernanceinfo

c9fbd8a Changed parameter nMinGovernanceQuorum to nGovernanceMinQuorum
2016-08-28 13:15:48 -06:00
UdjinM6
67def9ef2e Merge #948 Refactor CDarkSendSigner
f0ed400 darkSendSigner.SignMessage() should not return error message

154f1b6 darkSendSigner.VerifyMessage() should return non-localized message, its callers should populate error to debug.log

b130c32 darkSendSigner.GetKeysFromSecret() should not return error message, its callers should handle it
2016-08-19 05:50:04 -06:00
Tim Flynn
de7b2b6c51 Merge #944: V0.12.1.x governance pr - part 1 - base functionality
068c178 Added DBG macro in util.h to facilitate debugging

    - This macro allows debugging statements (typically printf's or cout's) to
      be activated or deactivated with a single comment.  Uncomment the line:
      //#define ENABLE_DASH_DEBUG
      in util.h to enable debugging statements.

    - When commented any code wrapped with the DBG() macro will simply be removed
      by the preprocessor.  When not commented all such wrapped statements will
      be present.

    - For maximum effectiveness it is best that util.h be the first effective include
      in all source files.  It is also possible to enable the macro for a single file
      by temporarily adding #define ENABLE_DASH_DEBUG to the top of the file.

    - Code committed to non-development branches should always have the define
      commented.

d125d9b V0.12.1.x -- merging trigger/generic object/superblock changes for testnet phase II

    - This commit contains the core governance system changes for 0.12.1.  Any unrelated
      changes have either been removed or moved to separate commits.

120724c File mode fixes

    - Changed mode 0755->0644 on several source files.

c7f9e11 Updated todo reminders

    - Added reminder to revert temporary reduction of number of votes
      required to trigger superblock to 1 for testing

92adc98 Made CSuperblockManager::IsValidSuperblockHeight an inline function

    - This is for efficiency since this function is called often and is
      only 1 line of code.

c050ed7 Added comment explaining rationale for no LOCK(cs) in CSuperblock::IsValid

dc933fe Removed unused CSuperblockManager::IsBlockValid function

decec88 Moved calls to SuperblockManager::IsValidSuperblockHeight into IsSuperblockTriggered.

    - Since calls to the later function are always protected by the former there's
      no reason to keep these separate and this simplifies the code in
      masternode-payments.cpp.

8672885 Reestablished expected value check for non-superblocks in IsBlockValueValid

b01cbe0 Changes to IsBlockValueValid to fix rpc test failure

a937c76 Changed include order to allow per file activation of the DBG macro

d116aa5 Fixed IsValidSuperblockHeight logic

    - Note this has an effect on testing because we can now only create
      1 superblock per day.  Devs may need to temporarily change testnet params
      for easier testing.

2d0c2de Convert superblock payments to CAmount

    - We assume that payment values in JSON are in units of DASH
      for consistency with other RPC functions, such as
      createrawtransaction.

376b833 Revert temporary testing value for nAbsVoteReq

    - Also ensure that number of votes required is never smaller than 1

8c89f4b Cleaned up CSuperblock error handling

    - Exceptions are now thrown consistently rather than using a mix of
      exceptions and return code checking.  Exceptions are now caught only
      in AddNewTrigger when the CSuperblock constructor is called.  Unnecessary object
      status members have been removed.

d7c8a6b Removed utilstrencodings header

    - This appears to help with travis tests, for unknown reasons.

c4dfc7a Fixed some minor code review issues

63c3580 Reverted locking change in miner.

    - This should have been done in the original PR but was overlooked.

4ab72de Fixed variable name to match common practice and bracket formatting

886a678 Improvements to vote conversion code

    - Replaced redundantly defined function with inclusion of governance-vote.h

    - Replaced magic numbers with their corresponding constant symbols

0a37966 Reordered governance message handling
2016-08-17 09:08:25 +02:00