Fixed blinding submission process

This commit is contained in:
Evan Duffield 2015-03-18 09:41:30 -07:00
parent 4d7db44afa
commit a1ac7ca8d3
8 changed files with 31 additions and 19 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, 2)
define(_CLIENT_VERSION_BUILD, 5)
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 2
#define CLIENT_VERSION_BUILD 5
#define CLIENT_VERSION_BUILD 6

View File

@ -43,7 +43,7 @@ static const int64_t DARKSEND_POOL_MAX = (999.99*COIN);
#define MASTERNODE_EXPIRATION_SECONDS (65*60)
#define MASTERNODE_REMOVAL_SECONDS (70*60)
static const int MIN_POOL_PEER_PROTO_VERSION = 70071; // minimum peer version accepted by DarkSendPool
static const int MIN_POOL_PEER_PROTO_VERSION = 70072; // minimum peer version accepted by DarkSendPool
class CTransaction;

View File

@ -285,7 +285,6 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
}
// relay to all peers that an entry was added to the pool successfully.
RelayStatus(sessionID, GetState(), GetEntriesCount(), MASTERNODE_ACCEPTED);
Check();
} else if (strCommand == "dsi") { //Darksend vIn
@ -642,12 +641,7 @@ void CDarksendPool::SetNull(bool clearEverything){
if(clearEverything){
myEntries.clear();
if(fMasterNode){
sessionID = 1 + (rand() % 999999);
} else {
sessionID = 0;
}
sessionID = 0;
}
// -- seed random number generator (used for ordering output lists)
@ -765,7 +759,7 @@ void CDarksendPool::CheckFinalTransaction()
// See if the transaction is valid
if (!txNew.AcceptToMemoryPool(false))
{
if(nCountAttempts > 10) {
if(nCountAttempts > 60) {
LogPrintf("CDarksendPool::Check() - CommitTransaction : Error: Transaction not valid\n");
SetNull();
pwalletMain->Lock();
@ -773,9 +767,8 @@ void CDarksendPool::CheckFinalTransaction()
// not much we can do in this case]
UpdateState(POOL_STATUS_ACCEPTING_ENTRIES);
if(nCountAttempts > 5) RelayCompletedTransaction(sessionID, true, "Transaction not valid, please try again");
if(!fSubmitAnonymousFailed && nCountAttempts > 5)
if(!fSubmitAnonymousFailed && nCountAttempts > 30)
fSubmitAnonymousFailed = true;
return;
}
@ -1418,7 +1411,7 @@ bool CDarksendPool::StatusUpdate(int newState, int newEntriesCount, int newAccep
lastMessage = error;
}
if(newAccepted == 1) {
if(newAccepted == 1 && newSessionID != 0) {
sessionID = newSessionID;
LogPrintf("CDarksendPool::StatusUpdate - set sessionID to %d\n", sessionID);
sessionFoundMasternode = true;
@ -1476,8 +1469,8 @@ bool CDarksendPool::SignFinalTransaction(CTransaction& finalTransactionNew, CNod
if(mine >= 0){ //might have to do this one input at a time?
//already signed
if(finalTransaction.vin[mine].scriptSig != CScript()) continue;
if(sigs.size() > 7) break; //send 7 each signing
CScript scriptOld = finalTransaction.vin[mine].scriptSig;
if(!fSubmitAnonymousFailed && sigs.size() > 7) break; //send 7 each signing
int foundOutputs = 0;
int64_t nValue1 = 0;
@ -1510,6 +1503,8 @@ bool CDarksendPool::SignFinalTransaction(CTransaction& finalTransactionNew, CNod
// not sure what to do here, it will timeout...?
}
if(scriptOld != CScript() && finalTransaction.vin[mine].scriptSig == scriptOld) continue;
sigs.push_back(finalTransaction.vin[mine]);
if(fDebug) LogPrintf(" -- dss %d %d %s\n", mine, (int)sigs.size(), finalTransaction.vin[mine].scriptSig.ToString().c_str());
}
@ -2127,6 +2122,7 @@ bool CDarksendPool::IsCompatibleWithSession(int64_t nDenom, CTransaction txColla
if(sessionUsers < 0) sessionUsers = 0;
if(sessionUsers == 0) {
sessionID = 1 + (rand() % 999999);
sessionDenom = nDenom;
sessionUsers++;
lastTimeChanged = GetTimeMillis();
@ -2554,6 +2550,7 @@ bool CDSAnonTx::AddOutput(const CTxOut out){
vout.push_back(out);
std::random_shuffle ( vout.begin(), vout.end(), randomizeList);
ClearSigs();
return true;
}
@ -2570,6 +2567,16 @@ bool CDSAnonTx::AddInput(const CTxIn in){
vin.push_back(in);
std::random_shuffle ( vin.begin(), vin.end(), randomizeList);
ClearSigs();
return true;
}
bool CDSAnonTx::ClearSigs(){
LOCK(cs_darksend);
BOOST_FOREACH(CTxDSIn& in, vin)
in.scriptSig = CScript();
return true;
}

View File

@ -271,6 +271,8 @@ public:
bool AddOutput(const CTxOut out);
/// Add an input
bool AddInput(const CTxIn in);
/// Clear Signatures
bool ClearSigs();
/// Add Signature
bool AddSig(const CTxIn in);
/// Count the number of entries in the transaction

View File

@ -25,7 +25,7 @@ class CMasternodeScanningError;
extern map<uint256, CMasternodeScanningError> mapMasternodeScanningErrors;
extern CMasternodeScanning mnscan;
static const int MIN_MASTERNODE_POS_PROTO_VERSION = 70071;
static const int MIN_MASTERNODE_POS_PROTO_VERSION = 70072;
/*
1% of the network is scanned every 2.5 minutes, making a full

View File

@ -143,6 +143,7 @@ CMasternode::CMasternode()
nLastDsq = 0;
donationAddress = CScript();
donationPercentage = 0;
nScanningErrorCount = 0;
}
CMasternode::CMasternode(const CMasternode& other)
@ -165,6 +166,7 @@ CMasternode::CMasternode(const CMasternode& other)
nLastDsq = other.nLastDsq;
donationAddress = other.donationAddress;
donationPercentage = other.donationPercentage;
nScanningErrorCount = other.nScanningErrorCount;
}
CMasternode::CMasternode(CService newAddr, CTxIn newVin, CPubKey newPubkey, std::vector<unsigned char> newSig, int64_t newSigTime, CPubKey newPubkey2, int protocolVersionIn, CScript newDonationAddress, int newDonationPercentage)
@ -185,6 +187,7 @@ CMasternode::CMasternode(CService newAddr, CTxIn newVin, CPubKey newPubkey, std:
allowFreeTx = true;
protocolVersion = protocolVersionIn;
nLastDsq = 0;
nScanningErrorCount = 0;
donationAddress = newDonationAddress;
donationPercentage = newDonationPercentage;
}

View File

@ -27,7 +27,7 @@ extern const std::string CLIENT_DATE;
// network protocol versioning
//
static const int PROTOCOL_VERSION = 70071;
static const int PROTOCOL_VERSION = 70072;
// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;