Commit 58711463 authored by coin-server's avatar coin-server

Change of mainnet spork keys

parent f3361659
......@@ -99,6 +99,8 @@ public:
nMaxMoneyOut = 100000000 * COIN;
nLastPOWBlock = 57601;
nModifierUpdateBlock = 50;
nEnforceNewSporkKey = 1554685200;
nRejectOldSporkKey = 1557277200;
const char* pszTimestamp = "ABC News 24/DEC/2018 Trump's Treasury Secretary to convene 'Plunge Protection Team' to deal with Wall Street rout";
CMutableTransaction txNew;
......@@ -142,7 +144,8 @@ public:
fHeadersFirstSyncingActive = false;
nPoolMaxTransactions = 3;
strSporkKey = "0421783d5f8b38c2f71f10a7e8a4c5df39bfe1d3ca10dd17e5fc76ff5b523ab21e89ae0276aae967d0d7f26c3f34136acdc0a2f41bab19cc262658703f38a3da55";
strSporkKey = "04b86d4321e8aa926be7d366057ba41dbad32fdc7e5efa78d284ffc9d45ea63c796d58dc2f9050d9c83006bc7bce31d79f7bc84a59a4472718e245dccfe763b435";
strSporkKeyOld = "0421783d5f8b38c2f71f10a7e8a4c5df39bfe1d3ca10dd17e5fc76ff5b523ab21e89ae0276aae967d0d7f26c3f34136acdc0a2f41bab19cc262658703f38a3da55";
strObfuscationPoolDummyAddress = "MERGEXXXXXXXXXXXXXXXXXXXXXXXYmkoB4";
nStartMasternodePayments = genesis.nTime + 5400;
nBudget_Fee_Confirmations = 6;
......
......@@ -91,6 +91,9 @@ public:
virtual const Checkpoints::CCheckpointData& Checkpoints() const = 0;
int PoolMaxTransactions() const { return nPoolMaxTransactions; }
std::string SporkKey() const { return strSporkKey; }
std::string SporkKeyOld() const { return strSporkKeyOld; }
int64_t NewSporkStart() const { return nEnforceNewSporkKey; }
int64_t RejectOldSporkKey() const { return nRejectOldSporkKey; }
std::string ObfuscationPoolDummyAddress() const { return strObfuscationPoolDummyAddress; }
int64_t StartMasternodePayments() const { return nStartMasternodePayments; }
int64_t Budget_Fee_Confirmations() const { return nBudget_Fee_Confirmations; }
......@@ -139,6 +142,9 @@ protected:
bool fHeadersFirstSyncingActive;
int nPoolMaxTransactions;
std::string strSporkKey;
std::string strSporkKeyOld;
int64_t nEnforceNewSporkKey;
int64_t nRejectOldSporkKey;
std::string strObfuscationPoolDummyAddress;
int64_t nStartMasternodePayments;
int64_t nBudget_Fee_Confirmations;
......
......@@ -77,14 +77,22 @@ void ProcessSpork(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
uint256 hash = spork.GetHash();
if (mapSporksActive.count(spork.nSporkID)) {
if (mapSporksActive[spork.nSporkID].nTimeSigned >= spork.nTimeSigned) {
if (fDebug) LogPrintf("spork - seen %s block %d \n", hash.ToString(), chainActive.Tip()->nHeight);
if (fDebug) LogPrintf("%s : seen %s block %d \n", __func__, hash.ToString(), chainActive.Tip()->nHeight);
return;
} else {
if (fDebug) LogPrintf("spork - got updated spork %s block %d \n", hash.ToString(), chainActive.Tip()->nHeight);
if (fDebug) LogPrintf("%s : got updated spork %s block %d \n", __func__, hash.ToString(), chainActive.Tip()->nHeight);
}
}
LogPrintf("spork - new %s ID %d Time %d bestHeight %d\n", hash.ToString(), spork.nSporkID, spork.nValue, chainActive.Tip()->nHeight);
LogPrintf("%s : new %s ID %d Time %d bestHeight %d\n", __func__, hash.ToString(), spork.nSporkID, spork.nValue, chainActive.Tip()->nHeight);
if (spork.nTimeSigned >= Params().NewSporkStart()) {
if (!sporkManager.CheckSignature(spork, true)) {
LogPrintf("%s : Invalid Signature\n", __func__);
Misbehaving(pfrom->GetId(), 100);
return;
}
}
if (!sporkManager.CheckSignature(spork)) {
LogPrintf("spork - invalid signature\n");
......@@ -130,7 +138,7 @@ int64_t GetSporkValue(int nSporkID)
if (nSporkID == SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2) r = SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2_DEFAULT;
if (nSporkID == SPORK_16_ZEROCOIN_MAINTENANCE_MODE) r = SPORK_16_ZEROCOIN_MAINTENANCE_MODE_DEFAULT;
if (r == -1) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID);
if (r == -1) LogPrintf("%s : Unknown Spork %d\n", __func__, nSporkID);
}
return r;
......@@ -176,13 +184,23 @@ void ReprocessBlocks(int nBlocks)
}
}
bool CSporkManager::CheckSignature(CSporkMessage& spork)
bool CSporkManager::CheckSignature(CSporkMessage& spork, bool fCheckSigner)
{
//note: need to investigate why this is failing
std::string strMessage = boost::lexical_cast<std::string>(spork.nSporkID) + boost::lexical_cast<std::string>(spork.nValue) + boost::lexical_cast<std::string>(spork.nTimeSigned);
CPubKey pubkeynew(ParseHex(Params().SporkKey()));
std::string errorMessage = "";
if (obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage)) {
if (fCheckSigner && !obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig,strMessage, errorMessage))
return false;
if (GetAdjustedTime() < Params().RejectOldSporkKey()) {
CPubKey pubkeyold(ParseHex(Params().SporkKeyOld()));
if (obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage) ||
obfuScationSigner.VerifyMessage(pubkeyold, spork.vchSig, strMessage, errorMessage)) {
return true;
}
}
else if (obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage)) {
return true;
}
......@@ -247,7 +265,7 @@ bool CSporkManager::SetPrivKey(std::string strPrivKey)
Sign(msg);
if (CheckSignature(msg)) {
if (CheckSignature(msg, true)) {
LogPrintf("CSporkManager::SetPrivKey - Successfully initialized as spork signer\n");
return true;
} else {
......@@ -288,4 +306,3 @@ std::string CSporkManager::GetSporkNameByID(int id)
return "Unknown";
}
......@@ -117,10 +117,9 @@ public:
int GetSporkIDByName(std::string strName);
bool UpdateSpork(int nSporkID, int64_t nValue);
bool SetPrivKey(std::string strPrivKey);
bool CheckSignature(CSporkMessage& spork);
bool CheckSignature(CSporkMessage& spork, bool fCheckSigner = false);
bool Sign(CSporkMessage& spork);
void Relay(CSporkMessage& msg);
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment