added spork for reseting budget

This commit is contained in:
Evan Duffield 2015-07-08 10:25:47 -07:00
parent a351456c17
commit 8a5ebeaa62
3 changed files with 15 additions and 0 deletions

View File

@ -123,6 +123,10 @@ public:
LogPrintf("Budget object cleared\n"); LogPrintf("Budget object cleared\n");
mapProposals.clear(); mapProposals.clear();
mapFinalizedBudgets.clear(); mapFinalizedBudgets.clear();
mapSeenMasternodeBudgetProposals.clear();
mapSeenMasternodeBudgetVotes.clear();
mapSeenFinalizedBudgets.clear();
mapSeenFinalizedBudgetVotes.clear();
} }
void CheckAndRemove(); void CheckAndRemove();
std::string ToString() {return "not implemented";} std::string ToString() {return "not implemented";}

View File

@ -9,6 +9,7 @@
#include "protocol.h" #include "protocol.h"
#include "spork.h" #include "spork.h"
#include "main.h" #include "main.h"
#include "masternode-budget.h"
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
using namespace std; using namespace std;
@ -88,6 +89,7 @@ bool IsSporkActive(int nSporkID)
if(nSporkID == SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT) r = SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT; if(nSporkID == SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT) r = SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT;
if(nSporkID == SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT) r = SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT_DEFAULT; if(nSporkID == SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT) r = SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT_DEFAULT;
if(nSporkID == SPORK_10_MASTERNODE_PAY_NEWEST_NODES) r = SPORK_10_MASTERNODE_PAY_NEWEST_NODES_DEFAULT; if(nSporkID == SPORK_10_MASTERNODE_PAY_NEWEST_NODES) r = SPORK_10_MASTERNODE_PAY_NEWEST_NODES_DEFAULT;
if(nSporkID == SPORK_11_RESET_BUDGET) r = SPORK_11_RESET_BUDGET_DEFAULT;
if(r == -1) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID); if(r == -1) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID);
} }
@ -111,6 +113,7 @@ int GetSporkValue(int nSporkID)
if(nSporkID == SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT) r = SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT; if(nSporkID == SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT) r = SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT;
if(nSporkID == SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT) r = SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT_DEFAULT; if(nSporkID == SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT) r = SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT_DEFAULT;
if(nSporkID == SPORK_10_MASTERNODE_PAY_NEWEST_NODES) r = SPORK_10_MASTERNODE_PAY_NEWEST_NODES_DEFAULT; if(nSporkID == SPORK_10_MASTERNODE_PAY_NEWEST_NODES) r = SPORK_10_MASTERNODE_PAY_NEWEST_NODES_DEFAULT;
if(nSporkID == SPORK_11_RESET_BUDGET) r = SPORK_11_RESET_BUDGET_DEFAULT;
if(r == 0) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID); if(r == 0) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID);
} }
@ -120,6 +123,10 @@ int GetSporkValue(int nSporkID)
void ExecuteSpork(int nSporkID, int nValue) void ExecuteSpork(int nSporkID, int nValue)
{ {
if(nSporkID == SPORK_11_RESET_BUDGET && nValue == 1){
budget.Clear();
}
} }
@ -214,6 +221,7 @@ int CSporkManager::GetSporkIDByName(std::string strName)
if(strName == "SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT") return SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT; if(strName == "SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT") return SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT;
if(strName == "SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT") return SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT; if(strName == "SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT") return SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT;
if(strName == "SPORK_10_MASTERNODE_PAY_NEWEST_NODES") return SPORK_10_MASTERNODE_PAY_NEWEST_NODES; if(strName == "SPORK_10_MASTERNODE_PAY_NEWEST_NODES") return SPORK_10_MASTERNODE_PAY_NEWEST_NODES;
if(strName == "SPORK_11_RESET_BUDGET") return SPORK_11_RESET_BUDGET;
return -1; return -1;
} }
@ -227,6 +235,7 @@ std::string CSporkManager::GetSporkNameByID(int id)
if(id == SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT) return "SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT"; if(id == SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT) return "SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT";
if(id == SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT) return "SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT"; if(id == SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT) return "SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT";
if(id == SPORK_10_MASTERNODE_PAY_NEWEST_NODES) return "SPORK_10_MASTERNODE_PAY_NEWEST_NODES"; if(id == SPORK_10_MASTERNODE_PAY_NEWEST_NODES) return "SPORK_10_MASTERNODE_PAY_NEWEST_NODES";
if(id == SPORK_11_RESET_BUDGET) return "SPORK_11_RESET_BUDGET";
return "Unknown"; return "Unknown";
} }

View File

@ -33,6 +33,7 @@ using namespace boost;
#define SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT 10007 #define SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT 10007
#define SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT 10008 #define SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT 10008
#define SPORK_10_MASTERNODE_PAY_NEWEST_NODES 10009 #define SPORK_10_MASTERNODE_PAY_NEWEST_NODES 10009
#define SPORK_11_RESET_BUDGET 10010
#define SPORK_2_INSTANTX_DEFAULT 978307200 //2001-1-1 #define SPORK_2_INSTANTX_DEFAULT 978307200 //2001-1-1
#define SPORK_3_INSTANTX_BLOCK_FILTERING_DEFAULT 1424217600 //2015-2-18 #define SPORK_3_INSTANTX_BLOCK_FILTERING_DEFAULT 1424217600 //2015-2-18
@ -41,6 +42,7 @@ using namespace boost;
#define SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT 1444217600 //OFF #define SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT 1444217600 //OFF
#define SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT_DEFAULT 1444217600 //OFF #define SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT_DEFAULT 1444217600 //OFF
#define SPORK_10_MASTERNODE_PAY_NEWEST_NODES_DEFAULT 1444217600 //OFF #define SPORK_10_MASTERNODE_PAY_NEWEST_NODES_DEFAULT 1444217600 //OFF
#define SPORK_11_RESET_BUDGET_DEFAULT 0
class CSporkMessage; class CSporkMessage;
class CSporkManager; class CSporkManager;