forked from Raptor3um/raptoreum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubsidy_tests.cpp
More file actions
75 lines (59 loc) · 3.36 KB
/
Copy pathsubsidy_tests.cpp
File metadata and controls
75 lines (59 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) 2014-2020 The Dash Core developers
// Copyright (c) 2020-2023 The Raptoreum developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chainparams.h>
#include <validation.h>
#include <test/test_raptoreum.h>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(subsidy_tests, TestingSetup
)
BOOST_AUTO_TEST_CASE(block_subsidy_test)
{
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
uint32_t nPrevBits;
int32_t nPrevHeight;
CAmount nSubsidy;
// details for block 4249 (subsidy returned will be for block 4250)
nPrevBits = 0x1c4a47c4;
nPrevHeight = 4249;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
BOOST_CHECK_EQUAL(nSubsidy, 500000000000ULL);
// details for block 553535 (subsidy returned will be for block 553536)
nPrevBits = 0x1c4a47c4;
nPrevHeight = 553535;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
BOOST_CHECK_EQUAL(nSubsidy, 499000000000ULL);
// details for block 2105680 (subsidy returned will be for block 2105681)
nPrevBits = 0x1c29ec00;
nPrevHeight = 2105680;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
BOOST_CHECK_EQUAL(nSubsidy, 425000000000ULL);
// details for block 54655273698 (subsidy returned will be for block 5273699)
nPrevBits = 0x1c29ec00;
nPrevHeight = 5273698;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
BOOST_CHECK_EQUAL(nSubsidy, 128000000000ULL);
// details for block 7378635 (subsidy returned will be for block 7378636)
nPrevBits = 0x1c08ba34;
nPrevHeight = 7378635;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
BOOST_CHECK_EQUAL(nSubsidy, 29500000000ULL);
// details for block 8399219 (subsidy returned will be for block 8399220)
nPrevBits = 0x1b10cf42;
nPrevHeight = 8399219;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
BOOST_CHECK_EQUAL(nSubsidy, 5500000000ULL);
// details for block 14735288 (subsidy returned will be for block 14735289)
nPrevBits = 0x1b11548e;
nPrevHeight = 14735288;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
BOOST_CHECK_EQUAL(nSubsidy, 5400000000ULL);
// 1st subsidy reduction happens here
// details for block 15798386 (subsidy returned will be for block 15798387)
nPrevBits = 0x1b10d50b;
nPrevHeight = 15798386;
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
BOOST_CHECK_EQUAL(nSubsidy, 500000000ULL);
}
BOOST_AUTO_TEST_SUITE_END()