Skip to content

Commit 41add47

Browse files
committed
3.5.8.4-leisure
Gridcoin Research 3.5.8.4/MSI=41.9 Leisure Upgrade - Catch HTTP error on Diagnostics page - Add checkpoints up to 770000 - Remove unused functions (cryptolottery, options trading) - Merge in Denravonska #158 - CPU-Usage-Fix: This fix prevents GRC from copying memory structs and is designed to lower CPU usage
1 parent 2ed693f commit 41add47

12 files changed

+57
-239
lines changed

Makefile.Debug

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#############################################################################
22
# Makefile for building: gridcoinresearch
3-
# Generated by qmake (2.01a) (Qt 4.8.4) on: Mon Nov 21 07:13:32 2016
3+
# Generated by qmake (2.01a) (Qt 4.8.4) on: Sat Dec 31 17:22:56 2016
44
# Project: gridcoinresearch.pro
55
# Template: app
66
#############################################################################

Makefile.Release

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#############################################################################
22
# Makefile for building: gridcoinresearch
3-
# Generated by qmake (2.01a) (Qt 4.8.4) on: Mon Nov 21 07:13:34 2016
3+
# Generated by qmake (2.01a) (Qt 4.8.4) on: Sat Dec 31 17:22:57 2016
44
# Project: gridcoinresearch.pro
55
# Template: app
66
#############################################################################

