diff --git a/src/core.h b/src/core.h index 30d9fc9d40..6a5d869ef6 100644 --- a/src/core.h +++ b/src/core.h @@ -19,6 +19,8 @@ static const int64_t DARKSEND_COLLATERAL = (0.1*COIN); static const int64_t DARKSEND_FEE = (0.0125*COIN); static const int64_t DARKSEND_POOL_MAX = (999.99*COIN); +#define INSTANTX_SIGNATURES_REQUIRED 8 + #define MASTERNODE_NOT_PROCESSED 0 // initial state #define MASTERNODE_IS_CAPABLE 1 #define MASTERNODE_NOT_CAPABLE 2 diff --git a/src/instantx.cpp b/src/instantx.cpp index a69791418c..1146101e4a 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -23,8 +23,6 @@ std::map mapTxLockReqRejected; std::map mapTxLockVote; std::map mapTxLocks; -#define INSTANTX_SIGNATURES_REQUIRED 2 - //txlock - Locks transaction // //step 1.) Broadcast intention to lock transaction inputs, "txlreg", CTransaction @@ -190,7 +188,7 @@ void ProcessConsensusVote(CConsensusVote& ctx) if (i != mapTxLocks.end()){ (*i).second.AddSignature(ctx); if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){ - LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete, broadcasting!\n"); + LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete %s !\n", (*i).second.GetHash().ToString().c_str()); } return; } diff --git a/src/main.cpp b/src/main.cpp index a2b183a20a..dc1e3e3c93 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1160,21 +1160,14 @@ int CMerkleTx::IsTransactionLocked() const { if(nInstantXDepth == 0) return 0; - //printf("mapTxLocks start\n"); - typedef std::map::iterator it_ctxl; - - int found = 0; - for (unsigned int b = 0; b < vout.size(); b++) { - for(it_ctxl it = mapTxLocks.begin(); it != mapTxLocks.end(); it++) { - for (unsigned int a = 0; a < it->second.tx.vout.size(); a++) { - if(vout[b] == it->second.tx.vout[a]) - found++; - } - if(found > 0) break; + //compile consessus vote + std::map::iterator i = mapTxLocks.find(GetHash()); + if (i != mapTxLocks.end()){ + if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){ + LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete %s !\n", (*i).second.GetHash().ToString().c_str()); + return nInstantXDepth; } } - //printf("mapTxLocks end %d %d\n", found , (int)vout.size()); - if(found == (int)vout.size()) return nInstantXDepth; return 0; }