diff --git a/src/chainparams.cpp b/src/chainparams.cpp index c27d1cf5aa..1ea13b59ff 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -295,6 +295,8 @@ public: vSporkAddresses = {"Xgtyuk76vhuFW2iT7UAiHgNdWXCf3J34wh"}; nMinSporkKeys = 1; + nCreditPoolPeriodBlocks = 576; + checkpointData = { { {1500, uint256S("0x000000aaf0300f59f49bc3e970bad15c11f961fe2347accffff19d96ec9778e3")}, @@ -484,6 +486,8 @@ public: vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"}; nMinSporkKeys = 1; + nCreditPoolPeriodBlocks = 576; + checkpointData = { { {255, uint256S("0x0000080b600e06f4c07880673f027210f9314575f5f875fafe51971e268b886a")}, @@ -664,6 +668,8 @@ public: vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"}; nMinSporkKeys = 1; + nCreditPoolPeriodBlocks = 576; + checkpointData = (CCheckpointData) { { { 0, uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e")}, @@ -866,6 +872,8 @@ public: vSporkAddresses = {"yj949n1UH6fDhw6HtVE5VMj2iSTaSWBMcW"}; nMinSporkKeys = 1; + nCreditPoolPeriodBlocks = 100; + checkpointData = { { {0, uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e")}, diff --git a/src/chainparams.h b/src/chainparams.h index 7dc89a36b9..b832f04880 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -152,6 +152,7 @@ public: int FulfilledRequestExpireTime() const { return nFulfilledRequestExpireTime; } const std::vector& SporkAddresses() const { return vSporkAddresses; } int MinSporkKeys() const { return nMinSporkKeys; } + int CreditPoolPeriodBlocks() const { return nCreditPoolPeriodBlocks; } [[nodiscard]] std::optional GetLLMQ(Consensus::LLMQType llmqType) const; protected: @@ -188,6 +189,8 @@ protected: int nMinSporkKeys; uint16_t nDefaultPlatformP2PPort; uint16_t nDefaultPlatformHTTPPort; + /// The number of blocks the credit pool tracks; 576 (one day) on mainnet, reduced on regtest + int nCreditPoolPeriodBlocks; void AddLLMQ(Consensus::LLMQType llmqType); }; diff --git a/src/evo/creditpool.cpp b/src/evo/creditpool.cpp index b3474a78a3..424915cc1e 100644 --- a/src/evo/creditpool.cpp +++ b/src/evo/creditpool.cpp @@ -153,7 +153,7 @@ CCreditPool CCreditPoolManager::ConstructCreditPool(const CBlockIndex* const blo return opt_cbTx->creditPoolBalance; }(); - // We use here sliding window with LimitBlocksToTrace to determine + // We use here sliding window with Params().CreditPoolPeriodBlocks to determine // current limits for asset unlock transactions. // Indexes should not be duplicated since genesis block, but the Unlock Amount // of withdrawal transaction is limited only by this window @@ -164,7 +164,7 @@ CCreditPool CCreditPoolManager::ConstructCreditPool(const CBlockIndex* const blo } const CBlockIndex* distant_block_index = block_index; - for (size_t i = 0; i < CCreditPoolManager::LimitBlocksToTrace; ++i) { + for (auto i = 0; i < Params().CreditPoolPeriodBlocks(); ++i) { distant_block_index = distant_block_index->pprev; if (distant_block_index == nullptr) break; } diff --git a/src/evo/creditpool.h b/src/evo/creditpool.h index 9545922caf..dfb3004f8e 100644 --- a/src/evo/creditpool.h +++ b/src/evo/creditpool.h @@ -114,7 +114,6 @@ private: static constexpr int DISK_SNAPSHOT_PERIOD = 576; // once per day public: - static constexpr int LimitBlocksToTrace = 576; static constexpr CAmount LimitAmountLow = 100 * COIN; static constexpr CAmount LimitAmountHigh = 1000 * COIN; static constexpr CAmount LimitAmountV22 = 2000 * COIN;