contrib/Installer/GridcoinInstaller/GridcoinResearch.vdproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1120,19 +1120,19 @@
11201120
{
11211121
"Name" = "8:Microsoft Visual Studio"
11221122
"ProductName" = "8:Gridcoin Research"
1123-
"ProductCode" = "8:{30AAD9EB-F91F-466F-AAC5-E4A0CE7BC53A}"
1124-
"PackageCode" = "8:{B6424258-604A-40D5-BEE0-640A2CAEC4C5}"
1123+
"ProductCode" = "8:{050C56BD-D556-4E95-BBD8-C7CE5E01FBDC}"
1124+
"PackageCode" = "8:{10C9F1E4-30DB-436D-A28D-79FB7577F00F}"
11251125
"UpgradeCode" = "8:{9617E9EA-252F-43CE-B53E-B48C85F71192}"
11261126
"AspNetVersion" = "8:4.0.30319.0"
11271127
"RestartWWWService" = "11:FALSE"
11281128
"RemovePreviousVersions" = "11:TRUE"
11291129
"DetectNewerInstalledVersion" = "11:FALSE"
11301130
"InstallAllUsers" = "11:TRUE"
1131-
"ProductVersion" = "8:41.7"
1131+
"ProductVersion" = "8:41.9"
11321132
"Manufacturer" = "8:GridcoinResearch"
11331133
"ARPHELPTELEPHONE" = "8:"
11341134
"ARPHELPLINK" = "8:"
1135-
"Title" = "8:Gridcoin Research 41.8"
1135+
"Title" = "8:Gridcoin Research 41.9"
11361136
"Subject" = "8:"
11371137
"ARPCONTACT" = "8:The Gridcoin Developers"
11381138
"Keywords" = "8:Gridcoin Research"

contrib/Installer/boinc/boinc/modGRC.vb

+20-3
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,14 @@ Module modGRC
209209
Dim BJ As New BatchJob
210210
Dim myWebClient As New MyWebClient()
211211
Dim sFullURL As String = sProjectURL + "am_set_info.php?account_key=" + sAccountKey + "&teamid=" + sTeamID
212+
Dim sHttp As String
212213

213-
Dim sHTTP As String = myWebClient.DownloadString(sFullURL)
214+
Try
215+
sHttp = myWebClient.DownloadString(sFullURL)
216+
217+
Catch ex As Exception
218+
219+
End Try
214220
If sHTTP.Contains("success") Then
215221
BJ.Status = True
216222
Else
@@ -335,8 +341,14 @@ Module modGRC
335341
Try
336342

337343
Dim sFullURL As String = sProjectURL + "team_lookup.php?team_name=gridcoin&format=xml"
338-
Dim sHTTP As String = myWebClient.DownloadString(sFullURL)
344+
Dim sHTTP As String
345+
Try
346+
sHTTP = myWebClient.DownloadString(sFullURL)
347+
348+
Catch ex As Exception
339349

350+
End Try
351+
340352
Dim sTeamID As String
341353
sTeamID = ExtractXML(sHTTP, "<id>", "</id>")
342354
Return sTeamID
@@ -443,7 +455,12 @@ Module modGRC
443455
Dim sURL As String = RACURL + "get_user.php?cpid=" + sCPID
444456
Dim w As New MyWebClient
445457
Dim sRAC As String
446-
sRAC = w.DownloadString(sURL)
458+
Try
459+
sRAC = w.DownloadString(sURL)
460+
461+
Catch ex As Exception
462+
463+
End Try
447464
Dim vRAC() As String
448465
vRAC = Split(sRAC, "<project>")
449466
dProjectByteLength = Len(sRAC)

contrib/Installer/boinc/boinc/modPersistedDataSystem.vb

+12-2
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,11 @@ ThreadStarted:
11091109
sData = ""
11101110
Dim sURL As String = "http://boinc.netsoft-online.com/get_user.php?cpid=" + sCPID
11111111
Dim w As New MyWebClient2
1112-
sData = w.DownloadString(sURL)
1112+
Try
1113+
sData = w.DownloadString(sURL)
1114+
Catch ex As Exception
1115+
1116+
End Try
11131117
Return sData
11141118
End Function
11151119
Public Function GetRAC_Resilient(sCPID As String) As Boolean
@@ -1629,7 +1633,13 @@ Retry:
16291633
End If
16301634
Dim sURL As String = "https://c-cex.com/t/" + ccxPage
16311635
Dim w As New MyWebClient
1632-
Dim sJSON As String = w.DownloadString(sURL)
1636+
Dim sJSON As String = String.Empty
1637+
Try
1638+
sJSON = w.DownloadString(sURL)
1639+
1640+
Catch ex As Exception
1641+
1642+
End Try
16331643
Dim sLast As String = ExtractValue(sJSON, "lastprice", "updated")
16341644
sLast = Replace(sLast, ",", ".")
16351645

src/checkpoints.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ namespace Checkpoints
5050
(145000, uint256("0x99f5d7166ad55d6d0e1ac5c7fffaee1d1dd1ff1409738e0d4f13ac1ae38234cc") )
5151
(278000, uint256("0x8066e63198c44b9840f664e795b0315d9b752773b267d6212f35593bc0e3b6f4") )
5252
(361800, uint256("0x801981d8a8f5809e34a2881ea97600259e1d9d778fa21752a5f6cff4defcd08d") )
53+
(500000, uint256("0x3916b53eaa0eb392ce5d7e4eaf7db4f745187743f167539ffa4dc1a30c06acbd") )
54+
(700000, uint256("0x2e45c8a834675b505b96792d198c2dc970f560429c635479c347204044acc59b") )
55+
(770000, uint256("0xfc13a63162bc0a5a09acc3f284cf959d6812a027bb54b342a0e1ccaaca8627ce") )
5356
;
5457

5558
// TestNet has no checkpoints

src/clientversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define CLIENT_VERSION_MAJOR 3
1010
#define CLIENT_VERSION_MINOR 5
1111
#define CLIENT_VERSION_REVISION 8
12-
#define CLIENT_VERSION_BUILD 3
12+
#define CLIENT_VERSION_BUILD 4
1313

1414
// Converts the parameter X to a string after macro replacement on X has been performed.
1515
// Don't merge these into one macro!

src/kernel.cpp

-21
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ bool IsCPIDValidv2(MiningCPID& mc,int height);
1414
using namespace std;
1515
MiningCPID DeserializeBoincBlock(std::string block);
1616
std::string RetrieveMd5(std::string s1);
17-
extern std::string CPIDByAddress(std::string address);
1817
bool IsCPIDValid_Retired(std::string cpid, std::string ENCboincpubkey);
1918
MiningCPID GetMiningCPID();
2019
StructCPID GetStructCPID();
@@ -336,26 +335,6 @@ double GetMagnitudeByHashBoinc(std::string hashBoinc, int height)
336335
}
337336

