From 63bba49ef4c9203cb996ca5cb45dc16dde934251 Mon Sep 17 00:00:00 2001 From: ikyokushin Date: Fri, 19 Feb 2021 12:36:35 +1000 Subject: [PATCH] Stake modifier work Change MAKX_MONEY value from 21M to 10M. Sync improvements for older clients. TimeHash wrapper for stake modifier hash timestamps (fixes old uint256 sorting issue). Some further work to stake modifier genetion (WIP) Added some debug code for debugging stake modier generation :q q --- src/amount.h | 2 +- src/chain.h | 1 + src/init.cpp | 2 +- src/pos.cpp | 572 ++++++++++++++++++++++++++++++++++++++++++++- src/validation.cpp | 19 ++ src/validation.h | 2 +- 6 files changed, 587 insertions(+), 11 deletions(-) diff --git a/src/amount.h b/src/amount.h index 47968e80b1..b42ebe43cd 100644 --- a/src/amount.h +++ b/src/amount.h @@ -22,7 +22,7 @@ static const CAmount COIN = 100000000; * critical; in unusual circumstances like a(nother) overflow bug that allowed * for the creation of coins out of thin air modification could lead to a fork. * */ -static const CAmount MAX_MONEY = 21000000 * COIN; +static const CAmount MAX_MONEY = 10000000 * COIN; inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } #endif // BITCOIN_AMOUNT_H diff --git a/src/chain.h b/src/chain.h index 6b376aeac3..2dd66a9fe0 100644 --- a/src/chain.h +++ b/src/chain.h @@ -69,6 +69,7 @@ class CBlockFileInfo nUndoSize = 0; nFlags = 0; nStakeModifier = 0; + nStakeModifierChecksum = 0; hashProofOfStake = arith_uint256(); prevoutStake.SetNull(); nStakeTime = 0; diff --git a/src/init.cpp b/src/init.cpp index 1149a827ec..7fe3f5b1ff 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -59,7 +59,7 @@ #include #include #include - +#include #include #include diff --git a/src/pos.cpp b/src/pos.cpp index 5a3b20b755..f0aa576f88 100644 --- a/src/pos.cpp +++ b/src/pos.cpp @@ -3,17 +3,573 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "pos.h" +#include -#include "arith_uint256.h" -#include "chain.h" -#include "primitives/block.h" -#include "uint256.h" -#include "util.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include