Skip to content

Commit

Permalink
3.5.8.2-Mandatory
Browse files Browse the repository at this point in the history
Gridcoin Research 3.5.8.2/MSI=41.7
Mandatory Upgrade

- At block 725000 we require blocks to be signed with keypairs.
- Enable binary superblocks at block 725000.
- When keys expire at the 6 month interval, check the keypair by signing
a Test block, and if good, renew the keypair, otherwise generate a new
keypair and a new beacon and save the new keypair automatically.
(The wallet will repair the keypair if one of two keys are missing).
- Note: execute beaconstatus to find the status of your Prod keypair.
  • Loading branch information
gridcoin committed Nov 2, 2016
1 parent 887cb93 commit 4fd5fa2
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile.Debug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: gridcoinresearch
# Generated by qmake (2.01a) (Qt 4.8.4) on: Sat Oct 15 14:29:26 2016
# Generated by qmake (2.01a) (Qt 4.8.4) on: Tue Nov 1 19:00:49 2016
# Project: gridcoinresearch.pro
# Template: app
#############################################################################
Expand Down
2 changes: 1 addition & 1 deletion Makefile.Release
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: gridcoinresearch
# Generated by qmake (2.01a) (Qt 4.8.4) on: Sat Oct 15 14:29:26 2016
# Generated by qmake (2.01a) (Qt 4.8.4) on: Tue Nov 1 19:00:49 2016
# Project: gridcoinresearch.pro
# Template: app
#############################################################################
Expand Down
8 changes: 4 additions & 4 deletions contrib/Installer/GridcoinInstaller/GridcoinResearch.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -1120,19 +1120,19 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Gridcoin Research"
"ProductCode" = "8:{F2C51C09-E622-4259-BF15-F6D5BFAA777A}"
"PackageCode" = "8:{EA9810E9-3C35-42D0-8118-DB23C6DA3AE0}"
"ProductCode" = "8:{30AAD9EB-F91F-466F-AAC5-E4A0CE7BC53A}"
"PackageCode" = "8:{B6424258-604A-40D5-BEE0-640A2CAEC4C5}"
"UpgradeCode" = "8:{9617E9EA-252F-43CE-B53E-B48C85F71192}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:FALSE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:41.6"
"ProductVersion" = "8:41.7"
"Manufacturer" = "8:GridcoinResearch"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
"Title" = "8:Gridcoin Research 41.6"
"Title" = "8:Gridcoin Research 41.7"
"Subject" = "8:"
"ARPCONTACT" = "8:The Gridcoin Developers"
"Keywords" = "8:Gridcoin Research"
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MINOR 5
#define CLIENT_VERSION_REVISION 8
#define CLIENT_VERSION_BUILD 1
#define CLIENT_VERSION_BUILD 2

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
Expand Down
4 changes: 1 addition & 3 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ int64_t GetRSAWeightByCPIDWithRA(std::string cpid)
int64_t GetRSAWeightByCPID(std::string cpid)
{

if (IsResearchAgeEnabled(pindexBest->nHeight) && bNewbieFeatureEnabled)
if (IsResearchAgeEnabled(pindexBest->nHeight) && AreBinarySuperblocksEnabled(pindexBest->nHeight))
{
return GetRSAWeightByCPIDWithRA(cpid);
//ToDo : During next mandatory, retire this old function.
Expand All @@ -421,8 +421,6 @@ int64_t GetRSAWeightByCPID(std::string cpid)
if (IsResearchAgeEnabled(pindexBest->nHeight) && weight < 0) weight=0;
}

//if (IsResearchAgeEnabled(pindexBest->nHeight) && !bNewbieFeatureEnabled) weight = UntrustedHost.Magnitude;

}
else
{
Expand Down
19 changes: 13 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ unsigned int nStakeMaxAge = -1; // unlimited
unsigned int nModifierInterval = 10 * 60; // time to elapse before new modifier is computed
bool bCryptoLotteryEnabled = true;
bool bRemotePaymentsEnabled = false;
bool bNewbieFeatureEnabled = false;
bool bOPReturnEnabled = true;
bool bOptionPaymentsEnabled = false;

Expand Down Expand Up @@ -481,7 +480,7 @@ extern void FlushGridcoinBlockFile(bool fFinalize);
std::string msHDDSerial = "";
//When syncing, we grandfather block rejection rules up to this block, as rules became stricter over time and fields changed

int nGrandfather = 677500;
int nGrandfather = 714999;
int nNewIndex = 271625;
int nNewIndex2 = 364500;

Expand Down Expand Up @@ -5544,7 +5543,6 @@ bool LoadBlockIndex(bool fAllowNew)
nNewIndex = 10;
nNewIndex2 = 36500;
bRemotePaymentsEnabled = false;
bNewbieFeatureEnabled = true;
bOPReturnEnabled = false;
bOptionPaymentsEnabled = false;
//1-24-2016
Expand Down Expand Up @@ -8662,7 +8660,7 @@ std::string GetNeuralNetworkSuperBlock()
#if defined(WIN32) && defined(QT_GUI)
contract = qtGetNeuralContract("");
if (fDebug2 && LessVerbose(5)) printf("Appending SuperBlock %f\r\n",(double)contract.length());
if (bNewbieFeatureEnabled)
if (AreBinarySuperblocksEnabled(nBestHeight))
{
// 12-21-2015 : Stake a binary superblock
contract = PackBinarySuperblock(contract);
Expand Down Expand Up @@ -10297,7 +10295,7 @@ double GRCMagnitudeUnit(int64_t locktime)
double Kitty = MaximumEmission - (network.payments/14);
if (Kitty < 1) Kitty = 1;
double MagnitudeUnit = 0;
if (bNewbieFeatureEnabled)
if (AreBinarySuperblocksEnabled(nBestHeight))
{
MagnitudeUnit = (Kitty/TotalNetworkMagnitude)*1.25;
}
Expand All @@ -10318,7 +10316,7 @@ int64_t ComputeResearchAccrual(int64_t nTime, std::string cpid, std::string oper
if (pHistorical->nHeight <= nNewIndex || pHistorical->nMagnitude==0 || pHistorical->nTime == 0)
{
//No prior block exists... Newbies get .01 age to bootstrap the CPID (otherwise they will not have any prior block to refer to, thus cannot get started):
if (!bNewbieFeatureEnabled)
if (!AreBinarySuperblocksEnabled(pindexLast->nHeight))
{
return dCurrentMagnitude > 0 ? ((dCurrentMagnitude/100)*COIN) : 0;
}
Expand All @@ -10331,9 +10329,18 @@ int64_t ComputeResearchAccrual(int64_t nTime, std::string cpid, std::string oper
{
double dNewbieAccrualAge = ((double)nTime - (double)iBeaconTimestamp) / 86400;
int64_t iAccrual = (int64_t)((dNewbieAccrualAge*dCurrentMagnitude*dMagnitudeUnit*COIN) + (1*COIN));
if ((dNewbieAccrualAge*dCurrentMagnitude*dMagnitudeUnit) > 500)
{
printf("Newbie special stake too high, reward=500GRC");
return (500*COIN);
}
if (fDebug3) printf("\r\n Newbie Special First Stake for CPID %s, Age %f, Accrual %f \r\n",cpid.c_str(),dNewbieAccrualAge,(double)iAccrual);
return iAccrual;
}
else
{
return dCurrentMagnitude > 0 ? (((dCurrentMagnitude/100)*COIN) + (1*COIN)): 0;
}
}
}
// To prevent reorgs and checkblock errors, ensure the research age is > 10 blocks wide:
Expand Down
7 changes: 6 additions & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ inline int GetSuperblockAgeSpacing(int nHeight)
return (fTestNet ? 86400 : (nHeight > 364500) ? 86400 : 43200);
}

inline bool AreBinarySuperblocksEnabled(int nHeight)
{
return (fTestNet ? nHeight > 10000 : nHeight > 725000);
}


inline int64_t PastDrift(int64_t nTime, int nHeight) { return IsProtocolV2(nHeight) ? nTime - 20 * 60 : nTime - 20 * 60; }
inline int64_t FutureDrift(int64_t nTime, int nHeight) { return IsProtocolV2(nHeight) ? nTime + 20 * 60 : nTime + 20 * 60; }
inline unsigned int GetTargetSpacing(int nHeight) { return IsProtocolV2(nHeight) ? 90 : 60; }
Expand Down Expand Up @@ -151,7 +157,6 @@ extern std::map<uint256, CBlock*> mapOrphanBlocks;
extern int64_t COIN_YEAR_REWARD;
extern bool bCryptoLotteryEnabled;
extern bool bRemotePaymentsEnabled;
extern bool bNewbieFeatureEnabled;
extern bool bOPReturnEnabled;
extern bool bOptionPaymentsEnabled;

Expand Down
14 changes: 13 additions & 1 deletion src/rpcblockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,19 @@ int GenerateNewKeyPair(std::string sIndex, std::string &sOutPubKey, std::string
std::string sSuffix = fTestNet ? "testnet" : "";
sOutPrivKey = GetArgument("PrivateKey" + sIndex + sSuffix, "");
sOutPubKey = GetArgument("PublicKey" + sIndex + sSuffix, "");
if (!sOutPrivKey.empty() && !sOutPubKey.empty()) return 1;
// If current keypair is not empty, but is invalid, allow the new keys to be stored, otherwise return 1: (10-25-2016)

if (!sOutPrivKey.empty() && !sOutPubKey.empty())
{
uint256 hashBlock = GetRandHash();
std::string sSignature = SignBlockWithCPID(sIndex,hashBlock.GetHex());
bool fResult = VerifyCPIDSignature(sIndex, hashBlock.GetHex(), sSignature);
if (fResult)
{
printf("\r\nGenerateNewKeyPair::Current keypair is valid.\r\n");
return 1;
}
}
// Generate the Keypair
CKey key;
key.MakeNewKey(false);
Expand Down
2 changes: 0 additions & 2 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1884,13 +1884,11 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
if (!GlobalCPUMiningCPID.initialized)
{
printf("Global Mining CPID not initialized yet.. Unable to stake\r\n");
msMiningErrors7="No Global CPID;";
return false;
}
if (GlobalCPUMiningCPID.cpid == "")
{
printf("Global Mining CPID not initialized yet.. Unable to stake\r\n");
msMiningErrors7="No Global CPID";
return false;
}

Expand Down

0 comments on commit 4fd5fa2

Please sign in to comment.