Skip to content

Commit

Permalink
4.0.1.0-leisure
Browse files Browse the repository at this point in the history
Fixed:
 - Wrong RA scan range causing reward calculation disagreements and forks
   #1366, (@tomasbrod, @jamescowens, @denravonska).
 - Fix crashes when voting in polls #1369 (@denravonska).
  • Loading branch information
denravonska committed Nov 30, 2018
2 parents 6f11fd3 + 30162ec commit 2dfe715
Show file tree
Hide file tree
Showing 12 changed files with 228 additions and 271 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [4.0.1.0] 2018-11-30, leisure
### Fixed
- Wrong RA scan range causing reward calculation disagreements and forks
#1366, (@tomasbrod, @jamescowens, @denravonska).
- Fix crashes when voting in polls #1369 (@denravonska).

## [4.0.0.0] 2018-10-19, mandatory
### Added
- Linux nodes can now stake superblocks using forwarded contracts,
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 4)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_COPYRIGHT_YEAR, 2018)
Expand Down
7 changes: 3 additions & 4 deletions src/contract/polls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ double DoubleFromAmount(int64_t amount);
std::string PubKeyToAddress(const CScript& scriptPubKey);
bool GetEarliestStakeTime(std::string grcaddress, std::string cpid);
CBlockIndex* GetHistoricalMagnitude(std::string cpid);
StructCPID GetLifetimeCPID(const std::string& cpid, const std::string& sFrom);
bool WalletOutOfSync();

std::string GetShareType(double dShareType)
Expand Down Expand Up @@ -99,7 +98,7 @@ std::pair<std::string, std::string> CreateVoteContract(std::string sTitle, std::
}
std::string sParam = SerializeBoincBlock(GlobalCPUMiningCPID, pindexBest->nVersion);
std::string GRCAddress = DefaultWalletAddress();
StructCPID structMag = GetInitializedStructCPID2(GlobalCPUMiningCPID.cpid, mvMagnitudes);
StructCPID& structMag = GetInitializedStructCPID2(GlobalCPUMiningCPID.cpid, mvMagnitudes);
double dmag = structMag.Magnitude;
double poll_duration = PollDuration(sTitle) * 86400;

Expand All @@ -110,7 +109,7 @@ std::pair<std::string, std::string> CreateVoteContract(std::string sTitle, std::
double cpid_age = GetAdjustedTime() - ReadCache("global", "nCPIDTime").timestamp;
double stake_age = GetAdjustedTime() - ReadCache("global", "nGRCTime").timestamp;

StructCPID structGRC = GetInitializedStructCPID2(GRCAddress, mvMagnitudes);
StructCPID& structGRC = GetInitializedStructCPID2(GRCAddress, mvMagnitudes);
LogPrintf("CPIDAge %f, StakeAge %f, Poll Duration %f", cpid_age, stake_age, poll_duration);
double dShareType= RoundFromString(GetPollXMLElementByPollTitle(sTitle, "<SHARETYPE>", "</SHARETYPE>"), 0);

Expand Down Expand Up @@ -280,7 +279,7 @@ std::string GetProvableVotingWeightXML()
//Retrieve the historical magnitude
if (IsResearcher(msPrimaryCPID))
{
StructCPID st1 = GetLifetimeCPID(msPrimaryCPID,"ProvableMagnitude()");
StructCPID& st1 = GetLifetimeCPID(msPrimaryCPID);
CBlockIndex* pHistorical = GetHistoricalMagnitude(msPrimaryCPID);
if (pHistorical->nHeight > 1 && pHistorical->nMagnitude > 0)
{
Expand Down
8 changes: 3 additions & 5 deletions src/global_objects_noui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <string>
#include <map>
#include <set>

extern int nBoincUtilization;
extern std::string sRegVer;
Expand Down Expand Up @@ -46,7 +47,7 @@ struct StructCPID
double totalowed;
double LastPaymentTime;
double ResearchSubsidy;
double ResearchAverageMagnitude;
/* double ResearchAverageMagnitude; TotalMagnitude / (Accuracy+0.01) */
double EarliestPaymentTime;
double InterestSubsidy;
double PaymentTimespan;
Expand All @@ -66,6 +67,7 @@ struct StructCPID
std::string boincruntimepublickey;
std::string cpidv2;
std::string BlockHash;
std::set<const CBlockIndex*> rewardBlocks;
};

struct MiningCPID
Expand Down Expand Up @@ -111,15 +113,11 @@ struct MiningCPID

//User CPIDs
extern std::map<std::string, StructCPID> mvCPIDs;
//Verified CPIDs
extern std::map<std::string, StructCPID> mvCreditNode;
//Network Averages
extern std::map<std::string, StructCPID> mvNetwork;
extern std::map<std::string, StructCPID> mvNetworkCopy;
extern std::map<std::string, StructCPID> mvMagnitudes;
extern std::map<std::string, StructCPID> mvMagnitudesCopy;
extern std::map<std::string, StructCPID> mvCreditNodeCPIDProject; //Contains verified CPID+Projects;
extern std::map<std::string, StructCPID> mvCreditNodeCPID; //Contains verified CPID total Magnitude;

//Global CPU Mining CPID:
extern MiningCPID GlobalCPUMiningCPID;
Expand Down
4 changes: 2 additions & 2 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ int64_t GetRSAWeightByCPIDWithRA(std::string cpid)
return 0;

double dWeight = 0;
StructCPID stMagnitude = GetInitializedStructCPID2(cpid,mvMagnitudes);
StructCPID stLifetime = GetInitializedStructCPID2(cpid,mvResearchAge);
StructCPID& stMagnitude = GetInitializedStructCPID2(cpid,mvMagnitudes);
StructCPID& stLifetime = GetInitializedStructCPID2(cpid,mvResearchAge);
if (stMagnitude.Magnitude > 0 && stLifetime.ResearchSubsidy == 0)
{
dWeight = 100000;
Expand Down
Loading

0 comments on commit 2dfe715

Please sign in to comment.