From a9e71614bdfad50858a29a2de18145ac70906cd6 Mon Sep 17 00:00:00 2001 From: noise23 Date: Tue, 26 May 2015 23:25:44 +0300 Subject: [PATCH 01/13] Gitian descriptors update --- contrib/gitian-descriptors/deps-linux.yml | 4 +-- contrib/gitian-descriptors/deps-win.yml | 4 +-- contrib/gitian-descriptors/gitian-linux.yml | 22 ++++++++-------- .../gitian-descriptors/gitian-osx-bitmark.yml | 10 +++---- contrib/gitian-descriptors/gitian-win.yml | 26 +++++++++---------- contrib/gitian-descriptors/qt-win.yml | 8 +++--- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/contrib/gitian-descriptors/deps-linux.yml b/contrib/gitian-descriptors/deps-linux.yml index 816904d..884de95 100644 --- a/contrib/gitian-descriptors/deps-linux.yml +++ b/contrib/gitian-descriptors/deps-linux.yml @@ -1,5 +1,5 @@ --- -name: "bitmark" +name: "gamecredits" suites: - "precise" architectures: @@ -95,4 +95,4 @@ script: | done # cd $STAGING - find include lib bin host | sort | zip -X@ $OUTDIR/bitmark-deps-linux${GBUILD_BITS}-gitian-r9.zip + find include lib bin host | sort | zip -X@ $OUTDIR/gamecredits-deps-linux${GBUILD_BITS}-gitian-r9.zip diff --git a/contrib/gitian-descriptors/deps-win.yml b/contrib/gitian-descriptors/deps-win.yml index 338e917..779f0f9 100644 --- a/contrib/gitian-descriptors/deps-win.yml +++ b/contrib/gitian-descriptors/deps-win.yml @@ -1,5 +1,5 @@ --- -name: "bitmark-deps" +name: "gamecredits-deps" suites: - "precise" architectures: @@ -124,5 +124,5 @@ script: | done # cd $INSTALLPREFIX - find include lib | sort | zip -X@ $OUTDIR/bitmark-deps-win$BITS-gitian-r16.zip + find include lib | sort | zip -X@ $OUTDIR/gamecredits-deps-win$BITS-gitian-r16.zip done # for BITS in diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index be86bd2..b6c582b 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -1,5 +1,5 @@ --- -name: "bitmark" +name: "gamecredits" suites: - "precise" architectures: @@ -22,11 +22,11 @@ packages: - "libqt4-test" reference_datetime: "2013-06-01 00:00:00" remotes: -- "url": "https://github.com/project-bitmark/gamecredits.git" - "dir": "bitmark" +- "url": "https://github.com/noise23/gamecredits.git" + "dir": "gamecredits" files: -- "bitmark-deps-linux32-gitian-r9.zip" -- "bitmark-deps-linux64-gitian-r9.zip" +- "gamecredits-deps-linux32-gitian-r9.zip" +- "gamecredits-deps-linux64-gitian-r9.zip" - "boost-linux32-1.55.0-gitian-r1.zip" - "boost-linux64-1.55.0-gitian-r1.zip" - "qt-linux32-4.8.6-gitian-r1.tar.gz" @@ -43,13 +43,13 @@ script: | # mkdir -p $STAGING cd $STAGING - unzip ../build/bitmark-deps-linux${GBUILD_BITS}-gitian-r9.zip + unzip ../build/gamecredits-deps-linux${GBUILD_BITS}-gitian-r9.zip unzip ../build/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip tar -zxf ../build/qt-linux${GBUILD_BITS}-4.8.6-gitian-r1.tar.gz cd ../build # Avoid exporting *any* symbols from the executable - # This avoids conflicts between the libraries statically linked into bitmark and any + # This avoids conflicts between the libraries statically linked into gamecredits and any # libraries we may link dynamically (such as Qt and OpenSSL, see issue #4094). # It also avoids start-up overhead to not export any unnecessary symbols. # To do this, build a linker script that marks all symbols as local. @@ -59,14 +59,14 @@ script: | local: *; };' > $LINKER_SCRIPT function do_configure { - ./configure "$@" --enable-upnp-default --prefix=$STAGING --with-protoc-bindir=$STAGING/host/bin --with-qt-bindir=$STAGING/bin --with-boost=$STAGING --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib -Wl,--version-script=$LINKER_SCRIPT ${OPTFLAGS}" CXXFLAGS="-frandom-seed=bitmark ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt" --enable-glibc-back-compat + ./configure "$@" --enable-upnp-default --prefix=$STAGING --with-protoc-bindir=$STAGING/host/bin --with-qt-bindir=$STAGING/bin --with-boost=$STAGING --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib -Wl,--version-script=$LINKER_SCRIPT ${OPTFLAGS}" CXXFLAGS="-frandom-seed=gamecredits ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt" --enable-glibc-back-compat } # - cd bitmark + cd gamecredits ./autogen.sh do_configure make dist - DISTNAME=`echo bitmark-*.tar.gz` + DISTNAME=`echo gamecredits-*.tar.gz` # Build dynamic versions of everything # (with static linking to boost and openssl as well a some non-OS deps) @@ -83,4 +83,4 @@ script: | rm -rf $TEMPDIR mkdir -p $TEMPDIR cd $TEMPDIR - tar -xvf $HOME/build/bitmark/$DISTNAME | sort | tar --no-recursion -cT /dev/stdin --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 --mtime="$REFERENCE_DATETIME" | gzip -n > $OUTDIR/src/$DISTNAME + tar -xvf $HOME/build/gamecredits/$DISTNAME | sort | tar --no-recursion -cT /dev/stdin --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 --mtime="$REFERENCE_DATETIME" | gzip -n > $OUTDIR/src/$DISTNAME diff --git a/contrib/gitian-descriptors/gitian-osx-bitmark.yml b/contrib/gitian-descriptors/gitian-osx-bitmark.yml index 448e67d..f66e277 100644 --- a/contrib/gitian-descriptors/gitian-osx-bitmark.yml +++ b/contrib/gitian-descriptors/gitian-osx-bitmark.yml @@ -1,5 +1,5 @@ --- -name: "bitmark" +name: "gamecredits" suites: - "precise" architectures: @@ -14,8 +14,8 @@ packages: reference_datetime: "2013-06-01 00:00:00" remotes: -- "url": "https://github.com/project-bitmark/bitmark.git" - "dir": "bitmark" +- "url": "https://github.com/noise23/gamecredits.git" + "dir": "gamecredits" files: - "osx-native-depends-r3.tar.gz" - "osx-depends-r7.tar.gz" @@ -41,7 +41,7 @@ script: | tar -C osx-cross-depends -xf osx-depends-qt-5.2.1-r6.tar.gz export PATH=`pwd`/osx-cross-depends/native-prefix/bin:$PATH - cd bitmark + cd gamecredits export ZERO_AR_DATE=1 export QT_RCC_TEST=1 @@ -50,7 +50,7 @@ script: | make dist mkdir -p distsrc cd distsrc - tar --strip-components=1 -xf ../bitmark-*.tar* + tar --strip-components=1 -xf ../gamecredits-*.tar* ./configure --host=${HOST} --with-boost=${PREFIX} CC=clang CXX=clang++ OBJC=clang OBJCXX=clang++ CFLAGS="-target ${HOST} -mmacosx-version-min=10.6 --sysroot ${SDK} -msse2 -Qunused-arguments" CXXFLAGS="-target ${HOST} -mmacosx-version-min=10.6 --sysroot ${SDK} -msse2 -Qunused-arguments" LDFLAGS="-B${NATIVEPREFIX}/bin -L${PREFIX}/lib -L${SDK}/usr/lib/i686-apple-darwin10/4.2.1" CPPFLAGS="-I${NATIVEPREFIX}/lib/clang/3.2/include -I${PREFIX}/include" SSL_LIBS="-lz -lssl -lcrypto" --disable-tests -with-gui=qt5 PKG_CONFIG_LIBDIR="${PREFIX}/lib/pkgconfig" --disable-dependency-tracking --disable-maintainer-mode make $MAKEOPTS export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index a3866e7..76f9f61 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -1,5 +1,5 @@ --- -name: "bitmark" +name: "gamecredits" suites: - "precise" architectures: @@ -19,15 +19,15 @@ packages: reference_datetime: "2013-06-01 00:00:00" remotes: -- "url": "https://github.com/project-bitmark/bitmark.git" - "dir": "bitmark" +- "url": "https://github.com/noise23/gamecredits.git" + "dir": "gamecredits" files: - "qt-win32-5.2.0-gitian-r3.zip" - "qt-win64-5.2.0-gitian-r3.zip" - "boost-win32-1.55.0-gitian-r6.zip" - "boost-win64-1.55.0-gitian-r6.zip" -- "bitmark-deps-win32-gitian-r16.zip" -- "bitmark-deps-win64-gitian-r16.zip" +- "gamecredits-deps-win32-gitian-r16.zip" +- "gamecredits-deps-win64-gitian-r16.zip" - "protobuf-win32-2.5.0-gitian-r4.zip" - "protobuf-win64-2.5.0-gitian-r4.zip" script: | @@ -61,29 +61,29 @@ script: | cd $STAGING unzip $INDIR/qt-win${BITS}-5.2.0-gitian-r3.zip unzip $INDIR/boost-win${BITS}-1.55.0-gitian-r6.zip - unzip $INDIR/bitmark-deps-win${BITS}-gitian-r16.zip + unzip $INDIR/gamecredits-deps-win${BITS}-gitian-r16.zip unzip $INDIR/protobuf-win${BITS}-2.5.0-gitian-r4.zip if [ "$NEEDDIST" == "1" ]; then # Make source code archive which is architecture independent so it only needs to be done once - cd $HOME/build/bitmark + cd $HOME/build/gamecredits ./autogen.sh - ./configure --bindir=$OUTDIR --prefix=$STAGING --host=$HOST --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="-frandom-seed=bitmark ${OPTFLAGS}" + ./configure --bindir=$OUTDIR --prefix=$STAGING --host=$HOST --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="-frandom-seed=gamecredits ${OPTFLAGS}" make dist - DISTNAME=`echo bitmark-*.tar.gz` + DISTNAME=`echo gamecredits-*.tar.gz` NEEDDIST=0 fi # Build platform-dependent executables from source archive cd $BUILDDIR mkdir -p distsrc cd distsrc - tar --strip-components=1 -xf $HOME/build/bitmark/$DISTNAME - ./configure --enable-upnp-default --bindir=$BINDIR --prefix=$STAGING --host=$HOST --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="-frandom-seed=bitmark ${OPTFLAGS}" + tar --strip-components=1 -xf $HOME/build/gamecredits/$DISTNAME + ./configure --enable-upnp-default --bindir=$BINDIR --prefix=$STAGING --host=$HOST --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="-frandom-seed=gamecredits ${OPTFLAGS}" export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME make $MAKEOPTS make deploy make install-strip - cp -f bitmark-*setup*.exe $BINDIR/ + cp -f gamecredits-*setup*.exe $BINDIR/ unset LD_PRELOAD unset FAKETIME done # for BITS in @@ -93,5 +93,5 @@ script: | rm -rf $TEMPDIR mkdir -p $TEMPDIR cd $TEMPDIR - tar -xvf $HOME/build/bitmark/$DISTNAME | sort | tar --no-recursion -cT /dev/stdin --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 --mtime="$REFERENCE_DATETIME" | gzip -n > $OUTDIR/src/$DISTNAME + tar -xvf $HOME/build/gamecredits/$DISTNAME | sort | tar --no-recursion -cT /dev/stdin --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 --mtime="$REFERENCE_DATETIME" | gzip -n > $OUTDIR/src/$DISTNAME diff --git a/contrib/gitian-descriptors/qt-win.yml b/contrib/gitian-descriptors/qt-win.yml index 40cf23e..0a34c30 100644 --- a/contrib/gitian-descriptors/qt-win.yml +++ b/contrib/gitian-descriptors/qt-win.yml @@ -15,8 +15,8 @@ reference_datetime: "2011-01-30 00:00:00" remotes: [] files: - "qt-everywhere-opensource-src-5.2.0.tar.gz" -- "bitmark-deps-win32-gitian-r16.zip" -- "bitmark-deps-win64-gitian-r16.zip" +- "gamecredits-deps-win32-gitian-r16.zip" +- "gamecredits-deps-win64-gitian-r16.zip" script: | # Defines export TZ=UTC @@ -46,9 +46,9 @@ script: | # mkdir -p $INSTALLPREFIX $INSTALLPREFIX/host/bin $DEPSDIR $BUILDDIR # - # Need mingw-compiled openssl from bitmark-deps: + # Need mingw-compiled openssl from gamecredits-deps: cd $DEPSDIR - unzip $INDIR/bitmark-deps-win${BITS}-gitian-r16.zip + unzip $INDIR/gamecredits-deps-win${BITS}-gitian-r16.zip # cd $BUILDDIR # From 12f3e35e65a1d170f11c9651aadff74a3563e015 Mon Sep 17 00:00:00 2001 From: noise23 Date: Tue, 26 May 2015 23:41:49 +0300 Subject: [PATCH 02/13] v0.9.4.1 bump --- src/clientversion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clientversion.h b/src/clientversion.h index e0c5c52..802c598 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -12,7 +12,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_REVISION 4 -#define CLIENT_VERSION_BUILD 0 +#define CLIENT_VERSION_BUILD 1 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true From 01e8eddb33cd5850d11330d8fa5c152dd4d17371 Mon Sep 17 00:00:00 2001 From: noise23 Date: Wed, 27 May 2015 01:41:04 +0300 Subject: [PATCH 03/13] bitmark > gamecredits --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index cdf9935..e707fdf 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ define(_CLIENT_VERSION_REVISION, 4) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2015) -AC_INIT([GameCredits Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitmark.org],[bitmark]) +AC_INIT([GameCredits Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitmark.org],[gamecredits]) AC_CONFIG_AUX_DIR([src/build-aux]) AC_CONFIG_MACRO_DIR([src/m4]) AC_CANONICAL_HOST From 8795fd71cecdca3d4767f2fce17dffab7b35c1d2 Mon Sep 17 00:00:00 2001 From: noise23 Date: Wed, 27 May 2015 02:11:26 +0300 Subject: [PATCH 04/13] distname fix --- contrib/gitian-descriptors/gitian-win.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 76f9f61..d3b47e3 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -69,7 +69,7 @@ script: | ./autogen.sh ./configure --bindir=$OUTDIR --prefix=$STAGING --host=$HOST --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="-frandom-seed=gamecredits ${OPTFLAGS}" make dist - DISTNAME=`echo gamecredits-*.tar.gz` + DISTNAME=`echo bitmark-*.tar.gz` NEEDDIST=0 fi # Build platform-dependent executables from source archive From c978c5b0277a18270aeb8be7a857b57d3707e7bb Mon Sep 17 00:00:00 2001 From: noise23 Date: Wed, 27 May 2015 02:20:27 +0300 Subject: [PATCH 05/13] filename fix --- contrib/gitian-descriptors/gitian-win.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index d3b47e3..47a0bd6 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -83,7 +83,7 @@ script: | make $MAKEOPTS make deploy make install-strip - cp -f gamecredits-*setup*.exe $BINDIR/ + cp -f bitmark-*setup*.exe $BINDIR/ unset LD_PRELOAD unset FAKETIME done # for BITS in From b69026096b7abb41d608fcd430a9c34a744c546a Mon Sep 17 00:00:00 2001 From: noise23 Date: Wed, 27 May 2015 02:53:37 +0300 Subject: [PATCH 06/13] configure.ac v0.9.4.1 bump --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e707fdf..965145d 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 9) define(_CLIENT_VERSION_REVISION, 4) -define(_CLIENT_VERSION_BUILD, 0) +define(_CLIENT_VERSION_BUILD, 1) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2015) AC_INIT([GameCredits Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitmark.org],[gamecredits]) From e28373832c69a962638587b0c40fee6a902dfbc1 Mon Sep 17 00:00:00 2001 From: noise23 Date: Thu, 28 May 2015 03:31:23 +0300 Subject: [PATCH 07/13] kill KGW --- src/main.cpp | 201 +++++++++------------------------------------------ 1 file changed, 36 insertions(+), 165 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 78c8626..31b660c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,6 +43,7 @@ map mapBlockIndex; CChain chainActive; CChain chainMostWork; int64_t nTimeBestReceived = 0; +static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // EarthCoin: starting difficulty is 1 / 2^12 int nScriptCheckThreads = 0; bool fImporting = false; bool fReindex = false; @@ -1101,11 +1102,6 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock return false; } - - - - - ////////////////////////////////////////////////////////////////////////////// // // CBlock and CBlockIndex @@ -1217,200 +1213,75 @@ int64_t GetBlockValue(int nHeight, int64_t nFees) return nSubsidy + nFees; } -// Traditional Targets only used for KGW v1 blocks -static const int64_t nTargetTimespan = 3.5 * 24 * 60 * 60; -static const int64_t nTargetSpacing = 2.5 * 60; +static const int64_t nTargetTimespan = 30 * 60; // EarthCoin: every 30 minutes +static const int64_t nTargetSpacing = 1.5 * 60; // 90 sec static const int64_t nInterval = nTargetTimespan / nTargetSpacing; +// +// minimum amount of work that could possibly be required nTime after +// minimum work required was nBase +// +unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime) +{ + // Testnet has min-difficulty blocks + // after nTargetSpacing*2 time between blocks: + if (TestNet() && nTime > nTargetSpacing*2) -unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) { - /* current difficulty formula, megacoin - kimoto gravity well */ - const CBlockIndex *BlockLastSolved = pindexLast; - const CBlockIndex *BlockReading = pindexLast; - const CBigNum &bnProofOfWorkLimit = Params().ProofOfWorkLimit(); - - uint64_t PastBlocksMass = 0; - int64_t PastRateActualSeconds = 0; - int64_t PastRateTargetSeconds = 0; - double PastRateAdjustmentRatio = double(1); - CBigNum PastDifficultyAverage; - CBigNum PastDifficultyAveragePrev; - double EventHorizonDeviation; - double EventHorizonDeviationFast; - double EventHorizonDeviationSlow; - - if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) { return bnProofOfWorkLimit.GetCompact(); - } - int64_t LatestBlockTime = BlockLastSolved->GetBlockTime(); - for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) { - if (PastBlocksMax > 0 && i > PastBlocksMax) { break; } - PastBlocksMass++; - - if (i == 1) { PastDifficultyAverage.SetCompact(BlockReading->nBits); } - else { PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev; } - PastDifficultyAveragePrev = PastDifficultyAverage; - - if (LatestBlockTime < BlockReading->GetBlockTime()) { - if (BlockReading->nHeight > 100000) LatestBlockTime = BlockReading->GetBlockTime(); - } - - PastRateActualSeconds = LatestBlockTime - BlockReading->GetBlockTime(); - - if (BlockReading->nHeight > 100000) { - if (PastRateActualSeconds < 1) { PastRateActualSeconds = 1; } - } else { - if (PastRateActualSeconds < 0) { PastRateActualSeconds = 0; } - } - - PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass; - PastRateAdjustmentRatio = double(1); - - if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) { - PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds); - } - EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228)); - EventHorizonDeviationFast = EventHorizonDeviation; - EventHorizonDeviationSlow = 1 / EventHorizonDeviation; - - if (PastBlocksMass >= PastBlocksMin) { - if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { - assert(BlockReading); - break; - } - } - if (BlockReading->pprev == NULL) { - assert(BlockReading); - break; - } - BlockReading = BlockReading->pprev; - } - - CBigNum bnNew(PastDifficultyAverage); - if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) { - bnNew *= PastRateActualSeconds; - bnNew /= PastRateTargetSeconds; - } - if (bnNew > bnProofOfWorkLimit) { bnNew = bnProofOfWorkLimit; } - - /* - printf("Difficulty Retarget - Kimoto Gravity Well\n"); - printf("PastRateAdjustmentRatio = %g\n", PastRateAdjustmentRatio); - printf("Before: %08x %s\n", BlockLastSolved->nBits, CBigNum().SetCompact(BlockLastSolved->nBits).getuint256().ToString().c_str()); - printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); - */ - return bnNew.GetCompact(); + + CBigNum bnResult; + bnResult.SetCompact(nBase); + while (nTime > 0 && bnResult < bnProofOfWorkLimit) + { + // Maximum 400% adjustment... + bnResult *= 4; + // ... in best-case exactly 4-times-normal target time + nTime -= nTargetTimespan*4; + } + if (bnResult > bnProofOfWorkLimit) + bnResult = bnProofOfWorkLimit; + return bnResult.GetCompact(); } -unsigned int static GetNextWorkRequired_OLD(const CBlockIndex* pindexLast, const CBlockHeader *pblock) +unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock) { - const CBigNum &bnProofOfWorkLimit = Params().ProofOfWorkLimit(); unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact(); // Genesis block if (pindexLast == NULL) return nProofOfWorkLimit; - // Only change once per interval - if ((pindexLast->nHeight+1) % nInterval != 0) { - return pindexLast->nBits; - } - - // GameCredits: This fixes an issue where a 51% attack can change difficulty at will. - // Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz - int blockstogoback = nInterval-1; - if ((pindexLast->nHeight+1) != nInterval) - blockstogoback = nInterval; - // Go back by what we want to be 14 days worth of blocks - const CBlockIndex* pindexFirst = pindexLast; - for (int i = 0; pindexFirst && i < blockstogoback; i++) - pindexFirst = pindexFirst->pprev; - assert(pindexFirst); - // Limit adjustment step - int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); + const CBlockIndex* pindexFirst = pindexLast->pprev; + int64_t nActualSpacing = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); - if (nActualTimespan < nTargetTimespan/4) - nActualTimespan = nTargetTimespan/4; - if (nActualTimespan > nTargetTimespan*4) - nActualTimespan = nTargetTimespan*4; + // limit the adjustment + if (nActualSpacing < nTargetSpacing/16) + nActualSpacing = nTargetSpacing/16; + if (nActualSpacing > nTargetSpacing*16) + nActualSpacing = nTargetSpacing*16; // Retarget CBigNum bnNew; bnNew.SetCompact(pindexLast->nBits); - bnNew *= nActualTimespan; - bnNew /= nTargetTimespan; + bnNew *= ((nInterval - 1) * nTargetSpacing + 2 * nActualSpacing); + bnNew /= ((nInterval + 1) * nTargetSpacing); if (bnNew > bnProofOfWorkLimit) bnNew = bnProofOfWorkLimit; - /// debug print - printf("GetNextWorkRequired RETARGET\n"); - printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); - printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); return bnNew.GetCompact(); } -unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock) -{ - unsigned int nHeight = pindexLast->nHeight + 1; - - // Settings for GMC KGW - unsigned int TimeDaySeconds = 60 * 60 * 24; - int64_t PastSecondsMin = TimeDaySeconds * 0.01; - int64_t PastSecondsMax = TimeDaySeconds * 0.14; - int64_t BlocksTargetSpacing = 0; - - if(nHeight < 15332) { - // KGW v1 - return GetNextWorkRequired_OLD(pindexLast, pblock); - } else if(nHeight < 1036320) { - // Former 30 Second Block Target, KGW 2 Prefork - BlocksTargetSpacing = 30; - } else { - // New 90 Second Block Target, KGW 2 Postfork - BlocksTargetSpacing = 90; - } - uint64_t PastBlocksMin = PastSecondsMin / BlocksTargetSpacing; - uint64_t PastBlocksMax = PastSecondsMax / BlocksTargetSpacing; - return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax); -} - -// -// minimum amount of work that could possibly be required nTime after -// minimum work required was nBase -// -unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime) -{ - const CBigNum &bnLimit = Params().ProofOfWorkLimit(); - // Testnet has min-difficulty blocks - // after nTargetSpacing*2 time between blocks: - if (TestNet() && nTime > nTargetSpacing*2) - return bnLimit.GetCompact(); - - CBigNum bnResult; - bnResult.SetCompact(nBase); - while (nTime > 0 && bnResult < bnLimit) - { - // Maximum 400% adjustment... - bnResult *= 4; - // ... in best-case exactly 4-times-normal target time - nTime -= nTargetTimespan*4; - } - if (bnResult > bnLimit) - bnResult = bnLimit; - return bnResult.GetCompact(); -} - bool CheckProofOfWork(uint256 hash, unsigned int nBits) { CBigNum bnTarget; bnTarget.SetCompact(nBits); // Check range - if (bnTarget <= 0 || bnTarget > Params().ProofOfWorkLimit()) + if (bnTarget <= 0 || bnTarget > bnProofOfWorkLimit) return error("CheckProofOfWork() : nBits below minimum work"); // Check proof of work matches claimed amount From fa2a7e3e3358a0042ea4c84d762463a7218d9eb7 Mon Sep 17 00:00:00 2001 From: noise23 Date: Thu, 28 May 2015 03:33:43 +0300 Subject: [PATCH 08/13] 80006 / 0.9.4.2 --- configure.ac | 2 +- src/clientversion.h | 2 +- src/version.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 965145d..aa63b4d 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 9) define(_CLIENT_VERSION_REVISION, 4) -define(_CLIENT_VERSION_BUILD, 1) +define(_CLIENT_VERSION_BUILD, 2) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2015) AC_INIT([GameCredits Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitmark.org],[gamecredits]) diff --git a/src/clientversion.h b/src/clientversion.h index 802c598..7ca2b75 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -12,7 +12,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_REVISION 4 -#define CLIENT_VERSION_BUILD 1 +#define CLIENT_VERSION_BUILD 2 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/version.h b/src/version.h index be82637..d710f7d 100644 --- a/src/version.h +++ b/src/version.h @@ -27,13 +27,13 @@ extern const std::string CLIENT_DATE; // network protocol versioning // -static const int PROTOCOL_VERSION = 80005; +static const int PROTOCOL_VERSION = 80006; // intial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; // disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 80005; +static const int MIN_PEER_PROTO_VERSION = 80006; // nTime field added to CAddress, starting with this version; // if possible, avoid requesting addresses nodes older than this From b5a9e47de5c5a398d195553851e0143bf97bfe33 Mon Sep 17 00:00:00 2001 From: noise23 Date: Thu, 28 May 2015 14:35:22 +0300 Subject: [PATCH 09/13] bitmark > gamecredits, copyright --- src/main.cpp | 4 +- src/qt/bitmarkstrings.cpp | 386 +++++++++++++++++++------------------- src/qt/splashscreen.cpp | 4 +- src/qt/utilitydialog.cpp | 2 +- src/rpcserver.cpp | 2 +- 5 files changed, 199 insertions(+), 199 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 31b660c..254c62f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,7 +43,7 @@ map mapBlockIndex; CChain chainActive; CChain chainMostWork; int64_t nTimeBestReceived = 0; -static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // EarthCoin: starting difficulty is 1 / 2^12 +static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // starting difficulty is 1 / 2^12 int nScriptCheckThreads = 0; bool fImporting = false; bool fReindex = false; @@ -1213,7 +1213,7 @@ int64_t GetBlockValue(int nHeight, int64_t nFees) return nSubsidy + nFees; } -static const int64_t nTargetTimespan = 30 * 60; // EarthCoin: every 30 minutes +static const int64_t nTargetTimespan = 30 * 60; // every 30 minutes static const int64_t nTargetSpacing = 1.5 * 60; // 90 sec static const int64_t nInterval = nTargetTimespan / nTargetSpacing; diff --git a/src/qt/bitmarkstrings.cpp b/src/qt/bitmarkstrings.cpp index c8f6ecf..bbeabb8 100644 --- a/src/qt/bitmarkstrings.cpp +++ b/src/qt/bitmarkstrings.cpp @@ -9,11 +9,11 @@ #define UNUSED #endif static const char UNUSED *bitmark_strings[] = { -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "%s, you must set a rpcpassword in the configuration file:\n" "%s\n" "It is recommended you use the following random password:\n" -"rpcuser=bitmarkrpc\n" +"rpcuser=gamecreditsrpc\n" "rpcpassword=%s\n" "(you do not need to remember this password)\n" "The username and password MUST NOT be the same.\n" @@ -21,262 +21,262 @@ QT_TRANSLATE_NOOP("bitmark-core", "" "permissions.\n" "It is also recommended to set alertnotify so you are notified of problems;\n" "for example: alertnotify=echo %%s | mail -s \"GameCredits Alert\" admin@foo.com\n"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!" "3DES:@STRENGTH)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "An error occurred while setting up the RPC port %u for listening on IPv4: %s"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "An error occurred while setting up the RPC port %u for listening on IPv6, " "falling back to IPv4: %s"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Bind to given address and always listen on it. Use [host]:port notation for " "IPv6"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Cannot obtain a lock on data directory %s. GameCredits Core is probably already " "running."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Continuously rate-limit free transactions to *1000 bytes per minute " "(default:15)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Enter regression test mode, which uses a special chain in which blocks can " "be solved instantly. This is intended for regression testing tools and app " "development."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Enter regression test mode, which uses a special chain in which blocks can " "be solved instantly."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Error: Listening for incoming connections failed (listen returned error %d)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Error: The transaction was rejected! This might happen if some of the coins " "in your wallet were already spent, such as if you used a copy of wallet.dat " "and coins were spent in the copy but not marked as spent here."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Error: This transaction requires a transaction fee of at least %s because of " "its amount, complexity, or use of recently received funds!"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Execute command when a relevant alert is received or we see a really long " "fork (%s in cmd is replaced by message)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Execute command when a wallet transaction changes (%s in cmd is replaced by " "TxID)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Execute command when the best block changes (%s in cmd is replaced by block " "hash)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Fees smaller than this are considered zero fee (for transaction creation) " "(default:"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Flush database activity from memory pool to disk log every megabytes " "(default: 100)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "How thorough the block verification of -checkblocks is (0-4, default: 3)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "In this mode -genproclimit controls how many blocks are generated " "immediately."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Listen for JSON-RPC connections on (default: 40001 or testnet: 50000)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Number of seconds to keep misbehaving peers from reconnecting (default: " "86400)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Output debugging information (default: 0, supplying is optional)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Set maximum size of high-priority/low-fee transactions in bytes (default: %d)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Set the number of script verification threads (%u to %d, 0 = auto, <0 = " "leave that many cores free, default: %d)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Set the processor limit for when generation is on (-1 = unlimited, default: " "-1)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "This is a pre-release test build - use at your own risk - do not use for " "mining or merchant applications"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Unable to bind to %s on this computer. GameCredits Core is probably already " "running."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: -" "proxy)"), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Warning: -paytxfee is set very high! This is the transaction fee you will " "pay if you send a transaction."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Warning: Please check that your computer's date and time are correct! If " "your clock is wrong GameCredits will not work properly."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Warning: The network does not appear to fully agree! Some miners appear to " "be experiencing issues."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Warning: We do not appear to fully agree with our peers! You may need to " "upgrade, or other nodes may need to upgrade."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Warning: error reading wallet.dat! All keys read correctly, but transaction " "data or address book entries might be missing or incorrect."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as " "wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect " "you should restore from a backup."), -QT_TRANSLATE_NOOP("bitmark-core", "" +QT_TRANSLATE_NOOP("gamecredits-core", "" "You must set rpcpassword= in the configuration file:\n" "%s\n" "If the file does not exist, create it with owner-readable-only file " "permissions."), -QT_TRANSLATE_NOOP("bitmark-core", "(default: 1)"), -QT_TRANSLATE_NOOP("bitmark-core", "(default: wallet.dat)"), -QT_TRANSLATE_NOOP("bitmark-core", " can be:"), -QT_TRANSLATE_NOOP("bitmark-core", "Accept command line and JSON-RPC commands"), -QT_TRANSLATE_NOOP("bitmark-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"), -QT_TRANSLATE_NOOP("bitmark-core", "Add a node to connect to and attempt to keep the connection open"), -QT_TRANSLATE_NOOP("bitmark-core", "Allow DNS lookups for -addnode, -seednode and -connect"), -QT_TRANSLATE_NOOP("bitmark-core", "Allow JSON-RPC connections from specified IP address"), -QT_TRANSLATE_NOOP("bitmark-core", "Attempt to recover private keys from a corrupt wallet.dat"), -QT_TRANSLATE_NOOP("bitmark-core", "GameCredits Core Daemon"), -QT_TRANSLATE_NOOP("bitmark-core", "GameCredits Core RPC client version"), -QT_TRANSLATE_NOOP("bitmark-core", "Block creation options:"), -QT_TRANSLATE_NOOP("bitmark-core", "Cannot downgrade wallet"), -QT_TRANSLATE_NOOP("bitmark-core", "Cannot resolve -bind address: '%s'"), -QT_TRANSLATE_NOOP("bitmark-core", "Cannot resolve -externalip address: '%s'"), -QT_TRANSLATE_NOOP("bitmark-core", "Cannot write default address"), -QT_TRANSLATE_NOOP("bitmark-core", "Clear list of wallet transactions (diagnostic tool; implies -rescan)"), -QT_TRANSLATE_NOOP("bitmark-core", "Connect only to the specified node(s)"), -QT_TRANSLATE_NOOP("bitmark-core", "Connect through SOCKS proxy"), -QT_TRANSLATE_NOOP("bitmark-core", "Connect to JSON-RPC on (default: 40001 or testnet: 50000)"), -QT_TRANSLATE_NOOP("bitmark-core", "Connect to a node to retrieve peer addresses, and disconnect"), -QT_TRANSLATE_NOOP("bitmark-core", "Connection options:"), -QT_TRANSLATE_NOOP("bitmark-core", "Corrupted block database detected"), -QT_TRANSLATE_NOOP("bitmark-core", "Debugging/Testing options:"), -QT_TRANSLATE_NOOP("bitmark-core", "Disable safemode, override a real safe mode event (default: 0)"), -QT_TRANSLATE_NOOP("bitmark-core", "Discover own IP address (default: 1 when listening and no -externalip)"), -QT_TRANSLATE_NOOP("bitmark-core", "Do not load the wallet and disable wallet RPC calls"), -QT_TRANSLATE_NOOP("bitmark-core", "Do you want to rebuild the block database now?"), -QT_TRANSLATE_NOOP("bitmark-core", "Done loading"), -QT_TRANSLATE_NOOP("bitmark-core", "Error initializing block database"), -QT_TRANSLATE_NOOP("bitmark-core", "Error initializing wallet database environment %s!"), -QT_TRANSLATE_NOOP("bitmark-core", "Error loading block database"), -QT_TRANSLATE_NOOP("bitmark-core", "Error loading wallet.dat"), -QT_TRANSLATE_NOOP("bitmark-core", "Error loading wallet.dat: Wallet corrupted"), -QT_TRANSLATE_NOOP("bitmark-core", "Error loading wallet.dat: Wallet requires newer version of GameCredits"), -QT_TRANSLATE_NOOP("bitmark-core", "Error opening block database"), -QT_TRANSLATE_NOOP("bitmark-core", "Error"), -QT_TRANSLATE_NOOP("bitmark-core", "Error: Disk space is low!"), -QT_TRANSLATE_NOOP("bitmark-core", "Error: Wallet locked, unable to create transaction!"), -QT_TRANSLATE_NOOP("bitmark-core", "Error: system error: "), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to listen on any port. Use -listen=0 if you want this."), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to read block info"), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to read block"), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to sync block index"), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to write block index"), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to write block info"), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to write block"), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to write file info"), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to write to coin database"), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to write transaction index"), -QT_TRANSLATE_NOOP("bitmark-core", "Failed to write undo data"), -QT_TRANSLATE_NOOP("bitmark-core", "Fee per kB to add to transactions you send"), -QT_TRANSLATE_NOOP("bitmark-core", "Fees smaller than this are considered zero fee (for relaying) (default:"), -QT_TRANSLATE_NOOP("bitmark-core", "Find peers using DNS lookup (default: 1 unless -connect)"), -QT_TRANSLATE_NOOP("bitmark-core", "Force safe mode (default: 0)"), -QT_TRANSLATE_NOOP("bitmark-core", "Generate coins (default: 0)"), -QT_TRANSLATE_NOOP("bitmark-core", "Get help for a command"), -QT_TRANSLATE_NOOP("bitmark-core", "How many blocks to check at startup (default: 288, 0 = all)"), -QT_TRANSLATE_NOOP("bitmark-core", "If is not supplied, output all debugging information."), -QT_TRANSLATE_NOOP("bitmark-core", "Importing..."), -QT_TRANSLATE_NOOP("bitmark-core", "Imports blocks from external blk000??.dat file"), -QT_TRANSLATE_NOOP("bitmark-core", "Incorrect or no genesis block found. Wrong datadir for network?"), -QT_TRANSLATE_NOOP("bitmark-core", "Information"), -QT_TRANSLATE_NOOP("bitmark-core", "Insufficient funds"), -QT_TRANSLATE_NOOP("bitmark-core", "Invalid -onion address: '%s'"), -QT_TRANSLATE_NOOP("bitmark-core", "Invalid -proxy address: '%s'"), -QT_TRANSLATE_NOOP("bitmark-core", "Invalid amount for -minrelaytxfee=: '%s'"), -QT_TRANSLATE_NOOP("bitmark-core", "Invalid amount for -mintxfee=: '%s'"), -QT_TRANSLATE_NOOP("bitmark-core", "Invalid amount for -paytxfee=: '%s'"), -QT_TRANSLATE_NOOP("bitmark-core", "Invalid amount"), -QT_TRANSLATE_NOOP("bitmark-core", "Limit size of signature cache to entries (default: 50000)"), -QT_TRANSLATE_NOOP("bitmark-core", "List commands"), -QT_TRANSLATE_NOOP("bitmark-core", "Listen for connections on (default: 40002 or testnet: 50001)"), -QT_TRANSLATE_NOOP("bitmark-core", "Loading addresses..."), -QT_TRANSLATE_NOOP("bitmark-core", "Loading block index..."), -QT_TRANSLATE_NOOP("bitmark-core", "Loading wallet..."), -QT_TRANSLATE_NOOP("bitmark-core", "Log transaction priority and fee per kB when mining blocks (default: 0)"), -QT_TRANSLATE_NOOP("bitmark-core", "Maintain a full transaction index (default: 0)"), -QT_TRANSLATE_NOOP("bitmark-core", "Maintain at most connections to peers (default: 125)"), -QT_TRANSLATE_NOOP("bitmark-core", "Maximum per-connection receive buffer, *1000 bytes (default: 5000)"), -QT_TRANSLATE_NOOP("bitmark-core", "Maximum per-connection send buffer, *1000 bytes (default: 1000)"), -QT_TRANSLATE_NOOP("bitmark-core", "Not enough file descriptors available."), -QT_TRANSLATE_NOOP("bitmark-core", "Only accept block chain matching built-in checkpoints (default: 1)"), -QT_TRANSLATE_NOOP("bitmark-core", "Only connect to nodes in network (IPv4, IPv6 or Tor)"), -QT_TRANSLATE_NOOP("bitmark-core", "Options:"), -QT_TRANSLATE_NOOP("bitmark-core", "Password for JSON-RPC connections"), -QT_TRANSLATE_NOOP("bitmark-core", "Prepend debug output with timestamp (default: 1)"), -QT_TRANSLATE_NOOP("bitmark-core", "Print block on startup, if found in block index"), -QT_TRANSLATE_NOOP("bitmark-core", "Print block tree on startup (default: 0)"), -QT_TRANSLATE_NOOP("bitmark-core", "RPC SSL options: (see the Bitmark Wiki for SSL setup instructions)"), -QT_TRANSLATE_NOOP("bitmark-core", "RPC client options:"), -QT_TRANSLATE_NOOP("bitmark-core", "RPC server options:"), -QT_TRANSLATE_NOOP("bitmark-core", "Randomly drop 1 of every network messages"), -QT_TRANSLATE_NOOP("bitmark-core", "Randomly fuzz 1 of every network messages"), -QT_TRANSLATE_NOOP("bitmark-core", "Rebuild block chain index from current blk000??.dat files"), -QT_TRANSLATE_NOOP("bitmark-core", "Rescan the block chain for missing wallet transactions"), -QT_TRANSLATE_NOOP("bitmark-core", "Rescanning..."), -QT_TRANSLATE_NOOP("bitmark-core", "Run a thread to flush wallet periodically (default: 1)"), -QT_TRANSLATE_NOOP("bitmark-core", "Run in the background as a daemon and accept commands"), -QT_TRANSLATE_NOOP("bitmark-core", "SSL options: (see the Bitmark Wiki for SSL setup instructions)"), -QT_TRANSLATE_NOOP("bitmark-core", "Select SOCKS version for -proxy (4 or 5, default: 5)"), -QT_TRANSLATE_NOOP("bitmark-core", "Send command to GameCredits Core"), -QT_TRANSLATE_NOOP("bitmark-core", "Send commands to node running on (default: 127.0.0.1)"), -QT_TRANSLATE_NOOP("bitmark-core", "Send trace/debug info to console instead of debug.log file"), -QT_TRANSLATE_NOOP("bitmark-core", "Server certificate file (default: server.cert)"), -QT_TRANSLATE_NOOP("bitmark-core", "Server private key (default: server.pem)"), -QT_TRANSLATE_NOOP("bitmark-core", "Set database cache size in megabytes (%d to %d, default: %d)"), -QT_TRANSLATE_NOOP("bitmark-core", "Set key pool size to (default: 100)"), -QT_TRANSLATE_NOOP("bitmark-core", "Set maximum block size in bytes (default: %d)"), -QT_TRANSLATE_NOOP("bitmark-core", "Set minimum block size in bytes (default: 0)"), -QT_TRANSLATE_NOOP("bitmark-core", "Set the number of threads to service RPC calls (default: 4)"), -QT_TRANSLATE_NOOP("bitmark-core", "Sets the DB_PRIVATE flag in the wallet db environment (default: 1)"), -QT_TRANSLATE_NOOP("bitmark-core", "Show all debugging options (usage: --help -help-debug)"), -QT_TRANSLATE_NOOP("bitmark-core", "Show benchmark information (default: 0)"), -QT_TRANSLATE_NOOP("bitmark-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"), -QT_TRANSLATE_NOOP("bitmark-core", "Signing transaction failed"), -QT_TRANSLATE_NOOP("bitmark-core", "Specify configuration file (default: gamecredits.conf)"), -QT_TRANSLATE_NOOP("bitmark-core", "Specify connection timeout in milliseconds (default: 5000)"), -QT_TRANSLATE_NOOP("bitmark-core", "Specify data directory"), -QT_TRANSLATE_NOOP("bitmark-core", "Specify pid file (default: gamecreditsd.pid)"), -QT_TRANSLATE_NOOP("bitmark-core", "Specify wallet file (within data directory)"), -QT_TRANSLATE_NOOP("bitmark-core", "Specify your own public address"), -QT_TRANSLATE_NOOP("bitmark-core", "Spend unconfirmed change when sending transactions (default: 1)"), -QT_TRANSLATE_NOOP("bitmark-core", "Start GameCredits Core Daemon"), -QT_TRANSLATE_NOOP("bitmark-core", "System error: "), -QT_TRANSLATE_NOOP("bitmark-core", "This help message"), -QT_TRANSLATE_NOOP("bitmark-core", "This is intended for regression testing tools and app development."), -QT_TRANSLATE_NOOP("bitmark-core", "Threshold for disconnecting misbehaving peers (default: 100)"), -QT_TRANSLATE_NOOP("bitmark-core", "To use the %s option"), -QT_TRANSLATE_NOOP("bitmark-core", "Transaction amount too small"), -QT_TRANSLATE_NOOP("bitmark-core", "Transaction amounts must be positive"), -QT_TRANSLATE_NOOP("bitmark-core", "Transaction too large"), -QT_TRANSLATE_NOOP("bitmark-core", "Unable to bind to %s on this computer (bind returned error %d, %s)"), -QT_TRANSLATE_NOOP("bitmark-core", "Unknown -socks proxy version requested: %i"), -QT_TRANSLATE_NOOP("bitmark-core", "Unknown network specified in -onlynet: '%s'"), -QT_TRANSLATE_NOOP("bitmark-core", "Upgrade wallet to latest format"), -QT_TRANSLATE_NOOP("bitmark-core", "Usage (deprecated, use gamecredits-cli):"), -QT_TRANSLATE_NOOP("bitmark-core", "Usage:"), -QT_TRANSLATE_NOOP("bitmark-core", "Use OpenSSL (https) for JSON-RPC connections"), -QT_TRANSLATE_NOOP("bitmark-core", "Use UPnP to map the listening port (default: 0)"), -QT_TRANSLATE_NOOP("bitmark-core", "Use UPnP to map the listening port (default: 1 when listening)"), -QT_TRANSLATE_NOOP("bitmark-core", "Use the test network"), -QT_TRANSLATE_NOOP("bitmark-core", "Username for JSON-RPC connections"), -QT_TRANSLATE_NOOP("bitmark-core", "Verifying blocks..."), -QT_TRANSLATE_NOOP("bitmark-core", "Verifying wallet..."), -QT_TRANSLATE_NOOP("bitmark-core", "Wait for RPC server to start"), -QT_TRANSLATE_NOOP("bitmark-core", "Wallet %s resides outside data directory %s"), -QT_TRANSLATE_NOOP("bitmark-core", "Wallet needed to be rewritten: restart GameCredits to complete"), -QT_TRANSLATE_NOOP("bitmark-core", "Wallet options:"), -QT_TRANSLATE_NOOP("bitmark-core", "Warning"), -QT_TRANSLATE_NOOP("bitmark-core", "Warning: Deprecated argument -debugnet ignored, use -debug=net"), -QT_TRANSLATE_NOOP("bitmark-core", "Warning: This version is obsolete, upgrade required!"), -QT_TRANSLATE_NOOP("bitmark-core", "You need to rebuild the database using -reindex to change -txindex"), -QT_TRANSLATE_NOOP("bitmark-core", "Zapping all transactions from wallet..."), -QT_TRANSLATE_NOOP("bitmark-core", "on startup"), -QT_TRANSLATE_NOOP("bitmark-core", "version"), -QT_TRANSLATE_NOOP("bitmark-core", "wallet.dat corrupt, salvage failed"), +QT_TRANSLATE_NOOP("gamecredits-core", "(default: 1)"), +QT_TRANSLATE_NOOP("gamecredits-core", "(default: wallet.dat)"), +QT_TRANSLATE_NOOP("gamecredits-core", " can be:"), +QT_TRANSLATE_NOOP("gamecredits-core", "Accept command line and JSON-RPC commands"), +QT_TRANSLATE_NOOP("gamecredits-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Add a node to connect to and attempt to keep the connection open"), +QT_TRANSLATE_NOOP("gamecredits-core", "Allow DNS lookups for -addnode, -seednode and -connect"), +QT_TRANSLATE_NOOP("gamecredits-core", "Allow JSON-RPC connections from specified IP address"), +QT_TRANSLATE_NOOP("gamecredits-core", "Attempt to recover private keys from a corrupt wallet.dat"), +QT_TRANSLATE_NOOP("gamecredits-core", "GameCredits Core Daemon"), +QT_TRANSLATE_NOOP("gamecredits-core", "GameCredits Core RPC client version"), +QT_TRANSLATE_NOOP("gamecredits-core", "Block creation options:"), +QT_TRANSLATE_NOOP("gamecredits-core", "Cannot downgrade wallet"), +QT_TRANSLATE_NOOP("gamecredits-core", "Cannot resolve -bind address: '%s'"), +QT_TRANSLATE_NOOP("gamecredits-core", "Cannot resolve -externalip address: '%s'"), +QT_TRANSLATE_NOOP("gamecredits-core", "Cannot write default address"), +QT_TRANSLATE_NOOP("gamecredits-core", "Clear list of wallet transactions (diagnostic tool; implies -rescan)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Connect only to the specified node(s)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Connect through SOCKS proxy"), +QT_TRANSLATE_NOOP("gamecredits-core", "Connect to JSON-RPC on (default: 40001 or testnet: 50000)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Connect to a node to retrieve peer addresses, and disconnect"), +QT_TRANSLATE_NOOP("gamecredits-core", "Connection options:"), +QT_TRANSLATE_NOOP("gamecredits-core", "Corrupted block database detected"), +QT_TRANSLATE_NOOP("gamecredits-core", "Debugging/Testing options:"), +QT_TRANSLATE_NOOP("gamecredits-core", "Disable safemode, override a real safe mode event (default: 0)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Discover own IP address (default: 1 when listening and no -externalip)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Do not load the wallet and disable wallet RPC calls"), +QT_TRANSLATE_NOOP("gamecredits-core", "Do you want to rebuild the block database now?"), +QT_TRANSLATE_NOOP("gamecredits-core", "Done loading"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error initializing block database"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error initializing wallet database environment %s!"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error loading block database"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error loading wallet.dat"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error loading wallet.dat: Wallet corrupted"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error loading wallet.dat: Wallet requires newer version of GameCredits"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error opening block database"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error: Disk space is low!"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error: Wallet locked, unable to create transaction!"), +QT_TRANSLATE_NOOP("gamecredits-core", "Error: system error: "), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to listen on any port. Use -listen=0 if you want this."), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to read block info"), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to read block"), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to sync block index"), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to write block index"), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to write block info"), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to write block"), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to write file info"), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to write to coin database"), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to write transaction index"), +QT_TRANSLATE_NOOP("gamecredits-core", "Failed to write undo data"), +QT_TRANSLATE_NOOP("gamecredits-core", "Fee per kB to add to transactions you send"), +QT_TRANSLATE_NOOP("gamecredits-core", "Fees smaller than this are considered zero fee (for relaying) (default:"), +QT_TRANSLATE_NOOP("gamecredits-core", "Find peers using DNS lookup (default: 1 unless -connect)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Force safe mode (default: 0)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Generate coins (default: 0)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Get help for a command"), +QT_TRANSLATE_NOOP("gamecredits-core", "How many blocks to check at startup (default: 288, 0 = all)"), +QT_TRANSLATE_NOOP("gamecredits-core", "If is not supplied, output all debugging information."), +QT_TRANSLATE_NOOP("gamecredits-core", "Importing..."), +QT_TRANSLATE_NOOP("gamecredits-core", "Imports blocks from external blk000??.dat file"), +QT_TRANSLATE_NOOP("gamecredits-core", "Incorrect or no genesis block found. Wrong datadir for network?"), +QT_TRANSLATE_NOOP("gamecredits-core", "Information"), +QT_TRANSLATE_NOOP("gamecredits-core", "Insufficient funds"), +QT_TRANSLATE_NOOP("gamecredits-core", "Invalid -onion address: '%s'"), +QT_TRANSLATE_NOOP("gamecredits-core", "Invalid -proxy address: '%s'"), +QT_TRANSLATE_NOOP("gamecredits-core", "Invalid amount for -minrelaytxfee=: '%s'"), +QT_TRANSLATE_NOOP("gamecredits-core", "Invalid amount for -mintxfee=: '%s'"), +QT_TRANSLATE_NOOP("gamecredits-core", "Invalid amount for -paytxfee=: '%s'"), +QT_TRANSLATE_NOOP("gamecredits-core", "Invalid amount"), +QT_TRANSLATE_NOOP("gamecredits-core", "Limit size of signature cache to entries (default: 50000)"), +QT_TRANSLATE_NOOP("gamecredits-core", "List commands"), +QT_TRANSLATE_NOOP("gamecredits-core", "Listen for connections on (default: 40002 or testnet: 50001)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Loading addresses..."), +QT_TRANSLATE_NOOP("gamecredits-core", "Loading block index..."), +QT_TRANSLATE_NOOP("gamecredits-core", "Loading wallet..."), +QT_TRANSLATE_NOOP("gamecredits-core", "Log transaction priority and fee per kB when mining blocks (default: 0)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Maintain a full transaction index (default: 0)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Maintain at most connections to peers (default: 125)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Maximum per-connection receive buffer, *1000 bytes (default: 5000)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Maximum per-connection send buffer, *1000 bytes (default: 1000)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Not enough file descriptors available."), +QT_TRANSLATE_NOOP("gamecredits-core", "Only accept block chain matching built-in checkpoints (default: 1)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Only connect to nodes in network (IPv4, IPv6 or Tor)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Options:"), +QT_TRANSLATE_NOOP("gamecredits-core", "Password for JSON-RPC connections"), +QT_TRANSLATE_NOOP("gamecredits-core", "Prepend debug output with timestamp (default: 1)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Print block on startup, if found in block index"), +QT_TRANSLATE_NOOP("gamecredits-core", "Print block tree on startup (default: 0)"), +QT_TRANSLATE_NOOP("gamecredits-core", "RPC SSL options: (see the Bitmark Wiki for SSL setup instructions)"), +QT_TRANSLATE_NOOP("gamecredits-core", "RPC client options:"), +QT_TRANSLATE_NOOP("gamecredits-core", "RPC server options:"), +QT_TRANSLATE_NOOP("gamecredits-core", "Randomly drop 1 of every network messages"), +QT_TRANSLATE_NOOP("gamecredits-core", "Randomly fuzz 1 of every network messages"), +QT_TRANSLATE_NOOP("gamecredits-core", "Rebuild block chain index from current blk000??.dat files"), +QT_TRANSLATE_NOOP("gamecredits-core", "Rescan the block chain for missing wallet transactions"), +QT_TRANSLATE_NOOP("gamecredits-core", "Rescanning..."), +QT_TRANSLATE_NOOP("gamecredits-core", "Run a thread to flush wallet periodically (default: 1)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Run in the background as a daemon and accept commands"), +QT_TRANSLATE_NOOP("gamecredits-core", "SSL options: (see the Bitmark Wiki for SSL setup instructions)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Select SOCKS version for -proxy (4 or 5, default: 5)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Send command to GameCredits Core"), +QT_TRANSLATE_NOOP("gamecredits-core", "Send commands to node running on (default: 127.0.0.1)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Send trace/debug info to console instead of debug.log file"), +QT_TRANSLATE_NOOP("gamecredits-core", "Server certificate file (default: server.cert)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Server private key (default: server.pem)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Set database cache size in megabytes (%d to %d, default: %d)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Set key pool size to (default: 100)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Set maximum block size in bytes (default: %d)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Set minimum block size in bytes (default: 0)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Set the number of threads to service RPC calls (default: 4)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Sets the DB_PRIVATE flag in the wallet db environment (default: 1)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Show all debugging options (usage: --help -help-debug)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Show benchmark information (default: 0)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Signing transaction failed"), +QT_TRANSLATE_NOOP("gamecredits-core", "Specify configuration file (default: gamecredits.conf)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Specify connection timeout in milliseconds (default: 5000)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Specify data directory"), +QT_TRANSLATE_NOOP("gamecredits-core", "Specify pid file (default: gamecreditsd.pid)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Specify wallet file (within data directory)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Specify your own public address"), +QT_TRANSLATE_NOOP("gamecredits-core", "Spend unconfirmed change when sending transactions (default: 1)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Start GameCredits Core Daemon"), +QT_TRANSLATE_NOOP("gamecredits-core", "System error: "), +QT_TRANSLATE_NOOP("gamecredits-core", "This help message"), +QT_TRANSLATE_NOOP("gamecredits-core", "This is intended for regression testing tools and app development."), +QT_TRANSLATE_NOOP("gamecredits-core", "Threshold for disconnecting misbehaving peers (default: 100)"), +QT_TRANSLATE_NOOP("gamecredits-core", "To use the %s option"), +QT_TRANSLATE_NOOP("gamecredits-core", "Transaction amount too small"), +QT_TRANSLATE_NOOP("gamecredits-core", "Transaction amounts must be positive"), +QT_TRANSLATE_NOOP("gamecredits-core", "Transaction too large"), +QT_TRANSLATE_NOOP("gamecredits-core", "Unable to bind to %s on this computer (bind returned error %d, %s)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Unknown -socks proxy version requested: %i"), +QT_TRANSLATE_NOOP("gamecredits-core", "Unknown network specified in -onlynet: '%s'"), +QT_TRANSLATE_NOOP("gamecredits-core", "Upgrade wallet to latest format"), +QT_TRANSLATE_NOOP("gamecredits-core", "Usage (deprecated, use gamecredits-cli):"), +QT_TRANSLATE_NOOP("gamecredits-core", "Usage:"), +QT_TRANSLATE_NOOP("gamecredits-core", "Use OpenSSL (https) for JSON-RPC connections"), +QT_TRANSLATE_NOOP("gamecredits-core", "Use UPnP to map the listening port (default: 0)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Use UPnP to map the listening port (default: 1 when listening)"), +QT_TRANSLATE_NOOP("gamecredits-core", "Use the test network"), +QT_TRANSLATE_NOOP("gamecredits-core", "Username for JSON-RPC connections"), +QT_TRANSLATE_NOOP("gamecredits-core", "Verifying blocks..."), +QT_TRANSLATE_NOOP("gamecredits-core", "Verifying wallet..."), +QT_TRANSLATE_NOOP("gamecredits-core", "Wait for RPC server to start"), +QT_TRANSLATE_NOOP("gamecredits-core", "Wallet %s resides outside data directory %s"), +QT_TRANSLATE_NOOP("gamecredits-core", "Wallet needed to be rewritten: restart GameCredits to complete"), +QT_TRANSLATE_NOOP("gamecredits-core", "Wallet options:"), +QT_TRANSLATE_NOOP("gamecredits-core", "Warning"), +QT_TRANSLATE_NOOP("gamecredits-core", "Warning: Deprecated argument -debugnet ignored, use -debug=net"), +QT_TRANSLATE_NOOP("gamecredits-core", "Warning: This version is obsolete, upgrade required!"), +QT_TRANSLATE_NOOP("gamecredits-core", "You need to rebuild the database using -reindex to change -txindex"), +QT_TRANSLATE_NOOP("gamecredits-core", "Zapping all transactions from wallet..."), +QT_TRANSLATE_NOOP("gamecredits-core", "on startup"), +QT_TRANSLATE_NOOP("gamecredits-core", "version"), +QT_TRANSLATE_NOOP("gamecredits-core", "wallet.dat corrupt, salvage failed"), }; diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 082dc83..a066df9 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -32,8 +32,8 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTest // define text to place QString titleText = tr("GameCredits Core"); QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion())); - QString copyrightTextBTM = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core Developers")); - QString copyrightText = QChar(0xA9) + QString(tr(" 2014 The Bitmark Core Developers")); + QString copyrightTextBTM = QChar(0xA9) + QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core Developers")); + QString copyrightText = QChar(0xA9) + QString(" %1 ").arg(COPYRIGHT_YEAR) + QString(tr("The GameCredits Foundation")); QString testnetAddText = QString(tr("[testnet]")); // define text to place as single text object QString font = "Arial"; diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index fddbb5e..885cf91 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -27,7 +27,7 @@ AboutDialog::AboutDialog(QWidget *parent) : ui->setupUi(this); // Set current copyright year - ui->copyrightLabel->setText(tr("Copyright") + QString(" © %1 ").arg(COPYRIGHT_YEAR) + tr("Project Bitmark")); + ui->copyrightLabel->setText(tr("Copyright") + QString(" © %1 ").arg(COPYRIGHT_YEAR) + tr("The GameCredits Foundation")); ui->copyrightLabelTwo->setText(tr("Copyright") + QString(" © 2009-%1 ").arg(COPYRIGHT_YEAR) + tr("The Bitcoin Core Developers")); } diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 3777cda..ec6051a 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -518,7 +518,7 @@ void StartRPCThreads() _("%s, you must set a rpcpassword in the configuration file:\n" "%s\n" "It is recommended you use the following random password:\n" - "rpcuser=bitmarkrpc\n" + "rpcuser=gamecreditsrpc\n" "rpcpassword=%s\n" "(you do not need to remember this password)\n" "The username and password MUST NOT be the same.\n" From 9bf7d67eccc4c49b2ba594532caeb3735cfe35ee Mon Sep 17 00:00:00 2001 From: noise23 Date: Fri, 29 May 2015 14:40:44 +0300 Subject: [PATCH 10/13] Revert main.cpp to the original --- src/main.cpp | 201 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 165 insertions(+), 36 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 254c62f..78c8626 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,7 +43,6 @@ map mapBlockIndex; CChain chainActive; CChain chainMostWork; int64_t nTimeBestReceived = 0; -static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // starting difficulty is 1 / 2^12 int nScriptCheckThreads = 0; bool fImporting = false; bool fReindex = false; @@ -1102,6 +1101,11 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock return false; } + + + + + ////////////////////////////////////////////////////////////////////////////// // // CBlock and CBlockIndex @@ -1213,75 +1217,200 @@ int64_t GetBlockValue(int nHeight, int64_t nFees) return nSubsidy + nFees; } -static const int64_t nTargetTimespan = 30 * 60; // every 30 minutes -static const int64_t nTargetSpacing = 1.5 * 60; // 90 sec +// Traditional Targets only used for KGW v1 blocks +static const int64_t nTargetTimespan = 3.5 * 24 * 60 * 60; +static const int64_t nTargetSpacing = 2.5 * 60; static const int64_t nInterval = nTargetTimespan / nTargetSpacing; -// -// minimum amount of work that could possibly be required nTime after -// minimum work required was nBase -// -unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime) -{ - // Testnet has min-difficulty blocks - // after nTargetSpacing*2 time between blocks: - if (TestNet() && nTime > nTargetSpacing*2) - return bnProofOfWorkLimit.GetCompact(); +unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) { + /* current difficulty formula, megacoin - kimoto gravity well */ + const CBlockIndex *BlockLastSolved = pindexLast; + const CBlockIndex *BlockReading = pindexLast; + const CBigNum &bnProofOfWorkLimit = Params().ProofOfWorkLimit(); - CBigNum bnResult; - bnResult.SetCompact(nBase); - while (nTime > 0 && bnResult < bnProofOfWorkLimit) - { - // Maximum 400% adjustment... - bnResult *= 4; - // ... in best-case exactly 4-times-normal target time - nTime -= nTargetTimespan*4; - } - if (bnResult > bnProofOfWorkLimit) - bnResult = bnProofOfWorkLimit; - return bnResult.GetCompact(); + uint64_t PastBlocksMass = 0; + int64_t PastRateActualSeconds = 0; + int64_t PastRateTargetSeconds = 0; + double PastRateAdjustmentRatio = double(1); + CBigNum PastDifficultyAverage; + CBigNum PastDifficultyAveragePrev; + double EventHorizonDeviation; + double EventHorizonDeviationFast; + double EventHorizonDeviationSlow; + + if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64_t)BlockLastSolved->nHeight < PastBlocksMin) { + return bnProofOfWorkLimit.GetCompact(); + } + int64_t LatestBlockTime = BlockLastSolved->GetBlockTime(); + for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) { + if (PastBlocksMax > 0 && i > PastBlocksMax) { break; } + PastBlocksMass++; + + if (i == 1) { PastDifficultyAverage.SetCompact(BlockReading->nBits); } + else { PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev; } + PastDifficultyAveragePrev = PastDifficultyAverage; + + if (LatestBlockTime < BlockReading->GetBlockTime()) { + if (BlockReading->nHeight > 100000) LatestBlockTime = BlockReading->GetBlockTime(); + } + + PastRateActualSeconds = LatestBlockTime - BlockReading->GetBlockTime(); + + if (BlockReading->nHeight > 100000) { + if (PastRateActualSeconds < 1) { PastRateActualSeconds = 1; } + } else { + if (PastRateActualSeconds < 0) { PastRateActualSeconds = 0; } + } + + PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass; + PastRateAdjustmentRatio = double(1); + + if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) { + PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds); + } + EventHorizonDeviation = 1 + (0.7084 * pow((double(PastBlocksMass)/double(28.2)), -1.228)); + EventHorizonDeviationFast = EventHorizonDeviation; + EventHorizonDeviationSlow = 1 / EventHorizonDeviation; + + if (PastBlocksMass >= PastBlocksMin) { + if ((PastRateAdjustmentRatio <= EventHorizonDeviationSlow) || (PastRateAdjustmentRatio >= EventHorizonDeviationFast)) { + assert(BlockReading); + break; + } + } + if (BlockReading->pprev == NULL) { + assert(BlockReading); + break; + } + BlockReading = BlockReading->pprev; + } + + CBigNum bnNew(PastDifficultyAverage); + if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) { + bnNew *= PastRateActualSeconds; + bnNew /= PastRateTargetSeconds; + } + if (bnNew > bnProofOfWorkLimit) { bnNew = bnProofOfWorkLimit; } + + /* + printf("Difficulty Retarget - Kimoto Gravity Well\n"); + printf("PastRateAdjustmentRatio = %g\n", PastRateAdjustmentRatio); + printf("Before: %08x %s\n", BlockLastSolved->nBits, CBigNum().SetCompact(BlockLastSolved->nBits).getuint256().ToString().c_str()); + printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); + */ + return bnNew.GetCompact(); } -unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock) +unsigned int static GetNextWorkRequired_OLD(const CBlockIndex* pindexLast, const CBlockHeader *pblock) { + const CBigNum &bnProofOfWorkLimit = Params().ProofOfWorkLimit(); unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact(); // Genesis block if (pindexLast == NULL) return nProofOfWorkLimit; + // Only change once per interval + if ((pindexLast->nHeight+1) % nInterval != 0) { + return pindexLast->nBits; + } + + // GameCredits: This fixes an issue where a 51% attack can change difficulty at will. + // Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz + int blockstogoback = nInterval-1; + if ((pindexLast->nHeight+1) != nInterval) + blockstogoback = nInterval; + // Go back by what we want to be 14 days worth of blocks + const CBlockIndex* pindexFirst = pindexLast; + for (int i = 0; pindexFirst && i < blockstogoback; i++) + pindexFirst = pindexFirst->pprev; + assert(pindexFirst); - const CBlockIndex* pindexFirst = pindexLast->pprev; - int64_t nActualSpacing = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); + // Limit adjustment step + int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); - // limit the adjustment - if (nActualSpacing < nTargetSpacing/16) - nActualSpacing = nTargetSpacing/16; - if (nActualSpacing > nTargetSpacing*16) - nActualSpacing = nTargetSpacing*16; + if (nActualTimespan < nTargetTimespan/4) + nActualTimespan = nTargetTimespan/4; + if (nActualTimespan > nTargetTimespan*4) + nActualTimespan = nTargetTimespan*4; // Retarget CBigNum bnNew; bnNew.SetCompact(pindexLast->nBits); - bnNew *= ((nInterval - 1) * nTargetSpacing + 2 * nActualSpacing); - bnNew /= ((nInterval + 1) * nTargetSpacing); + bnNew *= nActualTimespan; + bnNew /= nTargetTimespan; if (bnNew > bnProofOfWorkLimit) bnNew = bnProofOfWorkLimit; + /// debug print + printf("GetNextWorkRequired RETARGET\n"); + printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); + printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); return bnNew.GetCompact(); } +unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock) +{ + unsigned int nHeight = pindexLast->nHeight + 1; + + // Settings for GMC KGW + unsigned int TimeDaySeconds = 60 * 60 * 24; + int64_t PastSecondsMin = TimeDaySeconds * 0.01; + int64_t PastSecondsMax = TimeDaySeconds * 0.14; + int64_t BlocksTargetSpacing = 0; + + if(nHeight < 15332) { + // KGW v1 + return GetNextWorkRequired_OLD(pindexLast, pblock); + } else if(nHeight < 1036320) { + // Former 30 Second Block Target, KGW 2 Prefork + BlocksTargetSpacing = 30; + } else { + // New 90 Second Block Target, KGW 2 Postfork + BlocksTargetSpacing = 90; + } + uint64_t PastBlocksMin = PastSecondsMin / BlocksTargetSpacing; + uint64_t PastBlocksMax = PastSecondsMax / BlocksTargetSpacing; + return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax); +} + +// +// minimum amount of work that could possibly be required nTime after +// minimum work required was nBase +// +unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime) +{ + const CBigNum &bnLimit = Params().ProofOfWorkLimit(); + // Testnet has min-difficulty blocks + // after nTargetSpacing*2 time between blocks: + if (TestNet() && nTime > nTargetSpacing*2) + return bnLimit.GetCompact(); + + CBigNum bnResult; + bnResult.SetCompact(nBase); + while (nTime > 0 && bnResult < bnLimit) + { + // Maximum 400% adjustment... + bnResult *= 4; + // ... in best-case exactly 4-times-normal target time + nTime -= nTargetTimespan*4; + } + if (bnResult > bnLimit) + bnResult = bnLimit; + return bnResult.GetCompact(); +} + bool CheckProofOfWork(uint256 hash, unsigned int nBits) { CBigNum bnTarget; bnTarget.SetCompact(nBits); // Check range - if (bnTarget <= 0 || bnTarget > bnProofOfWorkLimit) + if (bnTarget <= 0 || bnTarget > Params().ProofOfWorkLimit()) return error("CheckProofOfWork() : nBits below minimum work"); // Check proof of work matches claimed amount From 11cbf826604bac8b19a31890c1a78a150cad0238 Mon Sep 17 00:00:00 2001 From: noise23 Date: Fri, 29 May 2015 18:53:57 +0300 Subject: [PATCH 11/13] Change re-target --- configure.ac | 2 +- src/clientversion.h | 2 +- src/main.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 76 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index aa63b4d..6ac71b7 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 9) define(_CLIENT_VERSION_REVISION, 4) -define(_CLIENT_VERSION_BUILD, 2) +define(_CLIENT_VERSION_BUILD, 3) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2015) AC_INIT([GameCredits Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitmark.org],[gamecredits]) diff --git a/src/clientversion.h b/src/clientversion.h index 7ca2b75..1cbec7a 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -12,7 +12,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_REVISION 4 -#define CLIENT_VERSION_BUILD 2 +#define CLIENT_VERSION_BUILD 3 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/main.cpp b/src/main.cpp index 78c8626..a472317 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1222,6 +1222,11 @@ static const int64_t nTargetTimespan = 3.5 * 24 * 60 * 60; static const int64_t nTargetSpacing = 2.5 * 60; static const int64_t nInterval = nTargetTimespan / nTargetSpacing; +// V3 Targets +static const int64_t nTargetTimespannew = 30 * 60; // every 30 minutes +static const int64_t nTargetSpacingnew = 1.5 * 60; // 90 sec +static const int64_t nIntervalnew = nTargetTimespannew / nTargetSpacingnew; + unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64_t TargetBlocksSpacingSeconds, uint64_t PastBlocksMin, uint64_t PastBlocksMax) { /* current difficulty formula, megacoin - kimoto gravity well */ @@ -1353,6 +1358,58 @@ unsigned int static GetNextWorkRequired_OLD(const CBlockIndex* pindexLast, const return bnNew.GetCompact(); } +unsigned int static GetNextWorkRequired_V3(const CBlockIndex* pindexLast, const CBlockHeader *pblock) +{ + const CBigNum &bnProofOfWorkLimit = Params().ProofOfWorkLimit(); + unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact(); + + // Genesis block + if (pindexLast == NULL) + return nProofOfWorkLimit; + + // Only change once per interval + if ((pindexLast->nHeight+1) % nIntervalnew != 0) { + return pindexLast->nBits; + } + + // GameCredits: This fixes an issue where a 51% attack can change difficulty at will. + // Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz + int blockstogoback = nIntervalnew-1; + if ((pindexLast->nHeight+1) != nIntervalnew) + blockstogoback = nIntervalnew; + + // Go back by what we want to be 14 days worth of blocks + const CBlockIndex* pindexFirst = pindexLast; + for (int i = 0; pindexFirst && i < blockstogoback; i++) + pindexFirst = pindexFirst->pprev; + assert(pindexFirst); + + // Limit adjustment step + int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); + + if (nActualTimespan < nTargetTimespannew/16) + nActualTimespan = nTargetTimespannew/16; + if (nActualTimespan > nTargetTimespannew*16) + nActualTimespan = nTargetTimespannew*16; + + // Retarget + CBigNum bnNew; + bnNew.SetCompact(pindexLast->nBits); + + bnNew *= ((nIntervalnew - 1) * nTargetTimespannew + 2 * nActualTimespan); + bnNew /= ((nIntervalnew + 1) * nTargetTimespannew); + + if (bnNew > bnProofOfWorkLimit) + bnNew = bnProofOfWorkLimit; + + /// debug print + printf("GetNextWorkRequired RETARGET\n"); + printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); + printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); + + return bnNew.GetCompact(); +} + unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock) { unsigned int nHeight = pindexLast->nHeight + 1; @@ -1366,18 +1423,31 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead if(nHeight < 15332) { // KGW v1 return GetNextWorkRequired_OLD(pindexLast, pblock); - } else if(nHeight < 1036320) { + } + else if(nHeight < 1036320) { // Former 30 Second Block Target, KGW 2 Prefork BlocksTargetSpacing = 30; - } else { + uint64_t PastBlocksMin = PastSecondsMin / BlocksTargetSpacing; + uint64_t PastBlocksMax = PastSecondsMax / BlocksTargetSpacing; + return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax); + } + else if(nHeight < 1096772) { // New 90 Second Block Target, KGW 2 Postfork BlocksTargetSpacing = 90; - } - uint64_t PastBlocksMin = PastSecondsMin / BlocksTargetSpacing; + uint64_t PastBlocksMin = PastSecondsMin / BlocksTargetSpacing; uint64_t PastBlocksMax = PastSecondsMax / BlocksTargetSpacing; return KimotoGravityWell(pindexLast, pblock, BlocksTargetSpacing, PastBlocksMin, PastBlocksMax); + } + else { + return GetNextWorkRequired_V3(pindexLast, pblock); + } } +// +// minimum amount of work that could possibly be required nTime after +// minimum work required was nBase +// + // // minimum amount of work that could possibly be required nTime after // minimum work required was nBase From fa9d0ea8c0e0f0732cac0ca2a55bd4d633bd9ab6 Mon Sep 17 00:00:00 2001 From: noise23 Date: Fri, 29 May 2015 19:06:35 +0300 Subject: [PATCH 12/13] fix --- src/main.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a472317..09a8d22 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1367,24 +1367,10 @@ unsigned int static GetNextWorkRequired_V3(const CBlockIndex* pindexLast, const if (pindexLast == NULL) return nProofOfWorkLimit; - // Only change once per interval - if ((pindexLast->nHeight+1) % nIntervalnew != 0) { - return pindexLast->nBits; - } - - // GameCredits: This fixes an issue where a 51% attack can change difficulty at will. - // Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz - int blockstogoback = nIntervalnew-1; - if ((pindexLast->nHeight+1) != nIntervalnew) - blockstogoback = nIntervalnew; - // Go back by what we want to be 14 days worth of blocks - const CBlockIndex* pindexFirst = pindexLast; - for (int i = 0; pindexFirst && i < blockstogoback; i++) - pindexFirst = pindexFirst->pprev; - assert(pindexFirst); // Limit adjustment step + const CBlockIndex* pindexFirst = pindexLast->pprev; int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); if (nActualTimespan < nTargetTimespannew/16) From cb31d161f0448bd5ea3a2504a70681a2864735c3 Mon Sep 17 00:00:00 2001 From: noise23 Date: Mon, 1 Jun 2015 03:38:57 +0300 Subject: [PATCH 13/13] fix --- src/main.cpp | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 09a8d22..6d10598 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1360,38 +1360,31 @@ unsigned int static GetNextWorkRequired_OLD(const CBlockIndex* pindexLast, const unsigned int static GetNextWorkRequired_V3(const CBlockIndex* pindexLast, const CBlockHeader *pblock) { - const CBigNum &bnProofOfWorkLimit = Params().ProofOfWorkLimit(); - unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact(); - + const CBigNum &bnProofOfWorkLimit = Params().ProofOfWorkLimit(); + unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact(); + // Genesis block if (pindexLast == NULL) return nProofOfWorkLimit; + const CBlockIndex* pindexFirst = pindexLast->pprev; + int64_t nActualSpacing = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); - - // Limit adjustment step - const CBlockIndex* pindexFirst = pindexLast->pprev; - int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); - - if (nActualTimespan < nTargetTimespannew/16) - nActualTimespan = nTargetTimespannew/16; - if (nActualTimespan > nTargetTimespannew*16) - nActualTimespan = nTargetTimespannew*16; + // limit the adjustment + if (nActualSpacing < nTargetSpacingnew/16) + nActualSpacing = nTargetSpacingnew/16; + if (nActualSpacing > nTargetSpacingnew*16) + nActualSpacing = nTargetSpacingnew*16; // Retarget CBigNum bnNew; bnNew.SetCompact(pindexLast->nBits); - - bnNew *= ((nIntervalnew - 1) * nTargetTimespannew + 2 * nActualTimespan); - bnNew /= ((nIntervalnew + 1) * nTargetTimespannew); + bnNew *= ((nIntervalnew - 1) * nTargetSpacingnew + 2 * nActualSpacing); + bnNew /= ((nIntervalnew + 1) * nTargetSpacingnew); if (bnNew > bnProofOfWorkLimit) bnNew = bnProofOfWorkLimit; - /// debug print - printf("GetNextWorkRequired RETARGET\n"); - printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); - printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); return bnNew.GetCompact(); } @@ -1434,10 +1427,6 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead // minimum work required was nBase // -// -// minimum amount of work that could possibly be required nTime after -// minimum work required was nBase -// unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime) { const CBigNum &bnLimit = Params().ProofOfWorkLimit();