From d49601c1709c15d793c0d7506b9a5a9acf908190 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 18 Mar 2015 18:30:52 +0300 Subject: [PATCH 1/3] typo --- doc/guide-startmany.md | 2 +- doc/masternode_conf.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/guide-startmany.md b/doc/guide-startmany.md index 7bddd4ae18..8dadff1783 100644 --- a/doc/guide-startmany.md +++ b/doc/guide-startmany.md @@ -97,7 +97,7 @@ Make note of the hash (which is your collaterla_output) and index. ### Enter your MasterNode details into your masternode.conf file [From the darkcoin github repo](https://github.com/darkcoin/darkcoin/blob/master/doc/masternode_conf.md) -The new masternode.conf format consists of a space seperated text file. Each line consisting of an alias, IP address followed by port, masternode private key, collateral output transaction id and collateral output index, donation address and donation percentage (the latter two are optional and should be in format "address:percantage"). +The new masternode.conf format consists of a space seperated text file. Each line consisting of an alias, IP address followed by port, masternode private key, collateral output transaction id and collateral output index, donation address and donation percentage (the latter two are optional and should be in format "address:percentage"). ``` alias ipaddress:port masternode_private_key collateral_output collateral_output_index donationin_address:donation_percentage diff --git a/doc/masternode_conf.md b/doc/masternode_conf.md index 2113bf38d7..3aed94afb4 100644 --- a/doc/masternode_conf.md +++ b/doc/masternode_conf.md @@ -6,7 +6,7 @@ The multi masternode config allows to control multiple masternodes from a single * Mac OS: ~/Library/Application Support/Darkcoin/ * Unix/Linux: ~/.darkcoin/ -The new masternode.conf format consists of a space seperated text file. Each line consisting of an alias, IP address followed by port, masternode private key, collateral output transaction id, collateral output index, donation address and donation percentage (the latter two are optional and should be in format "address:percantage"). +The new masternode.conf format consists of a space seperated text file. Each line consisting of an alias, IP address followed by port, masternode private key, collateral output transaction id, collateral output index, donation address and donation percentage (the latter two are optional and should be in format "address:percentage"). Example: ``` From a1ac7ca8d3008372a5c21050e10652b4523d5deb Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Wed, 18 Mar 2015 09:41:30 -0700 Subject: [PATCH 2/3] Fixed blinding submission process --- configure.ac | 2 +- src/clientversion.h | 2 +- src/core.h | 2 +- src/darksend.cpp | 35 +++++++++++++++++++++-------------- src/darksend.h | 2 ++ src/masternode-pos.h | 2 +- src/masternode.cpp | 3 +++ src/version.h | 2 +- 8 files changed, 31 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac index a9d2aaa0c5..cdab575224 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/src/clientversion.h b/src/clientversion.h index 3971decb08..894b54dd6e 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -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 diff --git a/src/core.h b/src/core.h index 4868afc66d..f80f210334 100644 --- a/src/core.h +++ b/src/core.h @@ -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; diff --git a/src/darksend.cpp b/src/darksend.cpp index d5453f9895..76fe61dea9 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -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; } diff --git a/src/darksend.h b/src/darksend.h index ecda13022c..dcf98dedf4 100644 --- a/src/darksend.h +++ b/src/darksend.h @@ -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 diff --git a/src/masternode-pos.h b/src/masternode-pos.h index 39533bd147..78e4a4c46f 100644 --- a/src/masternode-pos.h +++ b/src/masternode-pos.h @@ -25,7 +25,7 @@ class CMasternodeScanningError; extern map 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 diff --git a/src/masternode.cpp b/src/masternode.cpp index a50d5f2c92..7ea36fc891 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -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 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; } diff --git a/src/version.h b/src/version.h index c4b23e1f13..217042db8e 100644 --- a/src/version.h +++ b/src/version.h @@ -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; From e82c88ecbd10ce3a0aa112d9feef3db8dfd4e7ad Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Wed, 18 Mar 2015 10:19:13 -0700 Subject: [PATCH 3/3] increasing ds timeouts --- src/darksend.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/darksend.h b/src/darksend.h index dcf98dedf4..73b8dff16a 100644 --- a/src/darksend.h +++ b/src/darksend.h @@ -38,9 +38,9 @@ class CActiveMasternode; #define MASTERNODE_REJECTED 0 #define MASTERNODE_RESET -1 -#define DARKSEND_QUEUE_TIMEOUT 120 // in seconds +#define DARKSEND_QUEUE_TIMEOUT 180 // in seconds #define DARKSEND_SIGNING_TIMEOUT 30 // in seconds -#define DARKSEND_DOWNGRADE_TIMEOUT 30 // in seconds +#define DARKSEND_DOWNGRADE_TIMEOUT 60 // in seconds // used for anonymous relaying of inputs/outputs/sigs #define DARKSEND_RELAY_IN 1 @@ -63,7 +63,7 @@ class CTxDSIn : public CTxIn { public: bool fHasSig; // flag to indicate if signed - int nSentTimes; //times we've sent this anonymously + int nSentTimes; //times we've sent this anonymously CTxDSIn(const CTxIn& in) { @@ -80,7 +80,7 @@ public: class CTxDSOut : public CTxOut { public: - int nSentTimes; //times we've sent this anonymously + int nSentTimes; //times we've sent this anonymously CTxDSOut(const CTxOut& out) { @@ -206,7 +206,7 @@ public: return false; } - /// Set the 'strSharedKey' + /// Set the 'strSharedKey' void SetSharedKey(std::string strSharedKey); /** Sign this Darksend transaction @@ -269,7 +269,7 @@ public: bool IsTransactionValid(); /// Add an output bool AddOutput(const CTxOut out); - /// Add an input + /// Add an input bool AddInput(const CTxIn in); /// Clear Signatures bool ClearSigs(); @@ -523,11 +523,11 @@ public: void ClearLastMessage(); /// Used for liquidity providers bool SendRandomPaymentToSelf(); - + /// Split up large inputs or make fee sized inputs bool MakeCollateralAmounts(); bool CreateDenominated(int64_t nTotalValue); - + /// Get the denominations for a list of outputs (returns a bitshifted integer) int GetDenominations(const std::vector& vout); int GetDenominations(const std::vector& vout);