fixed hashing issues with mnw messages

This commit is contained in:
Evan Duffield 2015-05-27 15:07:53 -07:00
parent fe55b12a1f
commit d470eddc01
5 changed files with 6 additions and 13 deletions

View File

@ -4437,8 +4437,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
else if (strCommand == "inv") else if (strCommand == "inv")
{ {
printf("58\n");
vector<CInv> vInv; vector<CInv> vInv;
vRecv >> vInv; vRecv >> vInv;
if (vInv.size() > MAX_INV_SZ) if (vInv.size() > MAX_INV_SZ)

View File

@ -337,8 +337,6 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
LOCK(cs_budget); LOCK(cs_budget);
printf("%s\n", strCommand.c_str());
if (strCommand == "mnvs") { //Masternode vote sync if (strCommand == "mnvs") { //Masternode vote sync
if(pfrom->HasFulfilledRequest("mnvs")) { if(pfrom->HasFulfilledRequest("mnvs")) {
LogPrintf("mnvs - peer already asked me for the list\n"); LogPrintf("mnvs - peer already asked me for the list\n");
@ -435,7 +433,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
} }
if(!prop.IsValid()) { if(!prop.IsValid()) {
printf("fbs - invalid prop\n"); LogPrintf("fbs - invalid prop\n");
return; return;
} }
@ -451,8 +449,6 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
budget.AddFinalizedBudget(p); budget.AddFinalizedBudget(p);
prop.Relay(); prop.Relay();
printf("43\n");
if(!IsSyncingMasternodeAssets()) pmn->nVotedTimes++; if(!IsSyncingMasternodeAssets()) pmn->nVotedTimes++;
} else { } else {
LogPrintf("mvote - masternode can't vote again - vin:%s \n", pmn->vin.ToString().c_str()); LogPrintf("mvote - masternode can't vote again - vin:%s \n", pmn->vin.ToString().c_str());

View File

@ -99,7 +99,6 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st
if(fDebug) LogPrintf("mnw - winning vote - Addr %s Height %d bestHeight %d\n", address2.ToString().c_str(), winner.nBlockHeight, chainActive.Tip()->nHeight); if(fDebug) LogPrintf("mnw - winning vote - Addr %s Height %d bestHeight %d\n", address2.ToString().c_str(), winner.nBlockHeight, chainActive.Tip()->nHeight);
if(masternodePayments.AddWinningMasternode(winner)){ if(masternodePayments.AddWinningMasternode(winner)){
printf("relay %s - %s \n", winner.GetHash().ToString().c_str(), winner.ToString().c_str());
winner.Relay(); winner.Relay();
} }
} }

View File

@ -124,7 +124,10 @@ public:
} }
uint256 GetHash(){ uint256 GetHash(){
return Hash(BEGIN(payee), END(payee)); CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
ss << payee;
return ss.GetHash();
} }
bool Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode); bool Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode);

View File

@ -42,26 +42,23 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
if (about) if (about)
{ {
setWindowTitle(tr("About Dash Core")); setWindowTitle(tr("About Dash Core"));
printf("1");
/// HTML-format the license message from the core /// HTML-format the license message from the core
QString licenseInfo = QString::fromStdString(LicenseInfo()); QString licenseInfo = QString::fromStdString(LicenseInfo());
QString licenseInfoHTML = licenseInfo; QString licenseInfoHTML = licenseInfo;
printf("2");
// Make URLs clickable // Make URLs clickable
QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2); QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
uri.setMinimal(true); // use non-greedy matching uri.setMinimal(true); // use non-greedy matching
licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>"); licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>");
// Replace newlines with HTML breaks // Replace newlines with HTML breaks
licenseInfoHTML.replace("\n\n", "<br><br>"); licenseInfoHTML.replace("\n\n", "<br><br>");
printf("3");
ui->helpMessageLabel->setTextFormat(Qt::RichText); ui->helpMessageLabel->setTextFormat(Qt::RichText);
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
text = version + "\n" + licenseInfo; text = version + "\n" + licenseInfo;
ui->helpMessageLabel->setText(version + "<br><br>" + licenseInfoHTML); ui->helpMessageLabel->setText(version + "<br><br>" + licenseInfoHTML);
ui->helpMessageLabel->setWordWrap(true); ui->helpMessageLabel->setWordWrap(true);
printf("4");
} else { } else {
setWindowTitle(tr("Command-line options")); setWindowTitle(tr("Command-line options"));
QString header = tr("Usage:") + "\n" + QString header = tr("Usage:") + "\n" +