merge downstream 0.11.1

This commit is contained in:
vertoe 2015-02-04 10:08:03 +01:00
commit 498ed85dc5
5 changed files with 69 additions and 14 deletions

View File

@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 11)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 4)
define(_CLIENT_VERSION_BUILD, 6)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2015)
AC_INIT([Darkcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@darkcoin.io],[darkcoin])

View File

@ -12,7 +12,7 @@
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 11
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 4
#define CLIENT_VERSION_BUILD 6

View File

@ -97,15 +97,15 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
);
// resolve conflicts
/*std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(tx.GetHash());
std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(tx.GetHash());
if (i != mapTxLocks.end()){
//we only care if we have a complete tx lock
if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){
LogPrintf("ProcessMessageInstantX::txlreq - Found IX lock\n");
LogPrintf("ProcessMessageInstantX::txlreq - Found Existing Complete IX Lock\n");
uint256 txHash = (*i).second.txHash;
CValidationState state;
bool fMissingInputs = false;
DisconnectBlockAndInputs(state, mapTxLockReqRejected[txHash]);
DisconnectBlockAndInputs(state, tx);
if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs))
{
@ -119,9 +119,7 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
);
}
}
}*/
//record prevout, increment the amount of times seen. Ban if over 100
}
return;
}
@ -149,7 +147,6 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
*/
if(!mapTxLockReq.count(ctx.txHash) && !mapTxLockReqRejected.count(ctx.txHash)){
if(!mapUnknownVotes.count(ctx.vinMasternode.prevout.hash)){
//TODO: Make an algorithm to calculate the average time per IX/MNCOUNT
mapUnknownVotes[ctx.vinMasternode.prevout.hash] = GetTime()+(60*10);
}
@ -238,22 +235,25 @@ bool ProcessConsensusVote(CConsensusVote& ctx)
newLock.txHash = ctx.txHash;
mapTxLocks.insert(make_pair(ctx.txHash, newLock));
} else {
LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Exists %s !\n", ctx.txHash.ToString().c_str());
if(fDebug) LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Exists %s !\n", ctx.txHash.ToString().c_str());
}
//compile consessus vote
std::map<uint256, CTransactionLock>::iterator i = mapTxLocks.find(ctx.txHash);
if (i != mapTxLocks.end()){
(*i).second.AddSignature(ctx);
if(fDebug) LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Votes %d - %s !\n", (*i).second.CountSignatures(), ctx.GetHash().ToString().c_str());
if((*i).second.CountSignatures() >= INSTANTX_SIGNATURES_REQUIRED){
LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete %s !\n", (*i).second.GetHash().ToString().c_str());
if(fDebug) LogPrintf("InstantX::ProcessConsensusVote - Transaction Lock Is Complete %s !\n", (*i).second.GetHash().ToString().c_str());
if(pwalletMain->UpdatedTransaction((*i).second.txHash)){
nCompleteTXLocks++;
}
// resolve conflicts
/*
//if this tx lock was rejected, we need to remove the conflicting blocks
if(mapTxLockReqRejected.count((*i).second.txHash)){
CValidationState state;
@ -271,7 +271,7 @@ bool ProcessConsensusVote(CConsensusVote& ctx)
mapTxLockReqRejected[(*i).second.txHash].GetHash().ToString().c_str()
);
}
}*/
}
}
return true;
}

View File

@ -908,6 +908,30 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
}
}
// ----------- instantX transaction scanning -----------
std::map<uint256, CTransactionLock>::iterator it = mapTxLocks.begin();
while(it != mapTxLocks.end()) {
if(mapTxLockReq.count((*it).second.txHash)){
CTransaction& tx2 = mapTxLockReq[(*it).second.txHash];
for (unsigned int a = 0; a < tx2.vin.size(); a++) {
//we found the locked tx in the block
if(tx2.GetHash() == tx.GetHash()) continue;
//if there's a lock, look for conflicting inputs
for (unsigned int b = 0; b < tx.vin.size(); b++) {
if(tx2.vin[a].prevout == tx.vin[b].prevout) {
return false;
}
}
}
}
it++;
}
{
CCoinsView dummy;
CCoinsViewCache view(dummy);
@ -2892,6 +2916,35 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
return state.DoS(100, error("CheckBlock() : more than one coinbase"),
REJECT_INVALID, "bad-cb-multiple");
// ----------- instantX transaction scanning -----------
std::map<uint256, CTransactionLock>::iterator it = mapTxLocks.begin();
while(it != mapTxLocks.end()) {
if(mapTxLockReq.count((*it).second.txHash)){
CTransaction& tx = mapTxLockReq[(*it).second.txHash];
for (unsigned int a = 0; a < tx.vin.size(); a++) {
for (unsigned int b = 0; b < block.vtx.size(); b++) {
//we found the locked tx in the block
if(tx.GetHash() == block.vtx[b].GetHash()) continue;
//if there's a lock, look for conflicting inputs
for (unsigned int c = 0; c < block.vtx[b].vin.size(); c++) {
if(tx.vin[a].prevout == block.vtx[b].vin[c].prevout) {
return state.DoS(100, error("CheckBlock() : found conflicting transaction with transaction lock"),
REJECT_INVALID, "conflicting-tx-ix");
}
}
}
}
}
it++;
}
// ----------- masternode payments -----------
bool MasternodePayments = false;
if(TestNet()){

View File

@ -12,6 +12,7 @@
#include "net.h"
#include "darksend.h"
#include "keepass.h"
#include "instantx.h"
#include <boost/algorithm/string/replace.hpp>
#include <openssl/rand.h>
@ -1000,6 +1001,7 @@ void CWalletTx::RelayWalletTransaction(std::string strCommand)
LogPrintf("Relaying wtx %s\n", hash.ToString());
if(strCommand == "txlreq"){
mapTxLockReq.insert(make_pair(hash, (CTransaction)*this));
RelayTransactionLockReq((CTransaction)*this, hash, true);
} else {
RelayTransaction((CTransaction)*this, hash);