Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 61 additions & 61 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8017,47 +8017,47 @@ bool MemorizeMessage(const CTransaction &tx, double dAmount, std::string sRecipi
{
const std::string &msg = tx.hashBoinc;
const int64_t &nTime = tx.nTime;
if (msg.empty()) return false;
bool fMessageLoaded = false;

if (Contains(msg,"<MT>"))
{
std::string sMessageType = ExtractXML(msg,"<MT>","</MT>");
std::string sMessageKey = ExtractXML(msg,"<MK>","</MK>");
std::string sMessageValue = ExtractXML(msg,"<MV>","</MV>");
std::string sMessageAction = ExtractXML(msg,"<MA>","</MA>");
std::string sSignature = ExtractXML(msg,"<MS>","</MS>");
std::string sMessagePublicKey = ExtractXML(msg,"<MPK>","</MPK>");
if (sMessageType=="beacon" && Contains(sMessageValue,"INVESTOR"))
{
sMessageValue="";
}

if (sMessageType=="superblock")
{
// Deny access to superblock processing runtime data
sMessageValue="";
}

if (!sMessageType.empty() && !sMessageKey.empty() && !sMessageValue.empty() && !sMessageAction.empty() && !sSignature.empty())
{
//Verify sig first
bool Verified = CheckMessageSignature(sMessageAction,sMessageType,sMessageType+sMessageKey+sMessageValue,
sSignature,sMessagePublicKey);

if (Verified)
{
if (sMessageAction=="A")
{
/* With this we allow verifying blocks with stupid beacon */
if("beacon"==sMessageType)
{
std::string out_cpid = "";
std::string out_address = "";
std::string out_publickey = "";
GetBeaconElements(sMessageValue, out_cpid, out_address, out_publickey);
if (msg.empty()) return false;
bool fMessageLoaded = false;

if (Contains(msg,"<MT>"))
{
std::string sMessageType = ExtractXML(msg,"<MT>","</MT>");
std::string sMessageKey = ExtractXML(msg,"<MK>","</MK>");
std::string sMessageValue = ExtractXML(msg,"<MV>","</MV>");
std::string sMessageAction = ExtractXML(msg,"<MA>","</MA>");
std::string sSignature = ExtractXML(msg,"<MS>","</MS>");
std::string sMessagePublicKey = ExtractXML(msg,"<MPK>","</MPK>");
if (sMessageType=="beacon" && Contains(sMessageValue,"INVESTOR"))
{
sMessageValue="";
}

if (sMessageType=="superblock")
{
// Deny access to superblock processing runtime data
sMessageValue="";
}

if (!sMessageType.empty() && !sMessageKey.empty() && !sMessageValue.empty() && !sMessageAction.empty() && !sSignature.empty())
{
//Verify sig first
bool Verified = CheckMessageSignature(sMessageAction,sMessageType,sMessageType+sMessageKey+sMessageValue,
sSignature,sMessagePublicKey);

if (Verified)
{
if (sMessageAction=="A")
{
/* With this we allow verifying blocks with stupid beacon */
if("beacon"==sMessageType)
{
std::string out_cpid = "";
std::string out_address = "";
std::string out_publickey = "";
GetBeaconElements(sMessageValue, out_cpid, out_address, out_publickey);
WriteCache(Section::BEACONALT, sMessageKey+"."+ToString(nTime),out_publickey,nTime);
}
}

try
{
Expand All @@ -8073,18 +8073,18 @@ bool MemorizeMessage(const CTransaction &tx, double dAmount, std::string sRecipi
error("Attempting to add to unknown cache: %s", sMessageType);
}

fMessageLoaded = true;
if (sMessageType=="poll")
{
fMessageLoaded = true;
if (sMessageType=="poll")
{
msPoll = msg;
}
}
else if(sMessageAction=="D")
{
if (fDebug10) LogPrintf("Deleting key type %s Key %s Value %s", sMessageType, sMessageKey, sMessageValue);
if(fDebug10 && sMessageType=="beacon" ){
LogPrintf("BEACON DEL %s - %s", sMessageKey, TimestampToHRDate(nTime));
}
}
}
else if(sMessageAction=="D")
{
if (fDebug10) LogPrintf("Deleting key type %s Key %s Value %s", sMessageType, sMessageKey, sMessageValue);
if(fDebug10 && sMessageType=="beacon" ){
LogPrintf("BEACON DEL %s - %s", sMessageKey, TimestampToHRDate(nTime));
}

try
{
Expand All @@ -8098,20 +8098,20 @@ bool MemorizeMessage(const CTransaction &tx, double dAmount, std::string sRecipi
error("Attempting to add to unknown cache: %s", sMessageType);
}
}
// If this is a boinc project, load the projects into the coin:
if (sMessageType=="project" || sMessageType=="projectmapping")
{
//Reserved
fMessageLoaded = true;
}
// If this is a boinc project, load the projects into the coin:
if (sMessageType=="project" || sMessageType=="projectmapping")
{
//Reserved
fMessageLoaded = true;
}

if(fDebug)
if(fDebug)
WriteCache(Section::TRXID, sMessageType + ";" + sMessageKey,tx.GetHash().GetHex(),nTime);
}
}
}
}
}

return fMessageLoaded;
return fMessageLoaded;
}

double GRCMagnitudeUnit(int64_t locktime)
Expand Down
3 changes: 2 additions & 1 deletion src/rpcmining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ UniValue getmininginfo(const UniValue& params, bool fHelp)
}

obj.pushKV("MiningInfo 1", msMiningErrors);
obj.pushKV("MiningInfo 2", msPoll);
std::string sMessageKey = ExtractXML(msPoll, "<MK>", "</MK>");
obj.pushKV("MiningInfo 2", "Poll: " + sMessageKey.substr(0,80));
obj.pushKV("MiningInfo 5", msMiningErrors5);
obj.pushKV("MiningInfo 6", msMiningErrors6);
obj.pushKV("MiningInfo 7", msMiningErrors7);
Expand Down