From 2feb0fd2f8c2568180655e6f9efec2a2881c33e1 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Sun, 1 Feb 2015 13:37:20 -0700 Subject: [PATCH] fixed hashing for IX --- src/instantx.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/instantx.cpp b/src/instantx.cpp index 5148cf435d..fb923c172e 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -108,20 +108,20 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream& CInv inv(MSG_TXLOCK_VOTE, ctx.GetHash()); pfrom->AddInventoryKnown(inv); - if(mapTxLockVote.count(inv.hash)){ + if(mapTxLockVote.count(ctx.GetHash())){ return; } - mapTxLockVote.insert(make_pair(inv.hash, 1)); + mapTxLockVote.insert(make_pair(ctx.GetHash(), 1)); ProcessConsensusVote(ctx); LOCK(cs_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); } + return; } } @@ -144,7 +144,7 @@ void DoConsensusVote(CTransaction& tx, bool approved, int64_t nBlockHeight) LogPrintf("InstantX::DoConsensusVote - Signature invalid\n"); return; } - + LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) { @@ -224,15 +224,7 @@ void CleanTransactionLocksList() uint256 CConsensusVote::GetHash() const { - - std::string strHash = tx.GetHash().ToString().c_str(); - strHash += vinMasternode.ToString().c_str(); - strHash += boost::lexical_cast(nBlockHeight); - strHash += boost::lexical_cast(approved); - - printf("%s\n", strHash.c_str()); - - return Hash(BEGIN(strHash), END(strHash)); + return vinMasternode.prevout.hash + tx.GetHash(); }