From 441103ea715c00207d6008ea34289dbe6fce80d5 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Sun, 8 Mar 2015 07:49:04 -0700 Subject: [PATCH] update relay rules - protocol/version bump --- configure.ac | 2 +- src/clientversion.h | 2 +- src/core.h | 2 +- src/darksend.cpp | 22 ++++++++++------------ src/test/data/sighash.json | 2 +- src/version.h | 2 +- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 06c7c2131..b43bdb87a 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, 3) +define(_CLIENT_VERSION_BUILD, 4) 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 1e5b81cdc..d8efe956d 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 3 +#define CLIENT_VERSION_BUILD 4 diff --git a/src/core.h b/src/core.h index cceb6a111..33996e105 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 = 70069; // minimum peer version accepted by DarkSendPool +static const int MIN_POOL_PEER_PROTO_VERSION = 70070; // minimum peer version accepted by DarkSendPool class CTransaction; diff --git a/src/darksend.cpp b/src/darksend.cpp index 0b04a06a5..c65acac09 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -23,13 +23,13 @@ using namespace boost; CCriticalSection cs_darksend; -// The main object for accessing Darksend +// The main object for accessing Darksend CDarksendPool darkSendPool; -// A helper object for signing messages from Masternodes +// A helper object for signing messages from Masternodes CDarkSendSigner darkSendSigner; -// The current Darksends in progress on the network +// The current Darksends in progress on the network std::vector vecDarksendQueue; -// Keep track of the used Masternodes +// Keep track of the used Masternodes std::vector vecMasternodesUsed; // Keep track of the scanning errors I've seen map mapDarksendBroadcastTxes; @@ -173,11 +173,6 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand return; } - if(state != POOL_STATUS_IDLE){ - LogPrintf("dsr -- wrong state to relay! \n"); - return; - } - CDarkSendRelay dsr; vRecv >> dsr; @@ -200,6 +195,9 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand int a = mnodeman.GetMasternodeRank(activeMasternode.vin, chainActive.Tip()->nHeight, MIN_POOL_PEER_PROTO_VERSION); + /* + For added DDOS protection, clients can only relay through 20 nodes per block. + */ if(a > 20){ LogPrintf("dsr -- unknown/invalid Masternode! %s \n", activeMasternode.vin.ToString().c_str()); return; @@ -1484,7 +1482,7 @@ bool CDarksendPool::SignFinalTransaction(CTransaction& finalTransactionNew, CNod //already signed if(finalTransaction.vin[mine].scriptSig != CScript()) continue; if(sigs.size() > 7) break; //send 7 each signing - + int foundOutputs = 0; int64_t nValue1 = 0; int64_t nValue2 = 0; @@ -2551,7 +2549,7 @@ bool CDSAnonTx::AddOutput(const CTxOut out){ if(fDebug) LogPrintf("CDSAnonTx::AddOutput -- new %s\n", out.ToString().substr(0,24).c_str()); BOOST_FOREACH(CTxOut& out2, vout) - if(out2.nValue == out.nValue && out.scriptPubKey == out2.scriptPubKey) + if(out2.nValue == out.nValue && out.scriptPubKey == out2.scriptPubKey) return false; vout.push_back(out); @@ -2567,7 +2565,7 @@ bool CDSAnonTx::AddInput(const CTxIn in){ //already have this input BOOST_FOREACH(CTxDSIn& in2, vin) - if(in2.prevout == in.prevout && in.nSequence == in2.nSequence) + if(in2.prevout == in.prevout && in.nSequence == in2.nSequence) return false; vin.push_back(in); diff --git a/src/test/data/sighash.json b/src/test/data/sighash.json index d66a56ac3..5954cef9a 100644 --- a/src/test/data/sighash.json +++ b/src/test/data/sighash.json @@ -413,7 +413,7 @@ ["6f62138301436f33a00b84a26a0457ccbfc0f82403288b9cbae39986b34357cb2ff9b889b302000000045253655335a7ff6701bac9960400000000086552ab656352635200000000", "6aac51", 0, 1444414211, "502a2435fd02898d2ff3ab08a3c19078414b32ec9b73d64a944834efc9dae10c"], ["9981143a040a88c2484ac3abe053849e72d04862120f424f373753161997dd40505dcb4783030000000700536365536565a2e10da3f4b1c1ad049d97b33f0ae0ea48c5d7c30cc8810e144ad93be97789706a5ead180100000003636a00ffffffffbdcbac84c4bcc87f03d0ad83fbe13b369d7e42ddb3aecf40870a37e814ad8bb5010000000963536a5100636a53abffffffff883609905a80e34202101544f69b58a0b4576fb7391e12a769f890eef90ffb72020000000651656352526affffffff04243660000000000004ab5352534a9ce001000000000863656363ab6a53652df19d030000000003ac65acedc51700000000000000000000", "ac6300acac", 2, 293672388, "7ba99b289c04718a7283f150d831175ed6303081e191a0608ea81f78926c5bdf"], ["a2bb630b01989bc5d643f2da4fb9b55c0cdf846ba06d1dbe372893024dbbe5b9b8a1900af802000000055265ac63aca7a68d2f04916c74010000000003abac007077f0040000000001007d4127010000000005ac516aac000f31e8030000000000571079c9", "65ab0051ac", 0, -1103627693, "92d53b4390262e6b288e8a32e0cfc36cd5adfdfabfe96c7bfd4a19d65e233761"], - ["49f7d0b6037bba276e910ad3cd74966c7b3bc197ffbcfefd6108d6587006947e97789835ea0300000008526a52006a650053ffffffff8d7b6c07cd10f4c4010eac7946f61aff7fb5f3920bdf3467e939e58a1d4100ab03000000076aac63ac535351ffffffff8f48c3ba2d52ad67fbcdc90d8778f3c8a3894e3c35b9730562d7176b81af23c80100000003ab5265ffffffff0301e3ef0300000000046a525353e899ac0500000000075153ab6a65abac259bea0400000000007b739972", "53516aacac6aac", 1, 955403557, "5d366a7f4346ae18aeb7c9fc4dab5af71173184aa20ed22fcb4ea8511ad25449"], + ["49f7d0b6037bba276e910ad3cd74966c7b3bc197ffbcfefd6108d6587007047e97789835ea0300000008526a52006a650053ffffffff8d7b6c07cd10f4c4010eac7946f61aff7fb5f3920bdf3467e939e58a1d4100ab03000000076aac63ac535351ffffffff8f48c3ba2d52ad67fbcdc90d8778f3c8a3894e3c35b9730562d7176b81af23c80100000003ab5265ffffffff0301e3ef0300000000046a525353e899ac0500000000075153ab6a65abac259bea0400000000007b739972", "53516aacac6aac", 1, 955403557, "5d366a7f4346ae18aeb7c9fc4dab5af71173184aa20ed22fcb4ea8511ad25449"], ["58a4fed801fbd8d92db9dfcb2e26b6ff10b120204243fee954d7dcb3b4b9b53380e7bb8fb60100000003006351ffffffff02a0795b050000000006536351ac6aac2718d00200000000075151acabac515354d21ba1", "005363515351", 0, -1322430665, "bbee941bbad950424bf40e3623457db47f60ed29deaa43c99dec702317cb3326"], ["32765a0b02e455793d9ce530e9f6a44bcbc612e893a875b5da61d822dc56d8245166c398b403000000085353abac6300006a6bdee2a78d0d0b6a5ea666eed70b9bfea99d1d612ba3878f615c4da10d4a521cba27155002000000035363abffffffff043cd42401000000000551656a53653685320100000000030000511881bc0500000000065165abab636a20169f010000000007acab656aac63acdb0706a8", "65ac53ab53", 0, 1936499176, "5c5a9c3a5de7dc7a82bc171c9d3505913b8bcc450bc8b2d11772c1a1d781210b"], ["17fad0d303da0d764fedf9f2887a91ea625331b28704940f41e39adf3903d8e75683ef6d46020000000151ffffffffff376eea4e880bcf0f03d33999104aafed2b3daf4907950bb06496af6b51720a020000000900636a63525253525196521684f3b08497bad2c660b00b43a6a517edc58217876eb5e478aa3b5fda0f29ee1bea00000000046aacab6affffffff03dde8e2050000000007ac5365ac51516a14772e000000000005630000abacbbb360010000000006ab5251ab656a50f180f0", "0053", 0, -1043701251, "a3bdf8771c8990971bff9b4e7d59b7829b067ed0b8d3ac1ec203429811384668"], diff --git a/src/version.h b/src/version.h index 6a9a1e0f3..4c6f90b68 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 = 70069; +static const int PROTOCOL_VERSION = 70070; // intial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209;