neobytes/src/drafted/governance-classes.h

646 lines
18 KiB
C
Raw Normal View History

2016-12-20 14:26:45 +01:00
// Copyright (c) 2014-2017 The Dash Core developers
2016-04-08 19:47:00 +02:00
/*
* FIELDS AND CLASSIFICATION
* --------------------
*
* -- fields can be updated by the network dynamically (adding a company type, etc)
* -- fields can be voted on, leveling them up/down
* -- levels determine pay in DO/DAO company types
*
* FIELDS
* =========================
*
* network-type mainnet, testnet, regtest
* actor-type group, user, dao, company, committee, foundation
* group-type core, noncore
* dao-type none
* company-type us.llc, us.501c3, us.501c6, us.inc, etc
* committee-type science, technology, economics
* foundation-type us.501c6, us.501c3
* contract-type blockchain/internal, external/contractor
* proposal-type explicit, governance, wikiamend, generic, black
*
* lvl 1,2,3,4.. roman
* status ok, error, active-removal
* proposal-rights explicit, explicit_generic, all
* contract-rights internal, external
* status-error missing-documentation, doa, report-outstanding
* milestone-status research, hiring, ongoing, complete, failure, overdue, error //programmatic workflow?
* milestone-status-error mia, option2, option3
* network-status ok, error
* network-error none, fork-detected, debug, full-blocks, network-outage, spam
* foundation-type maintainance, r&d, awareness, bridge(legacy), philanthropic, legal
* committee-type business, sciencific_advisory, research
* global-type-variable switch, int, string, enum // enum should be defined by another category
* category-type primary, secondary, tertiary, quaternary, quinary, senary, septenary, octonary
* contract-status ok, error
* cantract-status-error none, error1, error2
* committee-type research, business_advisory, economic_advisory
*
* // note: How enums work
* enum-type one, two, three //defined in code, or the defintion could be packed ino this field
*
* CLASSES
* =========================
*
* // network
* CDashNetwork lvl, network-type, network-status, network-error, milestone-status*
* CCategory lvl, category-type, status, status-error
* CNetworkGlobalVariable lvl, global-type, status, status-error
* // base: actor
* CGroup lvl, actor-type, status, status-error, group-type
* CUser lvl, actor-type, status, status-error, user-type, contract-status, contract-status-error
* CDAO lvl, actor-type, status, status-error, dao-type
* CCompany lvl, actor-type, secondary-type, ternary-type, status, status-error
* CCommittee lvl, actor-type, status, status-error, committee-type ov
* CFoundation lvl, actor-type, status, status-error, foundation-type ov
* // base: project manangement
* CProposal lvl, proposal-type, status, status-error
* CContract lvl, contract-type, status, status-error, proposal-rights, contract-rights
* CProject lvl, project-type, status, status-error
* CProjectReport lvl, report-type, status, status-error
* CProjectMilestone lvl, milestone-type, status, status-error, milestone-status, milestone-status-error, ov
* CValueOverride lvl, vo-type, status, status-error
*/
/*
* CLASS INHERITANCE
* ============================================================
*
* -- Each of the implementable classes use their own serializers
* -- Each class is responsible for it's own unique values
* -- Most of the values in these classes can be overriden
*
* CGovernanceNode (base)
*
* TREE STRUCTURE
* ===========================================
*
* DASH NETWORK (ROOT)
* -> NETWORK GLOBOLS
* -> SWITCHES, SETTINGS
* -> CATEGORIES
* -> CATEGORY (DAO)
* -> CATEGORIES ()
* -> CATEGORY (CONTRACT)
* -> CATEGORIES (INTERNAL, EXTERNAL, ...)
* -> GROUPS
* -> GROUP 1
* -> USER : ENDUSER
* -> COMPANIES
* -> DAO
* -> COMPANY, COMMITTEE, FOUNDATION, ..
* -> GROUP1 (CORE)
* - USER : EVAN DUFFIELD
* -> CONTRACT1 (INTERNAL CONTRACT)
* -> PROJECT1
* -> PROJECT1
* -> CONTRACT2 (EXTERNAL CONTRACT)
* -> PROPOSAL (GENERIC FUNDING)
* -> VO (OUTPUT VALUE == 3.23) // NETWORK OVERRIDE
* -> REPORT1
* -> REPORT2
* -> REPORT3
* -> MILESTONE1
* -> MILESTONE2
* -> OV (STATUS=OVERDUE)
**/
class CGovernanceObject : public CGovernanceNode
{
private:
// some minimal caching is supported here
int nLevel;
std::string strCategory;
// Current OBJECT STATUS (see http://govman.dash.org/index.php/Documentation_:_Status_Field)
int nStatusID;
std::string strStatusMessage;
// minimal caching
uint64_t nTimeValueOverrideCached;
public:
virtual uint256 GetHash() = 0;
};
// // root node
class CDashNetwork : public CGovernanceObject
{
private:
std::string strName;
std::string strURL;
public:
CDashNetwork(UniValue objIn)
{
strName = objIn["name"].get_str();
strURL = objIn["name"].get_str();
// we should pop these off one by one and check if the objIn.size() == 0
}
uint256 GetHash(){
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
ss << strName;
ss << strURL;
ss << nTime;
ss << vecSig;
ss << nGovernanceType;
uint256 h1 = ss.GetHash();
return h1;
}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// TODO : For testnet version bump
READWRITE(nGovernanceType);
READWRITE(LIMITED_STRING(strName, 20));
READWRITE(LIMITED_STRING(strURL, 64));
READWRITE(nTime);
READWRITE(vecSig);
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
READWRITE(nCollateralHash);
2016-04-08 19:47:00 +02:00
}
};
// // can be under: DashNetwork
// // -- signature requirements : Key1(User)
// class CDashNetworkVariable : public CGovernanceObject
// {
// private:
// public:
// virtual uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
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
// READWRITE(nCollateralHash);
2016-04-08 19:47:00 +02:00
// }
// };
// /*
// ValueOverride
// */
// // can be under: ANY
// // -- signature requirements : Key1(User)
// template <typename VO>
// class CValueOverride : public CGovernanceObject
// {
// // bool GetValues(VO& a)
// // {
// // return nValue1;
// // }
// // bool GetValues2(VO& a, VO& b)
// // {
// // return nValue1;
// // }
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
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
// READWRITE(nCollateralHash);
2016-04-08 19:47:00 +02:00
// }
// };
// class CCategory : public CGovernanceObject
// {
// // **** Statistics / Information ****
// CAmount GetRequiredFeeAmount() {return 1.00;}
// CCategory GetLevel() {return (CCategory)GetCategory(0);}
// CCategory GetCategoryType() {return (CCategory)GetCategory(1);}
// CCategory GetStatus() {return (CCategory)GetCategory(2);}
// CCategory GetStatusError() {return (CCategory)GetCategory(3);}
// // isRootCategory()
// // {
// // // root categories won't have categories as parents
// // return (IsType() == DashNetwork);
// // }
// // isSubcategoryOf(std::string strParentName)
// // {
// // CCategory parent(strParentName);
// // if(!parent) return false;
// // return isSubcategoryOf(parent);
// // }
// // isSubcategoryOf(CCategory parentIn)
// // {
// // // are we related to this category?
// // if parent.GetHash() == pParent->GetHash():
// // return true
// // return false;
// // }
// // **** Governance Permissions ****
// // only allow categories under categories
// virtual bool CanAdd(CCategory obj) {return true;}
// virtual bool RequiresSignatureToAddChild(CCategory obj) {return false;}
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
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
// READWRITE(nCollateralHash);
2016-04-08 19:47:00 +02:00
// }
// };
// // base: actor class
// class CGovernanceActor : public CGovernanceObject
// {
// /*
// ???
// GetAverageMonthlySpending();
// GetYearlySpent();
// GetContractCount(CCategory category)
// */
// };
// class CGroup : public CGovernanceActor
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// };
// class CUser : public CGovernanceActor
// {
// public:
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
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
// READWRITE(nCollateralHash);
2016-04-08 19:47:00 +02:00
// }
// };
// // base: actor classes
// class CCompany : public CGovernanceActor
// {
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
// }
// };
// class CProject : public CGovernanceObject
// {
// public:
// std::string strName;
// std::string GetURL();
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
// }
// };
// class CProjectReport : public CGovernanceObject
// {
// private:
// std::string strName;
// std::string GetURL;
// public:
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
// }
// };
// class CProjectMilestone : public CGovernanceObject
// {
// private:
// // specialized class variables
// public:
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
// }
// };
// class CProposal : public CGovernanceObject
// {
// private:
// // specialized class variables
// std::string strName;
// std::string strURL;
// /*
// proposal will be paid on this block
// -- if it's not paid, it will expire unpaid
// */
// int nBlockStart;
// CAmount nAmount;
// CScript address;
// public:
// // **** Statistics / Information ****
// std::string GetName() {return strName; }
// CScript GetPayee() {return address;}
// std::string GetURL() {return strURL; }
// // nothing can be under a proposal
// // signatures required for everything
// virtual bool RequiresSignatureToAddChild(CGovernanceNode obj) {return true;}
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
// }
// };
// class CContract : public CGovernanceObject
// {
// private:
// std::string strName;
// std::string strURL;
// int nBlockStart; //starting block
// int months_active; //nBlockEnd = nBlockStart + (blocks-per-month * months_active)
// CAmount nAmount;
// CScript address;
// public:
// uint256 GetHash(){
// CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
// ss << strName;
// ss << strURL;
// ss << nBlockStart;
// ss << nBlockEnd;
// ss << nAmount;
// ss << *(CScriptBase*)(&address);
// ss << nGovernanceType;
// uint256 h1 = ss.GetHash();
// return h1;
// }
// ADD_SERIALIZE_METHODS;
// template <typename Stream, typename Operation>
// virtual inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
// // TODO : For testnet version bump
// READWRITE(nGovernanceType);
// READWRITE(LIMITED_STRING(strName, 20));
// READWRITE(LIMITED_STRING(strURL, 64));
// READWRITE(nTime);
// READWRITE(vecSig);
// }
// };
bool CreateNewGovernanceObject(UniValue& govObjJson, CGovernanceNode& govObj, GovernanceObjectType govType, std::string& strError);
#endif