fixed hashing for IX

This commit is contained in:
Evan Duffield 2015-02-01 13:37:20 -07:00
parent 6c8b23c0b2
commit 2feb0fd2f8

View File

@ -108,20 +108,20 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
CInv inv(MSG_TXLOCK_VOTE, ctx.GetHash()); CInv inv(MSG_TXLOCK_VOTE, ctx.GetHash());
pfrom->AddInventoryKnown(inv); pfrom->AddInventoryKnown(inv);
if(mapTxLockVote.count(inv.hash)){ if(mapTxLockVote.count(ctx.GetHash())){
return; return;
} }
mapTxLockVote.insert(make_pair(inv.hash, 1)); mapTxLockVote.insert(make_pair(ctx.GetHash(), 1));
ProcessConsensusVote(ctx); ProcessConsensusVote(ctx);
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
{ {
printf("relay txlvote to %s : %s\n", pnode->addr.ToString().c_str(), ctx.tx.ToString().c_str());
pnode->PushMessage("txlvote", ctx); pnode->PushMessage("txlvote", ctx);
} }
return; return;
} }
} }
@ -144,7 +144,7 @@ void DoConsensusVote(CTransaction& tx, bool approved, int64_t nBlockHeight)
LogPrintf("InstantX::DoConsensusVote - Signature invalid\n"); LogPrintf("InstantX::DoConsensusVote - Signature invalid\n");
return; return;
} }
LOCK(cs_vNodes); LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
{ {
@ -224,15 +224,7 @@ void CleanTransactionLocksList()
uint256 CConsensusVote::GetHash() const uint256 CConsensusVote::GetHash() const
{ {
return vinMasternode.prevout.hash + tx.GetHash();
std::string strHash = tx.GetHash().ToString().c_str();
strHash += vinMasternode.ToString().c_str();
strHash += boost::lexical_cast<std::string>(nBlockHeight);
strHash += boost::lexical_cast<std::string>(approved);
printf("%s\n", strHash.c_str());
return Hash(BEGIN(strHash), END(strHash));
} }