From 64e8cbc66130720d91aac0e93878562183702065 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Thu, 5 Feb 2015 17:16:43 -0700 Subject: [PATCH 1/4] version/protocol bump --- configure.ac | 2 +- src/clientversion.h | 2 +- src/core.h | 9 +++++++-- src/darksend.h | 2 +- src/instantx.h | 2 +- src/version.h | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index fa5c49782e..9b17c6dea3 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, 1) -define(_CLIENT_VERSION_BUILD, 10) +define(_CLIENT_VERSION_BUILD, 11) 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 54c886b34e..ebdad62abd 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 1 -#define CLIENT_VERSION_BUILD 10 +#define CLIENT_VERSION_BUILD 11 diff --git a/src/core.h b/src/core.h index c26d9a2d0a..41b1d2d8d2 100644 --- a/src/core.h +++ b/src/core.h @@ -19,8 +19,13 @@ static const int64_t DARKSEND_COLLATERAL = (0.1*COIN); static const int64_t DARKSEND_FEE = (0.0125*COIN); static const int64_t DARKSEND_POOL_MAX = (999.99*COIN); -#define INSTANTX_SIGNATURES_REQUIRED 6 -#define INSTANTX_SIGNATURES_TOTAL 10 +/* + At 15 signatures, 1/2 of the masternode network can be owned by + one party without comprimising the security of InstantX + (1000/2150.0)**15 = 1.031e-05 +*/ +#define INSTANTX_SIGNATURES_REQUIRED 15 +#define INSTANTX_SIGNATURES_TOTAL 20 #define MASTERNODE_NOT_PROCESSED 0 // initial state #define MASTERNODE_IS_CAPABLE 1 diff --git a/src/darksend.h b/src/darksend.h index 1b4a2e68c6..06717395e5 100644 --- a/src/darksend.h +++ b/src/darksend.h @@ -222,7 +222,7 @@ class CDarksendSession class CDarkSendPool { public: - static const int MIN_PEER_PROTO_VERSION = 70060; + static const int MIN_PEER_PROTO_VERSION = 70061; // clients entries std::vector myEntries; diff --git a/src/instantx.h b/src/instantx.h index 4b1500e6ea..2308d62168 100644 --- a/src/instantx.h +++ b/src/instantx.h @@ -23,7 +23,7 @@ class CConsensusVote; class CTransaction; class CTransactionLock; -static const int MIN_INSTANTX_PROTO_VERSION = 70060; +static const int MIN_INSTANTX_PROTO_VERSION = 70061; extern map mapTxLockReq; extern map mapTxLocks; diff --git a/src/version.h b/src/version.h index 7a7b2e40f3..8d3daa41e0 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 = 70060; +static const int PROTOCOL_VERSION = 70061; // intial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; From b27a6a3cacad492709d95306f804a12000c25483 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Thu, 5 Feb 2015 17:32:03 -0700 Subject: [PATCH 2/4] fixed score calculation --- src/instantx.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/instantx.cpp b/src/instantx.cpp index 93372326da..d4e1058973 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -541,9 +541,6 @@ void CTransactionLock::AddSignature(CConsensusVote cv) int CTransactionLock::CountSignatures() { - - return 10; - /* Only count signatures where the BlockHeight matches the transaction's blockheight. The votes have no proof it's the correct blockheight From 6149e55710fdd3cc606197b7300ecd50f00e56a8 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Thu, 5 Feb 2015 17:49:55 -0700 Subject: [PATCH 3/4] extend txlock expiration --- src/instantx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/instantx.cpp b/src/instantx.cpp index d4e1058973..4d5e538eb4 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -232,7 +232,7 @@ int64_t CreateNewLock(CTransaction tx) CTransactionLock newLock; newLock.nBlockHeight = nBlockHeight; - newLock.nExpiration = GetTime()+(60*15); //locks expire after 15 minutes (6 confirmations) + newLock.nExpiration = GetTime()+(60*60); //locks expire after 15 minutes (6 confirmations) newLock.nTimeout = GetTime()+(60*5); newLock.txHash = tx.GetHash(); mapTxLocks.insert(make_pair(tx.GetHash(), newLock)); From 76e36bfbeac2c3deed321eef91de94777bfdb43b Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Thu, 5 Feb 2015 21:41:17 -0700 Subject: [PATCH 4/4] only vote when in the top X nodes --- src/instantx.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/instantx.cpp b/src/instantx.cpp index 4d5e538eb4..1202303cfe 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -249,10 +249,25 @@ void DoConsensusVote(CTransaction& tx, int64_t nBlockHeight) { if(!fMasterNode) return; + int n = GetMasternodeRank(activeMasternode.vin, nBlockHeight, MIN_INSTANTX_PROTO_VERSION); + + if(n == -1) + { + LogPrintf("InstantX::DoConsensusVote - Unknown Masternode\n"); + return; + } + + if(n > INSTANTX_SIGNATURES_TOTAL) + { + LogPrintf("InstantX::DoConsensusVote - Masternode not in the top %d (%d)\n", INSTANTX_SIGNATURES_TOTAL, n); + return; + } /* nBlockHeight calculated from the transaction is the authoritive source */ + LogPrintf("InstantX::DoConsensusVote - In the top %d (%d)\n", INSTANTX_SIGNATURES_TOTAL, n); + CConsensusVote ctx; ctx.vinMasternode = activeMasternode.vin; ctx.txHash = tx.GetHash();