From c53d646eebe63cae45e51065be33a73fa83c5d76 Mon Sep 17 00:00:00 2001 From: protonn Date: Sat, 22 Apr 2017 23:42:28 -0500 Subject: [PATCH 1/8] implement GetGeometricMeanPrevWork --- src/chainparams.cpp | 4 ++-- src/consensus/params.h | 2 +- src/pow.cpp | 15 ++++++--------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 50912e4fa6ffd..70638f7ae9ce4 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -60,10 +60,10 @@ class CMainParams : public CChainParams { //consensus.nBlockAlgoNormalisedWorkStart = 740000; // block where algo combined weight starts //consensus.nBlockAlgoNormalisedWorkDecayStart1 = 866000; // block where weight decay starts //consensus.nBlockAlgoNormalisedWorkDecayStart2 = 932000; // block where weight decay starts - //consensus.nGeoAvgWork_Start = 4000000; // TODO + consensus.nGeoAvgWork_Start = 2389061; consensus.nDGW3StartBlock = 1635000; consensus.nMultiAlgoFork = 1930000; // Block where multi-algo difficulty adjustment and 45 second blocktime starts - consensus.nCoinbaseMaturityV2Start = 2422000; + consensus.nCoinbaseMaturityV2Start = 2389061; /** * The message start string is designed to be unlikely to occur in normal data. diff --git a/src/consensus/params.h b/src/consensus/params.h index b324de666231b..3067c4e06c965 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -38,7 +38,7 @@ struct Params { //int64_t nBlockAlgoNormalisedWorkStart; //int64_t nBlockAlgoNormalisedWorkDecayStart1; //int64_t nBlockAlgoNormalisedWorkDecayStart2; - //int64_t nGeoAvgWork_Start; + int64_t nGeoAvgWork_Start; int64_t nMultiAlgoFork; int64_t nDGW3StartBlock; int64_t nCoinbaseMaturityV2Start; diff --git a/src/pow.cpp b/src/pow.cpp index 2dde9486aa11b..4cc28a9415535 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -610,7 +610,7 @@ arith_uint256 GetPrevWorkForAlgo(const CBlockIndex& block, int algo) return arith_uint256(0); } */ -/*arith_uint256 GetPrevWorkForAlgoWithDecay3(const CBlockIndex& block, int algo) +arith_uint256 GetPrevWorkForAlgoWithDecay3(const CBlockIndex& block, int algo) { int nDistance = 0; arith_uint256 nWork; @@ -632,9 +632,9 @@ arith_uint256 GetPrevWorkForAlgo(const CBlockIndex& block, int algo) nDistance++; } return arith_uint256(0); -}*/ +} -/*arith_uint256 GetGeometricMeanPrevWork(const CBlockIndex& block) // TODO Argentum +arith_uint256 GetGeometricMeanPrevWork(const CBlockIndex& block) { //arith_uint256 bnRes; arith_uint256 nBlockWork = GetBlockProofBase(block); @@ -654,12 +654,9 @@ arith_uint256 GetPrevWorkForAlgo(const CBlockIndex& block, int algo) // Compute the geometric mean CBigNum bnRes = bnBlockWork.nthRoot(NUM_ALGOS); - // Scale to roughly match the old work calculation - bnRes <<= 7; - //return bnRes; return UintToArith256(bnRes.getuint256()); -}*/ +} arith_uint256 GetBlockProof(const CBlockIndex& block) { @@ -669,10 +666,10 @@ arith_uint256 GetBlockProof(const CBlockIndex& block) int nHeight = block.nHeight; int nAlgo = block.GetAlgo(); - /*if (nHeight > chainparams.GetConsensus().nGeoAvgWork_Start) // TODO Argentum + if (nHeight >= chainparams.GetConsensus().nGeoAvgWork_Start) { bnTarget = GetGeometricMeanPrevWork(block); - }*/ + } if (nHeight >= chainparams.GetConsensus().nMultiAlgoFork) { arith_uint256 nBlockWork = GetBlockProofBase(block); From b5ae0354f1e25605b3efbbe0554e44bf66b6cb9c Mon Sep 17 00:00:00 2001 From: protonn Date: Sat, 22 Apr 2017 23:49:27 -0500 Subject: [PATCH 2/8] bump version and protocol --- configure.ac | 2 +- src/clientversion.h | 2 +- src/version.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 90d03b96d41e6..490fabba33b85 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 3) define(_CLIENT_VERSION_MINOR, 11) -define(_CLIENT_VERSION_REVISION, 2) +define(_CLIENT_VERSION_REVISION, 3) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2017) diff --git a/src/clientversion.h b/src/clientversion.h index 66e4c6ed47fe0..af9bee75ebe5a 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -16,7 +16,7 @@ //! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 3 #define CLIENT_VERSION_MINOR 11 -#define CLIENT_VERSION_REVISION 2 +#define CLIENT_VERSION_REVISION 3 #define CLIENT_VERSION_BUILD 0 //! Set to true for release, false for prerelease or test build diff --git a/src/version.h b/src/version.h index dfed70ebe3222..91e09c0f5c776 100644 --- a/src/version.h +++ b/src/version.h @@ -15,7 +15,7 @@ static const int PROTOCOL_VERSION = 1060000; static const int INIT_PROTO_VERSION = 209; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 1050000; +static const int MIN_PEER_PROTO_VERSION = 1060000; // disconnect from peers older than this client sub version static const std::string MIN_PEER_CLIENT_VERSION = "2.4.1"; From fbab202ba79b5ac56de236f5be76e9a3d6f96a59 Mon Sep 17 00:00:00 2001 From: protonn Date: Sun, 23 Apr 2017 11:05:37 -0500 Subject: [PATCH 3/8] adjust geoavgwork start height --- src/chainparams.cpp | 2 +- src/pow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 70638f7ae9ce4..1c6dfd06418f8 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -60,7 +60,7 @@ class CMainParams : public CChainParams { //consensus.nBlockAlgoNormalisedWorkStart = 740000; // block where algo combined weight starts //consensus.nBlockAlgoNormalisedWorkDecayStart1 = 866000; // block where weight decay starts //consensus.nBlockAlgoNormalisedWorkDecayStart2 = 932000; // block where weight decay starts - consensus.nGeoAvgWork_Start = 2389061; + consensus.nGeoAvgWork_Start = 2389062; consensus.nDGW3StartBlock = 1635000; consensus.nMultiAlgoFork = 1930000; // Block where multi-algo difficulty adjustment and 45 second blocktime starts consensus.nCoinbaseMaturityV2Start = 2389061; diff --git a/src/pow.cpp b/src/pow.cpp index 4cc28a9415535..d63c47ce21328 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -670,7 +670,7 @@ arith_uint256 GetBlockProof(const CBlockIndex& block) { bnTarget = GetGeometricMeanPrevWork(block); } - if (nHeight >= chainparams.GetConsensus().nMultiAlgoFork) + else if (nHeight >= chainparams.GetConsensus().nMultiAlgoFork) { arith_uint256 nBlockWork = GetBlockProofBase(block); for (int algo = 0; algo < NUM_ALGOS; algo++) From f956eef0dfc75c1c2aaa28022baae9aa798965dc Mon Sep 17 00:00:00 2001 From: protonn Date: Sun, 23 Apr 2017 14:06:37 -0500 Subject: [PATCH 4/8] update fork height --- src/chainparams.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 1c6dfd06418f8..61cf9f0835947 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -60,10 +60,10 @@ class CMainParams : public CChainParams { //consensus.nBlockAlgoNormalisedWorkStart = 740000; // block where algo combined weight starts //consensus.nBlockAlgoNormalisedWorkDecayStart1 = 866000; // block where weight decay starts //consensus.nBlockAlgoNormalisedWorkDecayStart2 = 932000; // block where weight decay starts - consensus.nGeoAvgWork_Start = 2389062; + consensus.nGeoAvgWork_Start = 2387838; consensus.nDGW3StartBlock = 1635000; consensus.nMultiAlgoFork = 1930000; // Block where multi-algo difficulty adjustment and 45 second blocktime starts - consensus.nCoinbaseMaturityV2Start = 2389061; + consensus.nCoinbaseMaturityV2Start = 2387838; /** * The message start string is designed to be unlikely to occur in normal data. From f6127d23808d12dbf1fdc6770860d87cf9ef63de Mon Sep 17 00:00:00 2001 From: protonn Date: Mon, 24 Apr 2017 12:07:03 -0500 Subject: [PATCH 5/8] set protocol version --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 91e09c0f5c776..87f5dc4779df6 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 1060000; +static const int PROTOCOL_VERSION = 1070000; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; From 13fc841fb8561117035bf92e850d91f0f99491fc Mon Sep 17 00:00:00 2001 From: protonn Date: Tue, 25 Apr 2017 01:19:11 -0500 Subject: [PATCH 6/8] set minimum protocol version --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 87f5dc4779df6..12f7a83b0eb10 100644 --- a/src/version.h +++ b/src/version.h @@ -15,7 +15,7 @@ static const int PROTOCOL_VERSION = 1070000; static const int INIT_PROTO_VERSION = 209; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 1060000; +static const int MIN_PEER_PROTO_VERSION = 1070000; // disconnect from peers older than this client sub version static const std::string MIN_PEER_CLIENT_VERSION = "2.4.1"; From d541b2ec3f8b1e5d46693286b89c57e7d3600bad Mon Sep 17 00:00:00 2001 From: protonn Date: Tue, 25 Apr 2017 02:12:02 -0500 Subject: [PATCH 7/8] add fork checkpoint --- src/chainparams.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 61cf9f0835947..7cdffd2b34057 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -149,11 +149,12 @@ class CMainParams : public CChainParams { ( 1924401, uint256S("0x2267dd4753f9e8fa088cdc4d257355b0a118ccd43a2f366c68de1aa260c4ba22")) ( 1934707, uint256S("0xe4527742cb236f24b355156213775e44da0e728ea453fae712fa672b18ce5f84")) ( 2050260, uint256S("0xbc55838e026131fab334f1c87de9fea3218d076f4de03dc19f94d4f12da7d6c1")) - ( 2365716, uint256S("0x947827b4599512a675fc3789ac8778b3187277705ffda7b6e3cf6adaa31dac10")), + ( 2365716, uint256S("0x947827b4599512a675fc3789ac8778b3187277705ffda7b6e3cf6adaa31dac10")) + ( 2387838, uint256S("0x00000000000000254214c9f9fbdd39c07072b43df52f35a910509f4c5406c272")), 1491891115, // * UNIX timestamp of last checkpoint block - 2604836, // * total number of transactions between genesis and last checkpoint + 2629957, // * total number of transactions between genesis and last checkpoint // (the tx=... number in the SetBestChain debug.log lines) - 2000 // * estimated number of transactions per day after checkpoint + 3000 // * estimated number of transactions per day after checkpoint }; } }; From 9eefc151776453a4e45e5502eda93f21074dd40c Mon Sep 17 00:00:00 2001 From: protonn Date: Tue, 25 Apr 2017 03:34:58 -0500 Subject: [PATCH 8/8] fix relayfee calculation --- src/amount.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amount.h b/src/amount.h index 98e5fa0b18d72..f01fff167e27d 100644 --- a/src/amount.h +++ b/src/amount.h @@ -34,7 +34,7 @@ class CFeeRate CFeeRate(const CFeeRate& other) { nSatoshisPerK = other.nSatoshisPerK; } CAmount GetFee(size_t size) const; // unit returned is satoshis - CAmount GetFeePerK() const { return GetFee(50000); } // satoshis-per-1000-bytes + CAmount GetFeePerK() const { return GetFee(1000); } // satoshis-per-1000-bytes friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; } friend bool operator>(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK > b.nSatoshisPerK; }