mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
improvements to IsTransactionLocked
This commit is contained in:
parent
1377b71347
commit
a0d5f92f87
@ -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_FEE = (0.0125*COIN);
|
||||||
static const int64_t DARKSEND_POOL_MAX = (999.99*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_NOT_PROCESSED 0 // initial state
|
||||||
#define MASTERNODE_IS_CAPABLE 1
|
#define MASTERNODE_IS_CAPABLE 1
|
||||||
#define MASTERNODE_NOT_CAPABLE 2
|
#define MASTERNODE_NOT_CAPABLE 2
|
||||||
|
@ -23,8 +23,6 @@ std::map<uint256, CTransaction> mapTxLockReqRejected;
|
|||||||
std::map<uint256, int> mapTxLockVote;
|
std::map<uint256, int> mapTxLockVote;
|
||||||
std::map<uint256, CTransactionLock> mapTxLocks;
|
std::map<uint256, CTransactionLock> mapTxLocks;
|
||||||
|
|
||||||
#define INSTANTX_SIGNATURES_REQUIRED 2
|
|
||||||
|
|
||||||
//txlock - Locks transaction
|
//txlock - Locks transaction
|
||||||
//
|
//
|
||||||
//step 1.) Broadcast intention to lock transaction inputs, "txlreg", CTransaction
|
//step 1.) Broadcast intention to lock transaction inputs, "txlreg", CTransaction
|
||||||
@ -190,7 +188,7 @@ void ProcessConsensusVote(CConsensusVote& ctx)
|
|||||||
if (i != mapTxLocks.end()){
|
if (i != mapTxLocks.end()){
|
||||||
(*i).second.AddSignature(ctx);
|
(*i).second.AddSignature(ctx);
|
||||||
if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
19
src/main.cpp
19
src/main.cpp
@ -1160,21 +1160,14 @@ int CMerkleTx::IsTransactionLocked() const
|
|||||||
{
|
{
|
||||||
if(nInstantXDepth == 0) return 0;
|
if(nInstantXDepth == 0) return 0;
|
||||||
|
|
||||||
//printf("mapTxLocks start\n");
|
//compile consessus vote
|
||||||
typedef std::map<uint256, CTransactionLock>::iterator it_ctxl;
|
std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(GetHash());
|
||||||
|
if (i != mapTxLocks.end()){
|
||||||
int found = 0;
|
if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){
|
||||||
for (unsigned int b = 0; b < vout.size(); b++) {
|
LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete %s !\n", (*i).second.GetHash().ToString().c_str());
|
||||||
for(it_ctxl it = mapTxLocks.begin(); it != mapTxLocks.end(); it++) {
|
return nInstantXDepth;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("mapTxLocks end %d %d\n", found , (int)vout.size());
|
|
||||||
if(found == (int)vout.size()) return nInstantXDepth;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user