From f955fd43e54993792ce73686e383afdcd1fd602f Mon Sep 17 00:00:00 2001 From: Gridcoin Date: Sun, 26 Mar 2017 18:25:37 -0500 Subject: [PATCH] 3.5.8.7-Mandatory Upgrade Gridcoin Research 3.5.8.7/MSI=42.1 Mandatory Upgrade - Added checkpoint at 850000 - Enforce beacon age; beacons over 6 months are discarded network wide. Beacons may be re-sent without restarting if they are expired. - To sync: From the command line on windows: grcrestarter downloadblocks. NOTE ** We still need 51% to upgrade to stay in sync. After block 855000, clients enforce the mandatory upgrade. --- Makefile.Debug | 1 + Makefile.Release | 1 + .../GridcoinInstaller/GridcoinResearch.vdproj | 45 +++++-------------- src/checkpoints.cpp | 1 + src/clientversion.h | 2 +- src/main.cpp | 18 ++++++-- src/rpcblockchain.cpp | 12 ++++- src/version.h | 2 +- 8 files changed, 40 insertions(+), 42 deletions(-) diff --git a/Makefile.Debug b/Makefile.Debug index dd0e627e11..65e7a9ca3f 100644 --- a/Makefile.Debug +++ b/Makefile.Debug @@ -1,5 +1,6 @@ ############################################################################# # Makefile for building: gridcoinresearch +# Generated by qmake (2.01a) (Qt 4.8.4) on: Sun Mar 26 17:49:04 2017 # Project: gridcoinresearch.pro # Template: app ############################################################################# diff --git a/Makefile.Release b/Makefile.Release index 823894a95c..879b7875c4 100644 --- a/Makefile.Release +++ b/Makefile.Release @@ -1,5 +1,6 @@ ############################################################################# # Makefile for building: gridcoinresearch +# Generated by qmake (2.01a) (Qt 4.8.4) on: Sun Mar 26 17:49:05 2017 # Project: gridcoinresearch.pro # Template: app ############################################################################# diff --git a/contrib/Installer/GridcoinInstaller/GridcoinResearch.vdproj b/contrib/Installer/GridcoinInstaller/GridcoinResearch.vdproj index 8a5f6f787d..9cb03e23bd 100644 --- a/contrib/Installer/GridcoinInstaller/GridcoinResearch.vdproj +++ b/contrib/Installer/GridcoinInstaller/GridcoinResearch.vdproj @@ -232,37 +232,37 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_7A0EA93E644A4D9E8037FBB3C062DD65" + "OwnerKey" = "8:_6408A3D03D15E306A4C3FC5FD95ADA69" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_6AEABB5004EC4B57225B51B085DB5625" + "OwnerKey" = "8:_32F2DC723F30362B0B78F9A291EC0098" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_5644D8F767F33372E534FBD5A2384D12" + "OwnerKey" = "8:_DEB886DE05C496A5AD26B43C4B1B90B9" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_DEB886DE05C496A5AD26B43C4B1B90B9" + "OwnerKey" = "8:_5644D8F767F33372E534FBD5A2384D12" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_32F2DC723F30362B0B78F9A291EC0098" + "OwnerKey" = "8:_6AEABB5004EC4B57225B51B085DB5625" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_6408A3D03D15E306A4C3FC5FD95ADA69" + "OwnerKey" = "8:_7A0EA93E644A4D9E8037FBB3C062DD65" "MsmSig" = "8:_UNDEFINED" } } @@ -437,11 +437,6 @@ "AssemblyAsmDisplayName" = "8:GRCSec, Version=1.0.0.3, Culture=neutral, processorArchitecture=MSIL" "ScatterAssemblies" { - "_32F2DC723F30362B0B78F9A291EC0098" - { - "Name" = "8:GRCSec.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:GRCSec.dll" "TargetName" = "8:" @@ -559,11 +554,6 @@ "AssemblyAsmDisplayName" = "8:OpenPop, Version=2.0.5.0, Culture=neutral, processorArchitecture=MSIL" "ScatterAssemblies" { - "_5644D8F767F33372E534FBD5A2384D12" - { - "Name" = "8:openpopstake.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:openpopstake.dll" "TargetName" = "8:" @@ -590,11 +580,6 @@ "AssemblyAsmDisplayName" = "8:MySql.Data, Version=6.6.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" "ScatterAssemblies" { - "_6408A3D03D15E306A4C3FC5FD95ADA69" - { - "Name" = "8:MySql.Data.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:MySql.Data.dll" "TargetName" = "8:" @@ -621,11 +606,6 @@ "AssemblyAsmDisplayName" = "8:SQLite.NET, Version=0.21.1869.3794, Culture=neutral, PublicKeyToken=c273bd375e695f9c" "ScatterAssemblies" { - "_6AEABB5004EC4B57225B51B085DB5625" - { - "Name" = "8:sqlitestake.net.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:sqlitestake.net.dll" "TargetName" = "8:" @@ -898,11 +878,6 @@ "AssemblyAsmDisplayName" = "8:ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73" "ScatterAssemblies" { - "_DEB886DE05C496A5AD26B43C4B1B90B9" - { - "Name" = "8:icsharpcode.sharpziplib.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:icsharpcode.sharpziplib.dll" "TargetName" = "8:" @@ -1109,19 +1084,19 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Gridcoin Research" - "ProductCode" = "8:{99640ABC-1BE5-4E04-B0D9-47AAD10FB404}" - "PackageCode" = "8:{BFB1DB38-B968-4E50-9221-9918143CECEA}" + "ProductCode" = "8:{841D7D7B-708C-4FB6-952D-FE393085E82D}" + "PackageCode" = "8:{B62D5B84-E542-4BA2-9024-E4D93CD8DBA7}" "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:42.0" + "ProductVersion" = "8:42.1" "Manufacturer" = "8:GridcoinResearch" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" - "Title" = "8:Gridcoin Research 42.0" + "Title" = "8:Gridcoin Research 42.1" "Subject" = "8:" "ARPCONTACT" = "8:The Gridcoin Developers" "Keywords" = "8:Gridcoin Research" diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index ae81353764..1c8fee5d33 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -53,6 +53,7 @@ namespace Checkpoints (500000, uint256("0x3916b53eaa0eb392ce5d7e4eaf7db4f745187743f167539ffa4dc1a30c06acbd") ) (700000, uint256("0x2e45c8a834675b505b96792d198c2dc970f560429c635479c347204044acc59b") ) (770000, uint256("0xfc13a63162bc0a5a09acc3f284cf959d6812a027bb54b342a0e1ccaaca8627ce") ) + (850000, uint256("0xc78b15f25ad990d02256907fab92ab37301d129eaea177fd04acacd56c0cbd22") ) ; // TestNet has no checkpoints diff --git a/src/clientversion.h b/src/clientversion.h index 8dc51d7628..c0aa950632 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -9,7 +9,7 @@ #define CLIENT_VERSION_MAJOR 3 #define CLIENT_VERSION_MINOR 5 #define CLIENT_VERSION_REVISION 8 -#define CLIENT_VERSION_BUILD 6 +#define CLIENT_VERSION_BUILD 7 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! diff --git a/src/main.cpp b/src/main.cpp index 10ae26c469..6c75e42f19 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -461,7 +461,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 = 726000; + int nGrandfather = 854400; int nNewIndex = 271625; int nNewIndex2 = 364500; @@ -4368,8 +4368,9 @@ bool CBlock::CheckBlock(std::string sCaller, int height1, int64_t Mint, bool fCh double bv = BlockVersion(bb.clientversion); double cvn = ClientVersionNew(); if (fDebug10) printf("BV %f, CV %f ",bv,cvn); - //if (bv+10 < cvn) return error("ConnectBlock[]: Old client version after mandatory upgrade - block rejected\r\n"); - if (bv < 3517 && IsResearchAgeEnabled(height1) && !fTestNet) return error("CheckBlock[]: Old client spamming new blocks after mandatory upgrade \r\n"); + // if (bv+10 < cvn) return error("ConnectBlock[]: Old client version after mandatory upgrade - block rejected\r\n"); + // Enforce Beacon Age + if (bv < 3587 && height1 > 855000 && !fTestNet) return error("CheckBlock[]: Old client spamming new blocks after mandatory upgrade \r\n"); if (bv < 3580 && fTestNet) return DoS(25, error("CheckBlock[]: Old testnet client spamming new blocks after mandatory upgrade \r\n")); } @@ -7169,6 +7170,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, return false; } + if (pfrom->nVersion < 180322 & !fTestNet && pindexBest->nHeight > 855000) + { + // disconnect from peers older than this proto version - Enforce Beacon Age - 3-26-2017 + if (fDebug10) printf("partner %s using obsolete version %i (before enforcing beacon age); disconnecting\n", pfrom->addr.ToString().c_str(), pfrom->nVersion); + pfrom->fDisconnect = true; + return false; + } + if (!fTestNet && pfrom->nVersion < 180314 && IsResearchAgeEnabled(pindexBest->nHeight)) { // disconnect from peers older than this proto version @@ -7196,7 +7205,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (GetArgument("autoban","true") == "true") { - // Note: Hacking attempts start in this area 3-26-2016 + // Note: Hacking attempts start in this area if (false && pfrom->nStartingHeight < (nBestHeight/2) && LessVerbose(1) && !fTestNet) { if (fDebug3) printf("Node with low height"); @@ -9860,6 +9869,7 @@ bool MemorizeMessage(std::string msg, int64_t nTime, double dAmount, std::string { // If the Beacon Public Key is Not Empty - do not overwrite with a new beacon value std::string sBPK = GetBeaconPublicKey(sMessageKey); + // Note that if the beacon is > 6 months old, this function now returns an empty string (allowing the beacon to be overwritten) : OK if (!sBPK.empty()) { // Do not overwrite this beacon diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index df71512ec7..e52849596a 100755 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -1359,6 +1359,7 @@ bool AdvertiseBeacon(bool bFromService, std::string &sOutPrivKey, std::string &s std::string sBeaconPublicKey = GetBeaconPublicKey(GlobalCPUMiningCPID.cpid); if (!sBeaconPublicKey.empty()) { + // Ensure they can re-send the beacon if > 6 months old : GetBeaconPublicKey returns an empty string when > 6 months: OK. sError = "ALREADY_IN_CHAIN"; return bFromService ? true : false; } @@ -3817,10 +3818,19 @@ std::string GetLocalBeaconPublicKey(std::string cpid) return sBeaconPubKey; } +std::string RetrieveCachedValueWithMaxAge(std::string sKey, int64_t iMaxSeconds) +{ + int64_t iAge = GetAdjustedTime() - mvApplicationCacheTimestamp[sKey]; + std::string sValue = mvApplicationCache[sKey]; + // if (fDebug3) printf("\r\n BeaconAge %f, MaxAge %f, CPID %s\r\n",(double)iAge,(double)iMaxSeconds,sValue.c_str()); + return (iAge > iMaxSeconds) ? "" : sValue; +} std::string GetBeaconPublicKey(std::string cpid) { - std::string sBeacon = mvApplicationCache["beacon;" + cpid]; + //3-26-2017 - Ensure beacon public key is within 6 months of network age + int64_t iMaxSeconds = 60 * 24 * 30 * 6 * 60; + std::string sBeacon = RetrieveCachedValueWithMaxAge("beacon;" + cpid, iMaxSeconds); if (sBeacon.empty()) return ""; // Beacon data structure: CPID,hashRand,Address,beacon public key: base64 encoded std::string sContract = DecodeBase64(sBeacon); diff --git a/src/version.h b/src/version.h index da182aacc2..fdb11f186d 100644 --- a/src/version.h +++ b/src/version.h @@ -25,7 +25,7 @@ extern int MINOR_VERSION; /////////////////////////////////////////////////////////// // network protocol versioning // // // -static const int PROTOCOL_VERSION = 180321; // +static const int PROTOCOL_VERSION = 180322; // // disconnect from peers older than this proto version // static const int MIN_PEER_PROTO_VERSION = 180284; // ///////////////////////////////////////////////////////////