From d256fef0471a1fecfb73c9ac0f55a71307ce13ea Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Sun, 19 Aug 2018 19:12:03 -0500 Subject: [PATCH 01/12] fix for block version issue --- src/primitives/pureheader.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/primitives/pureheader.h b/src/primitives/pureheader.h index 25f1ce9..bb83d0e 100755 --- a/src/primitives/pureheader.h +++ b/src/primitives/pureheader.h @@ -122,7 +122,8 @@ class CBlockVersion CBlockVersion& operator=(const int nBaseVersion) { - nVersion = (nBaseVersion & 0x000000ff) | (nVersion & 0xffffff00); + //nVersion = (nBaseVersion & 0x000000ff) | (nVersion & 0xffffff00); + nVersion = nBaseVersion; return *this; } From ba4eacda903678ff8f245397607d710bff018c35 Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Sun, 19 Aug 2018 20:52:11 -0500 Subject: [PATCH 02/12] tweak to block version checking --- src/primitives/pureheader.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/primitives/pureheader.h b/src/primitives/pureheader.h index bb83d0e..167a314 100755 --- a/src/primitives/pureheader.h +++ b/src/primitives/pureheader.h @@ -122,8 +122,16 @@ class CBlockVersion CBlockVersion& operator=(const int nBaseVersion) { - //nVersion = (nBaseVersion & 0x000000ff) | (nVersion & 0xffffff00); - nVersion = nBaseVersion; + if (nBaseVersion ==1) + { + nVersion = nBaseVersion; + } + else + { + nVersion = (nBaseVersion & 0x000000ff) | (nVersion & 0xffffff00); + } + + return *this; } From ccfa30bc0099015a4eaacb3d101edc22e8d118f6 Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Sun, 19 Aug 2018 20:52:49 -0500 Subject: [PATCH 03/12] bumping build number after block version tweak --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5912318..a107278 100755 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MINOR, 3) define(_CLIENT_VERSION_REVISION, 1) -define(_CLIENT_VERSION_BUILD, 13) +define(_CLIENT_VERSION_BUILD, 14) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2018) AC_INIT([NewYorkCoin],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/NewYorkCoin-NYC/nycoin/issues],[newyorkcoin]) From c9b953d64d880b705569a13399f6dc09ccc08fd2 Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Mon, 20 Aug 2018 08:53:39 -0500 Subject: [PATCH 04/12] correction to block version during new block creation --- src/miner.cpp | 2 +- src/primitives/pureheader.h | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 4833ee3..b39519c 100755 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -109,7 +109,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) const Consensus::Params& consensusParams = chainparams.GetConsensus(nHeight); /* Initialise the block version. */ - if(nHeight < consensusParams.nHeightEffective) + if(consensusParams.fAllowLegacyBlocks) pblock->nVersion = 1; else pblock->nVersion = 3; diff --git a/src/primitives/pureheader.h b/src/primitives/pureheader.h index 167a314..25f1ce9 100755 --- a/src/primitives/pureheader.h +++ b/src/primitives/pureheader.h @@ -122,16 +122,7 @@ class CBlockVersion CBlockVersion& operator=(const int nBaseVersion) { - if (nBaseVersion ==1) - { - nVersion = nBaseVersion; - } - else - { - nVersion = (nBaseVersion & 0x000000ff) | (nVersion & 0xffffff00); - } - - + nVersion = (nBaseVersion & 0x000000ff) | (nVersion & 0xffffff00); return *this; } From 30ea8d40be02bb17ef36c8ff5a99d1ae96084226 Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Wed, 22 Aug 2018 08:44:39 -0500 Subject: [PATCH 05/12] added functions to support legacy block generation --- configure.ac | 2 +- src/miner.cpp | 11 ++++++++--- src/primitives/pureheader.h | 11 +++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index a107278..d4c8dc9 100755 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MINOR, 3) define(_CLIENT_VERSION_REVISION, 1) -define(_CLIENT_VERSION_BUILD, 14) +define(_CLIENT_VERSION_BUILD, 15) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2018) AC_INIT([NewYorkCoin],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/NewYorkCoin-NYC/nycoin/issues],[newyorkcoin]) diff --git a/src/miner.cpp b/src/miner.cpp index b39519c..8bf94bd 100755 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -110,11 +110,16 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) const Consensus::Params& consensusParams = chainparams.GetConsensus(nHeight); /* Initialise the block version. */ if(consensusParams.fAllowLegacyBlocks) - pblock->nVersion = 1; + pblock->nVersion.SetLegacyVersion(1); else - pblock->nVersion = 3; + { + pblock->nVersion = CBlockHeader::CURRENT_VERSION; + + } pblock->nVersion.SetChainId(chainparams.GetConsensus(0).nAuxpowChainId); + + // -regtest only: allow overriding block.nVersion with // -blockversion=N to test forking scenarios if (Params().MineBlocksOnDemand()) @@ -348,7 +353,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) // Fill in header pblock->hashPrevBlock = pindexPrev->GetBlockHash(); UpdateTime(pblock, consensus, pindexPrev); - if(pblock->nVersion == 1) + if(pblock->nVersion.GetLegacyBlockVersion() == 1) pblock->nBits = GetNextWorkRequiredLegacy(pindexPrev, pblock, consensus); else pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensus); diff --git a/src/primitives/pureheader.h b/src/primitives/pureheader.h index 25f1ce9..5253377 100755 --- a/src/primitives/pureheader.h +++ b/src/primitives/pureheader.h @@ -114,6 +114,16 @@ class CBlockVersion || (nVersion == 2 && GetChainId() == 0); } + inline void SetLegacyVersion(int32_t legacyVersion) + { + nVersion = legacyVersion; + } + + inline int32_t GetLegacyBlockVersion() + { + return nVersion; + } + CBlockVersion& operator=(const CBlockVersion& other) { nVersion = other.nVersion; @@ -147,6 +157,7 @@ class CPureBlockHeader public: // header static const int32_t CURRENT_VERSION = 3; + static const int32_t LEGACY_VERSION = 1; CBlockVersion nVersion; uint256 hashPrevBlock; uint256 hashMerkleRoot; From 1a825a549164efdaebd095e699d6ed3f29fb1fdb Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Wed, 22 Aug 2018 09:46:26 -0500 Subject: [PATCH 06/12] changed legacy block check in miner.cpp --- configure.ac | 2 +- src/miner.cpp | 2 +- src/primitives/pureheader.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d4c8dc9..ea872e5 100755 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MINOR, 3) define(_CLIENT_VERSION_REVISION, 1) -define(_CLIENT_VERSION_BUILD, 15) +define(_CLIENT_VERSION_BUILD, 16) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2018) AC_INIT([NewYorkCoin],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/NewYorkCoin-NYC/nycoin/issues],[newyorkcoin]) diff --git a/src/miner.cpp b/src/miner.cpp index 8bf94bd..9418791 100755 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -353,7 +353,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) // Fill in header pblock->hashPrevBlock = pindexPrev->GetBlockHash(); UpdateTime(pblock, consensus, pindexPrev); - if(pblock->nVersion.GetLegacyBlockVersion() == 1) + if(consensusParams.fAllowLegacyBlocks) pblock->nBits = GetNextWorkRequiredLegacy(pindexPrev, pblock, consensus); else pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensus); diff --git a/src/primitives/pureheader.h b/src/primitives/pureheader.h index 5253377..83c14d9 100755 --- a/src/primitives/pureheader.h +++ b/src/primitives/pureheader.h @@ -121,7 +121,7 @@ class CBlockVersion inline int32_t GetLegacyBlockVersion() { - return nVersion; + return 1; } CBlockVersion& operator=(const CBlockVersion& other) From cbafb4d340a3481d4ce4ec2c217455a6fe9c6810 Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Wed, 22 Aug 2018 17:17:02 -0500 Subject: [PATCH 07/12] minor change to version checking --- src/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 84de388..15019b4 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -2782,8 +2782,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta // Check proof of work // Legacy - if (consensusParams.fAllowLegacyBlocks - && block.nVersion.IsLegacy()) + if (consensusParams.fAllowLegacyBlocks) { if((unsigned int)block.nBits != GetNextWorkRequiredLegacy(pindexPrev, &block, consensusParams)) return state.DoS(100, error("%s: incorrect proof of work at Legacy height %d", __func__, nHeight), From 14b0018a0123f96a3697cf6dd64c7424ca366f0d Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Wed, 22 Aug 2018 17:18:01 -0500 Subject: [PATCH 08/12] build version bump --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ea872e5..c2d5546 100755 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MINOR, 3) define(_CLIENT_VERSION_REVISION, 1) -define(_CLIENT_VERSION_BUILD, 16) +define(_CLIENT_VERSION_BUILD, 17) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2018) AC_INIT([NewYorkCoin],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/NewYorkCoin-NYC/nycoin/issues],[newyorkcoin]) From c932e02daafb080dcaf5b98c7f958dbb41ed32a5 Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Wed, 22 Aug 2018 18:25:02 -0500 Subject: [PATCH 09/12] commented out default proof of work limit on testnet mining --- src/pow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index a3cd9e8..ff718ad 100755 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -50,10 +50,10 @@ unsigned int KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader unsigned int bnProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact(); CBigNum bnPowLimit(UintToArith256(params.powLimit)); // if we are mining legacy testnet, return proof of work limit - if (params.fPowAllowMinDifficultyBlocks) - { - return bnProofOfWorkLimit; - } + // if (params.fPowAllowMinDifficultyBlocks) + // { + // return bnProofOfWorkLimit; + // } if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) { return UintToArith256(params.powLimit).GetCompact(); } From 3f4da59e02c40d0af58ae2cea9f45ef5b77b45d2 Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Thu, 23 Aug 2018 14:30:45 -0500 Subject: [PATCH 10/12] removed errant testnet pow code --- src/pow.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index ff718ad..52ebcd0 100755 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -49,11 +49,6 @@ unsigned int KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader unsigned int bnProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact(); CBigNum bnPowLimit(UintToArith256(params.powLimit)); - // if we are mining legacy testnet, return proof of work limit - // if (params.fPowAllowMinDifficultyBlocks) - // { - // return bnProofOfWorkLimit; - // } if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) { return UintToArith256(params.powLimit).GetCompact(); } From f3615333fa8686fb7f30e76c9cb06cfd486afb1f Mon Sep 17 00:00:00 2001 From: Nico Van Severen Date: Thu, 23 Aug 2018 22:03:30 +0200 Subject: [PATCH 11/12] dockerfile and docker conf fixes --- Dockerfile | 7 +++---- docker/mainnet/newyorkcoin.conf | 23 +++++++---------------- docker/testnet/newyorkcoin.conf | 5 ++--- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8aa3b86..2635f57 100755 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,7 @@ WORKDIR /work # Install configuration # -RUN mkdir -p /root/.newyorkcoin +RUN mkdir -p /root/.newyorkc # =============================================================================== # System Initialization @@ -62,13 +62,12 @@ RUN mkdir -p /root/.newyorkcoin ## Copy folders RUN git clone https://github.com/NewYorkCoin-NYC/nycoin.git /work RUN cd /work && \ - git checkout v1.3 && \ chmod a+x autogen.sh && \ ./autogen.sh && \ ./configure && \ /usr/bin/make # Set default CMD -CMD /work/src/newyorkcoind && tail -f -n 10 /root/.newyorkcoin/debug.log +CMD /work/src/newyorkcoind && tail -f -n 10 /root/.newyorkc/debug.log -EXPOSE 17020 27020 18823 2882 +EXPOSE 17020 27020 18823 28823 diff --git a/docker/mainnet/newyorkcoin.conf b/docker/mainnet/newyorkcoin.conf index 89c453e..616d19a 100755 --- a/docker/mainnet/newyorkcoin.conf +++ b/docker/mainnet/newyorkcoin.conf @@ -6,26 +6,17 @@ maxconnections=200 port=17020 -rpcallowip=* +rpcallowip=0.0.0.0/0 rpcuser=nycuser rpcpassword=S3cR3t-P4ss rpcport=18823 addnode=62.213.218.23 -addnode=67.86.78.250 -addnode=71.34.149.166 -addnode=71.68.213.80 -addnode=73.54.142.171 -addnode=76.95.178.229 -addnode=82.251.255.101 -addnode=141.126.150.52 -addnode=157.161.128.51 -addnode=163.172.222.175 -addnode=170.247.210.88 -addnode=173.56.27.29 -addnode=174.66.176.135 -addnode=207.38.237.43 -addnode=209.122.196.148 -addnode=nyc.theincrediblemachine.tv addnode=62.213.218.8 +addnode=72.229.232.216 +addnode=46.4.102.69 +addnode=88.99.2.95 +addnode=39.116.239.43 +addnode=158.69.246.121 +addnode=67.85.83.129 diff --git a/docker/testnet/newyorkcoin.conf b/docker/testnet/newyorkcoin.conf index 637638a..0f68bdc 100755 --- a/docker/testnet/newyorkcoin.conf +++ b/docker/testnet/newyorkcoin.conf @@ -9,12 +9,11 @@ debug=1 testnet=1 port=27020 -rpcallowip=* +rpcallowip=0.0.0.0/0 rpcuser=nycuser rpcpassword=S3cR3t-P4ss - rpcport=28823 -addnode=104.183.139.17:27020 addnode=62.213.218.8:27020 +addnode=62.213.218.8:28020 addnode=62.213.218.23:27020 From 31dff0a5a24abcfb25733e4a350543fe04c76e8e Mon Sep 17 00:00:00 2001 From: MrSlosh Date: Thu, 23 Aug 2018 20:17:58 -0500 Subject: [PATCH 12/12] removed functions from blockheader used in testing --- src/miner.cpp | 2 +- src/primitives/pureheader.h | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 9418791..9fd4452 100755 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -110,7 +110,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) const Consensus::Params& consensusParams = chainparams.GetConsensus(nHeight); /* Initialise the block version. */ if(consensusParams.fAllowLegacyBlocks) - pblock->nVersion.SetLegacyVersion(1); + pblock->nVersion = CBlockHeader::LEGACY_VERSION; else { pblock->nVersion = CBlockHeader::CURRENT_VERSION; diff --git a/src/primitives/pureheader.h b/src/primitives/pureheader.h index 83c14d9..5541643 100755 --- a/src/primitives/pureheader.h +++ b/src/primitives/pureheader.h @@ -114,15 +114,6 @@ class CBlockVersion || (nVersion == 2 && GetChainId() == 0); } - inline void SetLegacyVersion(int32_t legacyVersion) - { - nVersion = legacyVersion; - } - - inline int32_t GetLegacyBlockVersion() - { - return 1; - } CBlockVersion& operator=(const CBlockVersion& other) {