Skip to content

Commit 5fa64bc

Browse files
committed
feat: put brr activation to height=1
1 parent 593c6cf commit 5fa64bc

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

src/chainparams.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ class CRegTestParams : public CChainParams {
805805
consensus.DIP0003EnforcementHeight = 500;
806806
consensus.DIP0003EnforcementHash = uint256();
807807
consensus.DIP0008Height = 1; // Always active unless overridden
808-
consensus.BRRHeight = 1000; // see block_reward_reallocation_tests
808+
consensus.BRRHeight = 1; // Always active unless overridden
809809
consensus.DIP0020Height = 1;
810810
consensus.DIP0024Height = 900;
811811
consensus.DIP0024QuorumsHeight = 900;
@@ -1054,6 +1054,8 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
10541054
consensus.BIP65Height = int{height};
10551055
} else if (name == "csv") {
10561056
consensus.CSVHeight = int{height};
1057+
} else if (name == "brr") {
1058+
consensus.BRRHeight = int{height};
10571059
} else if (name == "dip0008") {
10581060
consensus.DIP0008Height = int{height};
10591061
} else if (name == "dip0020") {

src/chainparamsbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
2222
argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
2323
argsman.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
2424
argsman.AddArg("-bip147height=<activation>", "Override BIP147 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
25-
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, dip0008, dip0020). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
25+
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, brr, dip0008, dip0020). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
2626
argsman.AddArg("-highsubsidyblocks=<n>", "The number of blocks with a higher than normal subsidy to mine at the start of a chain. Block after that height will have fixed subsidy base. (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2727
argsman.AddArg("-highsubsidyfactor=<n>", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2828
argsman.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);

src/test/block_reward_reallocation_tests.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ using SimpleUTXOMap = std::map<COutPoint, std::pair<int, CAmount>>;
3535
struct TestChainBRRBeforeActivationSetup : public TestChainSetup
3636
{
3737
// Force fast DIP3 activation
38-
TestChainBRRBeforeActivationSetup() : TestChainSetup(497, {"-dip3params=30:50", "-vbparams=mn_rr:0:999999999999:0:20:16:12:5:1"}) {}
38+
TestChainBRRBeforeActivationSetup() :
39+
TestChainSetup(497, {"-dip3params=30:50", "-testactivationheight=brr@1000",
40+
"-vbparams=mn_rr:0:999999999999:0:20:16:12:5:1"})
41+
{
42+
}
3943
};
4044

4145
static SimpleUTXOMap BuildSimpleUtxoMap(const std::vector<CTransactionRef>& txs)

test/functional/rpc_blockchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _test_getblockchaininfo(self):
152152
'dip0008': { 'type': 'buried', 'active': True, 'height': 1},
153153
'dip0020': { 'type': 'buried', 'active': True, 'height': 1},
154154
'dip0024': { 'type': 'buried', 'active': False, 'height': 900},
155-
'realloc': { 'type': 'buried', 'active': False, 'height': 1000},
155+
'realloc': { 'type': 'buried', 'active': True, 'height': 1},
156156
'v19': { 'type': 'buried', 'active': False, 'height': 900},
157157
'v20': {
158158
'type': 'bip9',

test/functional/test_framework/blocktools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,13 @@ def filter_tip_keys(chaintips):
255255
return filtered_tips
256256

257257
# Identical to GetMasternodePayment in C++ code
258+
# TODO: remove it or make **proper** tests for various height
258259
def get_masternode_payment(nHeight, blockValue, fV20Active):
259260
ret = int(blockValue / 5)
260261

261262
nMNPIBlock = 350
262263
nMNPIPeriod = 10
263-
nReallocActivationHeight = 2500
264+
nReallocActivationHeight = 1
264265

265266
if nHeight > nMNPIBlock:
266267
ret += int(blockValue / 20)
@@ -285,7 +286,7 @@ def get_masternode_payment(nHeight, blockValue, fV20Active):
285286
# Block Reward Realocation is not activated yet, nothing to do
286287
return ret
287288

288-
nSuperblockCycle = 10
289+
nSuperblockCycle = 20
289290
# Actual realocation starts in the cycle next to one activation happens in
290291
nReallocStart = nReallocActivationHeight - nReallocActivationHeight % nSuperblockCycle + nSuperblockCycle
291292

0 commit comments

Comments
 (0)