338337

339-
std::string CPIDByAddress(std::string address)
340-
{
341-
//CryptoLottery
342-
for(map<string,StructCPID>::iterator ii=mvMagnitudes.begin(); ii!=mvMagnitudes.end(); ++ii)
343-
{
344-
StructCPID structMag = GetStructCPID();
345-
structMag = mvMagnitudes[(*ii).first];
346-
if (structMag.initialized && structMag.cpid.length() > 2 && structMag.cpid != "INVESTOR" && structMag.GRCAddress.length() > 5)
347-
{
348-
if (structMag.GRCAddress==address)
349-
{
350-
return structMag.cpid;
351-
}
352-
}
353-
}
354-
return "";
355-
356-
}
357-
358-
359338

360339
double OwedByAddress(std::string address)
361340
{

src/main.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,11 @@ void qtSyncWithDPORNodes(std::string data);
153153
std::string qtGetNeuralHash(std::string data);
154154
std::string GetListOf(std::string datatype);
155155

156-
std::string CryptoLottery(int64_t locktime);
157156
std::string GetCommandNonce(std::string command);
158157
std::string DefaultBlockKey(int key_length);
159158
void InitializeBoincProjects();
160159

161160
extern double Cap(double dAmt, double Ceiling);
162-
std::string CPIDByAddress(std::string address);
163161
extern std::string ToOfficialNameNew(std::string proj);
164162
double OwedByAddress(std::string address);
165163

@@ -288,7 +286,6 @@ CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 16);
288286
unsigned int nStakeMinAge = 16 * 60 * 60; // 16 hours
289287
unsigned int nStakeMaxAge = -1; // unlimited
290288
unsigned int nModifierInterval = 10 * 60; // time to elapse before new modifier is computed
291-
bool bCryptoLotteryEnabled = true;
292289
bool bRemotePaymentsEnabled = false;
293290
bool bOPReturnEnabled = true;
294291
bool bOptionPaymentsEnabled = false;
@@ -4434,8 +4431,7 @@ bool CBlock::CheckBlock(std::string sCaller, int height1, int64_t Mint, bool fCh
44344431

44354432
if (IsProofOfStake())
44364433
{
4437-
//4-2-2015 Verify each POR recipient is owed > paid - CryptoLottery
4438-
// Coinbase output should be empty if proof-of-stake block
4434+
// Coinbase output should be empty if proof-of-stake block
44394435
if (vtx[0].vout.size() != 1 || !vtx[0].vout[0].IsEmpty())
44404436
return DoS(100, error("CheckBlock[] : coinbase output not empty for proof-of-stake block"));
44414437

src/main.h

-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ extern unsigned char pchMessageStart[4];
153153
extern std::map<uint256, CBlock*> mapOrphanBlocks;
154154

155155
extern int64_t COIN_YEAR_REWARD;
156-
extern bool bCryptoLotteryEnabled;
157156
extern bool bRemotePaymentsEnabled;
158157
extern bool bOPReturnEnabled;
159158
extern bool bOptionPaymentsEnabled;

src/rpcblockchain.cpp

+2-120
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ extern std::string GetBeaconPrivateKey(std::string cpid);
3636
extern std::string SuccessFail(bool f);
3737
extern Array GetUpgradedBeaconReport();
3838
extern Array MagnitudeReport(std::string cpid);
39-
extern bool UserAcknowledgedHoldHarmlessClause(std::string sAddress);
4039
std::string ConvertBinToHex(std::string a);
4140
std::string ConvertHexToBin(std::string a);
4241
bool TallyResearchAverages(bool Forcefully);
@@ -83,8 +82,6 @@ void WriteCache(std::string section, std::string key, std::string value, int64_t
8382
extern std::string MyBeaconExists(std::string cpid);
8483
int64_t GetEarliestWalletTransaction();
8584
extern bool CheckMessageSignature(std::string sAction,std::string messagetype, std::string sMsg, std::string sSig, std::string opt_pubkey);
86-
extern std::string CryptoLottery(int64_t locktime);
87-
std::string CPIDByAddress(std::string address);
8885
bool LoadAdminMessages(bool bFullTableScan,std::string& out_errors);
8986
int64_t GetMaximumBoincSubsidy(int64_t nTime);
9087
double GRCMagnitudeUnit(int64_t locktime);
@@ -110,7 +107,6 @@ void TestScan2();
110107
bool AsyncNeuralRequest(std::string command_name,std::string cpid,int NodeLimit);
111108
bool FullSyncWithDPORNodes();
112109
bool LoadSuperblock(std::string data, int64_t nTime, double height);
113-
114110
StructCPID GetInitializedStructCPID2(std::string name,std::map<std::string, StructCPID>& vRef);
115111

116112
std::string GetNeuralNetworkSupermajorityHash(double& out_popularity);
@@ -1520,19 +1516,6 @@ bool AdvertiseBeacon(bool bFromService, std::string &sOutPrivKey, std::string &s
15201516
}
15211517

15221518

1523-
1524-
std::string AcknowledgeHoldHarmlessClause()
1525-
{
1526-
std::string GRCAddress = DefaultWalletAddress();
1527-
bool bHarmlessClauseAcknowledged = UserAcknowledgedHoldHarmlessClause(GRCAddress);
1528-
if (bHarmlessClauseAcknowledged) return "SUCCESS";
1529-
std::string contract = GRCAddress;
1530-
std::string sAction = "add";
1531-
std::string sType = "holdharmless";
1532-
std::string result = AddContract(sType,GRCAddress,contract);
1533-
return result;
1534-
}
1535-
15361519
std::string ExecuteRPCCommand(std::string method, std::string arg1, std::string arg2, std::string arg3, std::string arg4, std::string arg5, std::string arg6)
15371520
{
15381521
Array params;
@@ -3939,78 +3922,6 @@ double GetMagnitudeByCpidFromLastSuperblock(std::string sCPID)
39393922
return 0;
39403923
}
39413924

3942-
std::string CryptoLottery(int64_t locktime)
3943-
{
3944-
std::string sOut = "";
3945-
std::string row = "";
3946-
int rows = 0;
3947-
3948-
if (!bRemotePaymentsEnabled) return "";
3949-
3950-
double max_subsidy = (double)GetMaximumBoincSubsidy(locktime);
3951-
vector<CPIDOwed> vCPIDSOwed;
3952-
3953-
//int iRecord = 0;
3954-
for(map<string,StructCPID>::iterator ii=mvMagnitudes.begin(); ii!=mvMagnitudes.end(); ++ii)
3955-
{
3956-
StructCPID structMag = mvMagnitudes[(*ii).first];
3957-
if (structMag.initialized && structMag.cpid.length() > 2 && structMag.cpid != "INVESTOR" && structMag.GRCAddress.length() > 5)
3958-
{
3959-
CPIDOwed c;
3960-
c.owed = structMag.totalowed-structMag.payments;
3961-
c.GRCAddress = structMag.GRCAddress;
3962-
c.cpid = structMag.cpid;
3963-
c.initialized = true;
3964-
vCPIDSOwed.push_back(c);
3965-
}
3966-
}
3967-
// Sort by Max Owed descending:
3968-
std::sort(vCPIDSOwed.begin(), vCPIDSOwed.end(), SortByOwed);
3969-
3970-
int nLastTally = (nBestHeight-CONSENSUS_LOOKBACK) - ( (nBestHeight-CONSENSUS_LOOKBACK) % BLOCK_GRANULARITY);
3971-
int height_since_last_tally = nBestHeight - CONSENSUS_LOOKBACK - nLastTally;
3972-
if (height_since_last_tally < 0) height_since_last_tally=0;
3973-
int iSkip = 0;
3974-
for(std::vector<CPIDOwed>::iterator it = vCPIDSOwed.begin(); it != vCPIDSOwed.end(); it++)
3975-
{
3976-
StructCPID structMag = mvMagnitudes[it->cpid];
3977-
if (structMag.initialized && structMag.cpid.length() > 2 && structMag.cpid != "INVESTOR" && structMag.GRCAddress.length() > 5)
3978-
{
3979-
double Owed = OwedByAddress(structMag.GRCAddress);
3980-
//Reverse Check, ensure Address resolves to cpid:
3981-
std::string reverse_cpid_lookup = CPIDByAddress(structMag.GRCAddress);
3982-
iSkip++;
3983-
if (reverse_cpid_lookup == structMag.cpid && Owed > (max_subsidy*4) && sOut.find(structMag.GRCAddress) == std::string::npos && iSkip > height_since_last_tally)
3984-
{
3985-
// Gather the owed amount, grc address, and cpid.
3986-
// During block verification we will verify owed <> block_paid, grcaddress belongs to cpid, and cpid is owed > purported_owed
3987-
std::string row = "";
3988-
double tbp = Owed / 2;
3989-
if (tbp > max_subsidy) tbp=max_subsidy;
3990-
row = structMag.cpid + ";" + structMag.GRCAddress + ";" + RoundToString(tbp,2);
3991-
sOut += row + "<COL>";
3992-
rows++;
3993-
if (rows >= 20) break;
3994-
}
3995-
}
3996-
3997-
}
3998-
3999-
4000-
4001-
if (sOut.length() > 10) sOut = sOut.substr(0,sOut.length()-5); //Remove last delimiter
4002-
if (fDebug3) printf("CryptoLottery %s",sOut.c_str());
4003-
if (rows < 15) sOut = "";
4004-
return sOut;
4005-
}
4006-
4007-
4008-
4009-
bool UserAcknowledgedHoldHarmlessClause(std::string sAddress)
4010-
{
4011-
std::string sHarmless = mvApplicationCache["holdharmless;" + sAddress];
4012-
return (!sHarmless.empty());
4013-
}
40143925

40153926
bool IsContractSettled(std::string sContractType, std::string sOpra)
40163927
{
@@ -4953,7 +4864,7 @@ Value listitem(const Array& params, bool fHelp)
49534864

49544865
Object entry;
49554866
entry.push_back(Pair("RSA Weight",RSAWEIGHT));
4956-
entry.push_back(Pair("Remote Magnitude",out_magnitude));
4867+
entry.push_back(Pair("Magnitude",out_magnitude));
49574868
entry.push_back(Pair("RSA Owed",out_owed));
49584869
results.push_back(entry);
49594870

@@ -4983,36 +4894,7 @@ Value listitem(const Array& params, bool fHelp)
49834894
entry.push_back(Pair("Bad CPID with missing beacon",fResult));
49844895
results.push_back(entry);
49854896
}
4986-
else if (sitem == "lottery")
4987-
{
4988-
4989-
Object entry;
4990-
std::string recipients = CryptoLottery(GetAdjustedTime());
4991-
entry.push_back(Pair("Recipients",recipients));
4992-
std::vector<std::string> vRecipients = split(recipients.c_str(),"<COL>");
4993-
if (vRecipients.size() > 0)
4994-
{
4995-
for (unsigned int i=0;i < vRecipients.size(); i++)
4996-
{
4997-
std::vector<std::string> vPayments = split(vRecipients[i].c_str(),";");
4998-
//0=script Pub Key, 1=negative amount, 2=coinstake
4999-
if (vPayments.size() == 3)
5000-
{
5001-
std::string cpid = vPayments[0];
5002-
std::string grc_address = vPayments[1];
5003-
double amt = cdbl(vPayments[2],2);
5004-
std::string CLcpid = CPIDByAddress(grc_address);
5005-
entry.push_back(Pair("CPID",cpid));
5006-
entry.push_back(Pair("CPID_VERIFY",CLcpid));
5007-
entry.push_back(Pair("GRC_ADDRESS",grc_address));
5008-
entry.push_back(Pair("Amount To Be Paid",amt));
5009-
}
5010-
}
5011-
}
5012-
5013-
results.push_back(entry);
5014-
}
5015-
else if (sitem == "debugexplainmagnitude")
4897+
else if (sitem == "debugexplainmagnitude")
50164898
{
50174899
double dMag = ExtractMagnitudeFromExplainMagnitude();
50184900
Object entry;

0 commit comments

Comments
 (0)