reset testnet
This commit is contained in:
parent
e6d7f4ed7f
commit
358be66084
@ -328,7 +328,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
|
||||
std::string strError = "";
|
||||
int nConf = 0;
|
||||
if(!IsCollateralValid(budgetProposalBroadcast.nFeeTXHash, budgetProposalBroadcast.GetHash(), strError, budgetProposalBroadcast.nTime, nConf, GOVERNANCE_FEE_TX)){
|
||||
LogPrintf("Proposal FeeTX is not valid - %s - %s\n", budgetProposalBroadcast.nFeeTXHash.ToString(), strError);
|
||||
LogPrintf("Governance Object FeeTX is not valid - %s - %s\n", budgetProposalBroadcast.nFeeTXHash.ToString(), strError);
|
||||
if(nConf >= 1) vecImmatureBudgetProposals.push_back(budgetProposalBroadcast);
|
||||
return;
|
||||
}
|
||||
|
14
src/main.cpp
14
src/main.cpp
@ -1511,17 +1511,9 @@ CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params&
|
||||
// LogPrintf("height %u diff %4.2f reward %i \n", nPrevHeight, dDiff, nSubsidy);
|
||||
nSubsidy *= COIN;
|
||||
|
||||
// TODO: Remove this to further unify logic among mainnet/testnet/whatevernet,
|
||||
// use single formula instead (the one that is for current mainnet).
|
||||
// Probably a good idea to use a significally lower consensusParams.nSubsidyHalvingInterval
|
||||
// for testnet (like 10 times for example) to see the effect of halving there faster.
|
||||
// Will require testnet restart.
|
||||
if(Params().NetworkIDString() == CBaseChainParams::TESTNET){
|
||||
for(int i = 46200; i <= nPrevHeight; i += consensusParams.nSubsidyHalvingInterval) nSubsidy -= nSubsidy/14;
|
||||
} else {
|
||||
// yearly decline of production by 7.1% per year, projected 21.3M coins max by year 2050.
|
||||
for(int i = consensusParams.nSubsidyHalvingInterval; i <= nPrevHeight; i += consensusParams.nSubsidyHalvingInterval) nSubsidy -= nSubsidy/14;
|
||||
}
|
||||
// updated - 12.1 - unified logic
|
||||
// yearly decline of production by 7.1% per year, projected 21.3M coins max by year 2050.
|
||||
for(int i = consensusParams.nSubsidyHalvingInterval; i <= nPrevHeight; i += consensusParams.nSubsidyHalvingInterval) nSubsidy -= nSubsidy/14;
|
||||
|
||||
// Hard fork to reduce the block reward by 10 extra percent (allowing budget super-blocks)
|
||||
if(nPrevHeight > consensusParams.nBudgetPaymentsStartBlock) nSubsidy -= nSubsidy/10;
|
||||
|
@ -140,12 +140,14 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
{
|
||||
unsigned int retarget = DIFF_DGW;
|
||||
|
||||
if (Params().NetworkIDString() != CBaseChainParams::TESTNET) {
|
||||
// mainnet/regtest share a configuration
|
||||
if (Params().NetworkIDString() == CBaseChainParams::MAIN || Params().NetworkIDString() == CBaseChainParams::REGTEST) {
|
||||
if (pindexLast->nHeight + 1 >= 34140) retarget = DIFF_DGW;
|
||||
else if (pindexLast->nHeight + 1 >= 15200) retarget = DIFF_KGW;
|
||||
else retarget = DIFF_BTC;
|
||||
// testnet -- we want a lot of coins in existance early on
|
||||
} else {
|
||||
if (pindexLast->nHeight + 1 >= 2000) retarget = DIFF_DGW;
|
||||
if (pindexLast->nHeight + 1 >= 3000) retarget = DIFF_DGW;
|
||||
else retarget = DIFF_BTC;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,8 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
||||
|
||||
if(strCommand == "prepare")
|
||||
{
|
||||
if (params.size() != 7)
|
||||
printf("%d\n", params.size());
|
||||
if (params.size() != 6)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Correct usage is 'mngovernance prepare <parent-hash> <revision> <time> <name> <registers-hex>'");
|
||||
|
||||
int nBlockMin = 0;
|
||||
@ -124,16 +125,19 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
||||
std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
|
||||
mnEntries = masternodeConfig.getEntries();
|
||||
|
||||
uint256 hashParent = ParseHashV(params[0], "parameter 1");
|
||||
uint256 hashParent;
|
||||
if(params[1].get_str() == "0") { // attach to root node (root node doesn't really exist, but has a hash of zero)
|
||||
hashParent = uint256();
|
||||
} else {
|
||||
hashParent = ParseHashV(params[1], "fee-tx hash, parameter 1");
|
||||
}
|
||||
|
||||
int nRevision = params[1].get_int();
|
||||
int nTime = params[2].get_int();
|
||||
|
||||
std::string strName = SanitizeString(params[3].get_str());
|
||||
if(strName != params[1].get_str())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Name is invalid");
|
||||
|
||||
std::string strRegisters = params[4].get_str();
|
||||
std::string strRevision = params[2].get_str();
|
||||
std::string strTime = params[3].get_str();
|
||||
int nRevision = boost::lexical_cast<int>(strRevision);
|
||||
int nTime = boost::lexical_cast<int>(strTime);
|
||||
std::string strName = SanitizeString(params[4].get_str());
|
||||
std::string strRegisters = params[5].get_str();
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -142,7 +146,7 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
||||
|
||||
std::string strError = "";
|
||||
if(!budgetProposalBroadcast.IsValid(pindex, strError, false))
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Proposal is not valid - " + budgetProposalBroadcast.GetHash().ToString() + " - " + strError);
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Governance object is not valid - " + budgetProposalBroadcast.GetHash().ToString() + " - " + strError);
|
||||
|
||||
CWalletTx wtx;
|
||||
if(!pwalletMain->GetBudgetSystemCollateralTX(wtx, budgetProposalBroadcast.GetHash(), false)){
|
||||
@ -159,8 +163,8 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
||||
|
||||
if(strCommand == "submit")
|
||||
{
|
||||
if (params.size() != 8)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Correct usage is 'mngovernance submit <parent-hash> <revision> <time> <name> <registers-hex>'");
|
||||
if (params.size() != 7)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Correct usage is 'mngovernance submit <fee-tx> <parent-hash> <revision> <time> <name> <registers-hex>'");
|
||||
|
||||
if(!masternodeSync.IsBlockchainSynced()) {
|
||||
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Must wait for client to sync with masternode network. Try again in a minute or so.");
|
||||
@ -173,16 +177,15 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
||||
std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
|
||||
mnEntries = masternodeConfig.getEntries();
|
||||
|
||||
uint256 hashParent = ParseHashV(params[0], "parameter 1");
|
||||
uint256 fee_tx = ParseHashV(params[1], "fee-tx hash, parameter 1");
|
||||
uint256 hashParent = ParseHashV(params[2], "parent object hash, parameter 2");
|
||||
|
||||
int nRevision = params[1].get_int();
|
||||
int nTime = params[2].get_int();
|
||||
|
||||
std::string strName = SanitizeString(params[3].get_str());
|
||||
if(strName != params[1].get_str())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Name is invalid");
|
||||
|
||||
std::string strRegisters = params[4].get_str();
|
||||
std::string strRevision = params[3].get_str();
|
||||
std::string strTime = params[4].get_str();
|
||||
int nRevision = boost::lexical_cast<int>(strRevision);
|
||||
int nTime = boost::lexical_cast<int>(strTime);
|
||||
std::string strName = SanitizeString(params[5].get_str());
|
||||
std::string strRegisters = params[6].get_str();
|
||||
|
||||
// CGovernanceObject budgetProposalBroadcast(strName, GetTime(), 253370764800, uint256());
|
||||
CGovernanceObject budgetProposalBroadcast(hashParent, nRevision, strName, nTime, uint256());
|
||||
@ -190,7 +193,7 @@ UniValue mngovernance(const UniValue& params, bool fHelp)
|
||||
std::string strError = "";
|
||||
|
||||
if(!budgetProposalBroadcast.IsValid(pindex, strError)){
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Proposal is not valid - " + budgetProposalBroadcast.GetHash().ToString() + " - " + strError);
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Governance object is not valid - " + budgetProposalBroadcast.GetHash().ToString() + " - " + strError);
|
||||
}
|
||||
|
||||
// int nConf = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user