• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

libbitcoin / libbitcoin-system / 41702545994

03 Nov 2026 07:21PM UTC coverage: 96.843% (+0.01%) from 96.83%
41702545994

push

github

web-flow
Merge pull request #2150 from evoskuil/master

Gate the negative timespan check in header accept.

4 of 4 new or added lines in 3 files covered. (100.0%)

19 existing lines in 8 files now uncovered.

23683 of 24455 relevant lines covered (96.84%)

2771826.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

99.46
/src/settings.cpp
1
/**
2
 * Copyright (c) 2011-2026 libbitcoin developers
3
 *
4
 * This file is part of libbitcoin.
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Affero General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
#include <bitcoin/system/settings.hpp>
20

21
#include <bitcoin/system/chain/chain.hpp>
22
#include <bitcoin/system/data/data.hpp>
23
#include <bitcoin/system/define.hpp>
24
#include <bitcoin/system/math/math.hpp>
25

26
namespace libbitcoin {
27
namespace system {
28

29
settings::settings() NOEXCEPT
169 ✔
30
  : initial_subsidy_bitcoin(50),
169 ✔
31
    subsidy_interval_blocks(210000),
169 ✔
32
    timestamp_limit_seconds(2 * 60 * 60),
169 ✔
33

34
    retargeting_factor(4),
169 ✔
35
    retargeting_interval_seconds(2 * 7 * 24 * 60 * 60),
169 ✔
36
    block_spacing_seconds(10 * 60),
169 ✔
37
    proof_of_work_limit(0x1d00ffff),
169 ✔
38

39
    first_version(1),
169 ✔
40
    bip34_version(2),
169 ✔
41
    bip66_version(3),
169 ✔
42
    bip65_version(4),
169 ✔
43
    bip9_version_bit0(1 << 0),
169 ✔
44
    bip9_version_bit1(1 << 1),
169 ✔
45
    bip9_version_bit2(1 << 2),
169 ✔
46
    bip9_version_base(0x20000000)
169 ✔
47
{
48
    bip9_bit0_deployment.bit = 0;
169 ✔
49
    bip9_bit0_deployment.flags =
169 ✔
50
        chain::flags::bip68_rule |
51
        chain::flags::bip112_rule |
52
        chain::flags::bip113_rule;
53
    bip9_bit0_deployment.buried = true;
169 ✔
54
    bip9_bit1_deployment.bit = 1;
169 ✔
55
    bip9_bit1_deployment.flags =
169 ✔
56
        chain::flags::bip141_rule |
57
        chain::flags::bip143_rule |
58
        chain::flags::bip147_rule;
59
    bip9_bit1_deployment.buried = true;
169 ✔
60
    bip9_bit2_deployment.bit = 2;
169 ✔
61
    bip9_bit2_deployment.flags =
169 ✔
62
        chain::flags::bip341_rule |
63
        chain::flags::bip342_rule;
64
    bip9_bit2_deployment.buried = true;
169 ✔
65
    bip54_timewarp_deployment.bit = 5;
169 ✔
66
    bip54_timewarp_deployment.flags = chain::flags::bip54_timewarp_rule;
169 ✔
67
    bip54_timewarp_deployment.speedy = true;
169 ✔
68
    bip54_timespan_deployment.bit = 6;
169 ✔
69
    bip54_timespan_deployment.flags = chain::flags::bip54_timespan_rule;
169 ✔
70
    bip54_timespan_deployment.speedy = true;
169 ✔
71
    bip54_sigops_deployment.bit = 7;
169 ✔
72
    bip54_sigops_deployment.flags = chain::flags::bip54_sigops_rule;
169 ✔
73
    bip54_sigops_deployment.speedy = true;
169 ✔
74
    bip54_txsize_deployment.bit = 8;
169 ✔
75
    bip54_txsize_deployment.flags = chain::flags::bip54_txsize_rule;
169 ✔
76
    bip54_txsize_deployment.speedy = true;
169 ✔
77
    bip54_coinbase_deployment.bit = 9;
169 ✔
78
    bip54_coinbase_deployment.flags = chain::flags::bip54_coinbase_rule;
169 ✔
79
    bip54_coinbase_deployment.speedy = true;
169 ✔
80

81
    forks.bip16 = true;
169 ✔
82
    forks.bip30 = true;
169 ✔
83
    forks.bip34 = true;
169 ✔
84
    forks.bip42 = true;
169 ✔
85
    forks.bip65 = true;
169 ✔
86
    forks.bip66 = true;
169 ✔
87
    forks.bip68 = true;
169 ✔
88
    forks.bip90 = true;
169 ✔
89
    forks.bip112 = true;
169 ✔
90
    forks.bip113 = true;
169 ✔
91
    forks.bip141 = true;
169 ✔
92
    forks.bip143 = true;
169 ✔
93
    forks.bip147 = true;
169 ✔
94
    forks.bip341 = true;
169 ✔
95
    forks.bip342 = true;
169 ✔
96
    forks.bip54_timewarp = true;
169 ✔
97
    forks.bip54_timespan = true;
169 ✔
98
    forks.bip54_sigops = true;
169 ✔
99
    forks.bip54_txsize = true;
169 ✔
100
    forks.bip54_coinbase = true;
169 ✔
101
    forks.retarget = true;                     // !regtest
169 ✔
102
    forks.difficult = true;                    // !testnet
169 ✔
103
    forks.time_warp_patch = false;             // testnet4
169 ✔
104
    forks.block_storm_patch = false;           // testnet4
169 ✔
105
    forks.signet = false;                      // signet
169 ✔
106
    forks.ltc_time_warp_patch = false;         // litecoin
169 ✔
107
    forks.ltc_retarget_overflow_patch = false; // litecoin
169 ✔
108
    forks.ltc_scrypt_proof_of_work = false;    // litecoin
169 ✔
109
}
169 ✔
110

111
settings::settings(chain::selection context) NOEXCEPT
166 ✔
112
  : settings()
166 ✔
113
{
114
    network = context;
166 ✔
115

116
    switch (context)
166 ✔
117
    {
118
        case chain::selection::mainnet:
143 ✔
119
        {
120
            genesis_block = chain::block
286 ✔
121
            {
122
                data_chunk
143 ✔
123
                {
124
                    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
125
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
126
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
127
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
128
                    0x00, 0x00, 0x00, 0x00, 0x3b, 0xa3, 0xed, 0xfd,
129
                    0x7a, 0x7b, 0x12, 0xb2, 0x7a, 0xc7, 0x2c, 0x3e,
130
                    0x67, 0x76, 0x8f, 0x61, 0x7f, 0xc8, 0x1b, 0xc3,
131
                    0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa,
132
                    0x4b, 0x1e, 0x5e, 0x4a, 0x29, 0xab, 0x5f, 0x49,
133
                    0xff, 0xff, 0x00, 0x1d, 0x1d, 0xac, 0x2b, 0x7c,
134
                    0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
135
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
136
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
137
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
138
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
139
                    0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, 0x1d,
140
                    0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54,
141
                    0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, 0x2f,
142
                    0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39,
143
                    0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x6c,
144
                    0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62,
145
                    0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, 0x20,
146
                    0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62,
147
                    0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, 0x66,
148
                    0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73,
149
                    0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05,
150
                    0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04,
151
                    0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27,
152
                    0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10,
153
                    0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6,
154
                    0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6,
155
                    0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4,
156
                    0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde,
157
                    0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57,
158
                    0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f,
159
                    0xac, 0x00, 0x00, 0x00, 0x00
160
                }, false
161
            };
143 ✔
162

163
            forks.bip16 = true;
143 ✔
164
            forks.bip30 = true;
143 ✔
165
            forks.bip34 = true;
143 ✔
166
            forks.bip42 = true;
143 ✔
167
            forks.bip65 = true;
143 ✔
168
            forks.bip66 = true;
143 ✔
169
            forks.bip68 = true;
143 ✔
170
            forks.bip90 = true;
143 ✔
171
            forks.bip112 = true;
143 ✔
172
            forks.bip113 = true;
143 ✔
173
            forks.bip141 = true;
143 ✔
174
            forks.bip143 = true;
143 ✔
175
            forks.bip147 = true;
143 ✔
176
            forks.bip341 = true;
143 ✔
177
            forks.bip342 = true;
143 ✔
178
            forks.bip54_timewarp = true;
143 ✔
179
            forks.bip54_timespan = true;
143 ✔
180
            forks.bip54_sigops = true;
143 ✔
181
            forks.bip54_txsize = true;
143 ✔
182
            forks.bip54_coinbase = true;
143 ✔
183
            forks.retarget = true;                     // !regtest
143 ✔
184
            forks.difficult = true;                    // !testnet
143 ✔
185
            forks.time_warp_patch = false;             // testnet4
143 ✔
186
            forks.block_storm_patch = false;           // testnet4
143 ✔
187
            forks.signet = false;                      // signet
143 ✔
188
            forks.ltc_time_warp_patch = false;         // litecoin
143 ✔
189
            forks.ltc_retarget_overflow_patch = false; // litecoin
143 ✔
190
            forks.ltc_scrypt_proof_of_work = false;    // litecoin
143 ✔
191

192
            bip16_activation_time = 0x4f779a80;
143 ✔
193
            bip34_activation_threshold = 750;
143 ✔
194
            bip34_enforcement_threshold = 950;
143 ✔
195
            bip34_activation_sample = 1000;
143 ✔
196
            bip90_bip34_height = 227931;
143 ✔
197
            bip90_bip65_height = 388381;
143 ✔
198
            bip90_bip66_height = 363725;
143 ✔
199
            bip9_activation_period = 2016;
143 ✔
200
            bip9_bit0_deployment.start = 1462060800;
143 ✔
201
            bip9_bit0_deployment.timeout = 1493596800;
143 ✔
202
            bip9_bit0_deployment.threshold = 1916;
143 ✔
203
            bip9_bit1_deployment.start = 1479168000;
143 ✔
204
            bip9_bit1_deployment.timeout = 1510704000;
143 ✔
205
            bip9_bit1_deployment.threshold = 1916;
143 ✔
206
            bip9_bit2_deployment.start = 1619222400;
143 ✔
207
            bip9_bit2_deployment.timeout = 1628640000;
143 ✔
208
            bip9_bit2_deployment.threshold = 1815;
143 ✔
209
            bip9_bit2_deployment.activation_height = 709632;
143 ✔
210
            bip9_bit2_deployment.speedy = true;
143 ✔
211
            bip9_bit0_active_checkpoint = { "000000000000000004a1b34462cb8aeebd5799177f7a29cf28f2d1961716b5b5", 419328 };
143 ✔
212
            bip9_bit1_active_checkpoint = { "0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893", 481824 };
143 ✔
213
            bip9_bit2_active_checkpoint = { "0000000000000000000687bca986194dc2c1f949318629b44bb54ec0a94d8244", 709632 };
143 ✔
214
            checkpoints =
2,002 ✔
215
            {
216
                { "00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983", 295000 },
217
                { "0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40", 279000 },
218
                { "000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214", 250000 },
219
                { "00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932", 225430 },
220
                { "00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e", 216116 },
221
                { "000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e", 210000 },
222
                { "000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317", 193000 },
223
                { "000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763", 168000 },
224
                { "00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe", 134444 },
225
                { "00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97", 105000 },
226
                { "0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20", 74000 },
227
                { "000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6", 33333 },
228
                { "0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d", 11111 }
229
            };
2,002 ✔
230
            milestone = { "000000000000000000010b93c9ea1c29fea277383f0f7d1f26de8b5802e885ff", 950000 };
143 ✔
231
            minimum_work = base16_hash("000000000000000000000000000000000000000052b2559353df4117b7348b64");
143 ✔
232
            break;
143 ✔
233
        }
234

235
        case chain::selection::testnet3:
8 ✔
236
        {
237
            genesis_block = chain::block
16 ✔
238
            {
239
                data_chunk
8 ✔
240
                {
241
                    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
242
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
243
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
244
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
245
                    0x00, 0x00, 0x00, 0x00, 0x3b, 0xa3, 0xed, 0xfd,
246
                    0x7a, 0x7b, 0x12, 0xb2, 0x7a, 0xc7, 0x2c, 0x3e,
247
                    0x67, 0x76, 0x8f, 0x61, 0x7f, 0xc8, 0x1b, 0xc3,
248
                    0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa,
249
                    0x4b, 0x1e, 0x5e, 0x4a, 0xda, 0xe5, 0x49, 0x4d,
250
                    0xff, 0xff, 0x00, 0x1d, 0x1a, 0xa4, 0xae, 0x18,
251
                    0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
252
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
253
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
254
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
255
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
256
                    0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, 0x1d,
257
                    0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54,
258
                    0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, 0x2f,
259
                    0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39,
260
                    0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x6c,
261
                    0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62,
262
                    0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, 0x20,
263
                    0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62,
264
                    0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, 0x66,
265
                    0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73,
266
                    0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05,
267
                    0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04,
268
                    0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27,
269
                    0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10,
270
                    0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6,
271
                    0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6,
272
                    0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4,
273
                    0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde,
274
                    0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57,
275
                    0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f,
276
                    0xac, 0x00, 0x00, 0x00, 0x00
277
                }, false
278
            };
8 ✔
279

280
            forks.bip16 = true;
8 ✔
281
            forks.bip30 = true;
8 ✔
282
            forks.bip34 = true;
8 ✔
283
            forks.bip42 = true;
8 ✔
284
            forks.bip65 = true;
8 ✔
285
            forks.bip66 = true;
8 ✔
286
            forks.bip68 = true;
8 ✔
287
            forks.bip90 = true;
8 ✔
288
            forks.bip112 = true;
8 ✔
289
            forks.bip113 = true;
8 ✔
290
            forks.bip141 = true;
8 ✔
291
            forks.bip143 = true;
8 ✔
292
            forks.bip147 = true;
8 ✔
293
            forks.bip341 = true;
8 ✔
294
            forks.bip342 = true;
8 ✔
295
            forks.bip54_timewarp = true;
8 ✔
296
            forks.bip54_timespan = true;
8 ✔
297
            forks.bip54_sigops = true;
8 ✔
298
            forks.bip54_txsize = true;
8 ✔
299
            forks.bip54_coinbase = true;
8 ✔
300
            forks.retarget = true;                     // !regtest
8 ✔
301
            forks.difficult = false;                   // !testnet
8 ✔
302
            forks.time_warp_patch = false;             // testnet4
8 ✔
303
            forks.block_storm_patch = false;           // testnet4
8 ✔
304
            forks.signet = false;                      // signet
8 ✔
305
            forks.ltc_time_warp_patch = false;         // litecoin
8 ✔
306
            forks.ltc_retarget_overflow_patch = false; // litecoin
8 ✔
307
            forks.ltc_scrypt_proof_of_work = false;    // litecoin
8 ✔
308

309
            bip16_activation_time = 0x4f3af580;
8 ✔
310
            bip34_activation_threshold = 51;
8 ✔
311
            bip34_enforcement_threshold = 75;
8 ✔
312
            bip34_activation_sample = 100;
8 ✔
313
            bip90_bip34_height = 21111;
8 ✔
314
            bip90_bip65_height = 581885;
8 ✔
315
            bip90_bip66_height = 330776;
8 ✔
316
            bip9_activation_period = 2016;
8 ✔
317
            bip9_bit0_deployment.start = 1456790400;
8 ✔
318
            bip9_bit0_deployment.timeout = 1493596800;
8 ✔
319
            bip9_bit0_deployment.threshold = 1512;
8 ✔
320
            bip9_bit1_deployment.start = 1462060800;
8 ✔
321
            bip9_bit1_deployment.timeout = 1493596800;
8 ✔
322
            bip9_bit1_deployment.threshold = 1512;
8 ✔
323
            bip9_bit2_deployment.start = 1619222400;
8 ✔
324
            bip9_bit2_deployment.timeout = 1628640000;
8 ✔
325
            bip9_bit2_deployment.threshold = 1512;
8 ✔
326
            bip9_bit2_deployment.speedy = true;
8 ✔
327
            bip9_bit0_active_checkpoint = { "00000000025e930139bac5c6c31a403776da130831ab85be56578f3fa75369bb", 770112 };
8 ✔
328
            bip9_bit1_active_checkpoint = { "00000000002b980fcd729daaa248fd9316a5200e9b367f4ff2c42453e84201ca", 834624 };
8 ✔
329
            bip9_bit2_active_checkpoint = { "000000000000eb906ab072652b86b05a1afeb95df53ed5c5a63aa3574e1f1b33", 2011968};
8 ✔
330
            checkpoints =
16 ✔
331
            {
332
                { "000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70", 546 }
333
            };
16 ✔
334
            milestone = { "0000000000000093bcb68c03a9a168ae252572d348a2eaeba2cdf9231d73206f", 2500000 };
8 ✔
335
            minimum_work = base16_hash("000000000000000000000000000000000000000000000b6a51f415a67c0da307");
8 ✔
336
            break;
8 ✔
337
        }
338

339
        case chain::selection::testnet4:
4 ✔
340
        {
341
            genesis_block = chain::block
8 ✔
342
            {
343
                data_chunk
4 ✔
344
                {
345
                    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
347
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
348
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349
                    0x00, 0x00, 0x00, 0x00, 0x4e, 0x7b, 0x2b, 0x91,
350
                    0x28, 0xfe, 0x02, 0x91, 0xdb, 0x06, 0x93, 0xaf,
351
                    0x2a, 0xe4, 0x18, 0xb7, 0x67, 0xe6, 0x57, 0xcd,
352
                    0x40, 0x7e, 0x80, 0xcb, 0x14, 0x34, 0x22, 0x1e,
353
                    0xae, 0xa7, 0xa0, 0x7a, 0x04, 0x6f, 0x35, 0x66,
354
                    0xff, 0xff, 0x00, 0x1d, 0xbb, 0x0c, 0x78, 0x17,
355
                    0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
356
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
357
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
358
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
359
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
360
                    0xff, 0xff, 0x55, 0x04, 0xff, 0xff, 0x00, 0x1d,
361
                    0x01, 0x04, 0x4c, 0x4c, 0x30, 0x33, 0x2f, 0x4d,
362
                    0x61, 0x79, 0x2f, 0x32, 0x30, 0x32, 0x34, 0x20,
363
                    0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
364
                    0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
365
                    0x30, 0x30, 0x30, 0x30, 0x31, 0x65, 0x62, 0x64,
366
                    0x35, 0x38, 0x63, 0x32, 0x34, 0x34, 0x39, 0x37,
367
                    0x30, 0x62, 0x33, 0x61, 0x61, 0x39, 0x64, 0x37,
368
                    0x38, 0x33, 0x62, 0x62, 0x30, 0x30, 0x31, 0x30,
369
                    0x31, 0x31, 0x66, 0x62, 0x65, 0x38, 0x65, 0x61,
370
                    0x38, 0x65, 0x39, 0x38, 0x65, 0x30, 0x30, 0x65,
371
                    0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05,
372
                    0x2a, 0x01, 0x00, 0x00, 0x00, 0x23, 0x21, 0x00,
373
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377
                    0xac, 0x00, 0x00, 0x00, 0x00
378
                }, false
379
            };
4 ✔
380

381
            forks.bip16 = true;
4 ✔
382
            forks.bip30 = true;
4 ✔
383
            forks.bip34 = true;
4 ✔
384
            forks.bip42 = true;
4 ✔
385
            forks.bip65 = true;
4 ✔
386
            forks.bip66 = true;
4 ✔
387
            forks.bip68 = true;
4 ✔
388
            forks.bip90 = true;
4 ✔
389
            forks.bip112 = true;
4 ✔
390
            forks.bip113 = true;
4 ✔
391
            forks.bip141 = true;
4 ✔
392
            forks.bip143 = true;
4 ✔
393
            forks.bip147 = true;
4 ✔
394
            forks.bip341 = true;
4 ✔
395
            forks.bip342 = true;
4 ✔
396
            forks.bip54_timewarp = true;
4 ✔
397
            forks.bip54_timespan = true;
4 ✔
398
            forks.bip54_sigops = true;
4 ✔
399
            forks.bip54_txsize = true;
4 ✔
400
            forks.bip54_coinbase = true;
4 ✔
401
            forks.retarget = true;                     // !regtest
4 ✔
402
            forks.difficult = false;                   // !testnet
4 ✔
403
            forks.time_warp_patch = true;              // testnet4
4 ✔
404
            forks.block_storm_patch = true;            // testnet4
4 ✔
405
            forks.signet = false;                      // signet
4 ✔
406
            forks.ltc_time_warp_patch = false;         // litecoin
4 ✔
407
            forks.ltc_retarget_overflow_patch = false; // litecoin
4 ✔
408
            forks.ltc_scrypt_proof_of_work = false;    // litecoin
4 ✔
409

410
            bip16_activation_time = 1329264000;
4 ✔
411
            bip34_activation_threshold = 51;
4 ✔
412
            bip34_enforcement_threshold = 75;
4 ✔
413
            bip34_activation_sample = 100;
4 ✔
414
            bip90_bip34_height = 1;
4 ✔
415
            bip90_bip65_height = 1;
4 ✔
416
            bip90_bip66_height = 1;
4 ✔
417
            bip9_bit0_active_checkpoint = { "0000000012982b6d5f621229286b880e909984df669c2afabb102ce311b13f28", 1 };
4 ✔
418
            bip9_bit1_active_checkpoint = { "0000000012982b6d5f621229286b880e909984df669c2afabb102ce311b13f28", 1 };
4 ✔
419
            bip9_bit2_active_checkpoint = { "0000000012982b6d5f621229286b880e909984df669c2afabb102ce311b13f28", 1};
4 ✔
420
            checkpoints =
8 ✔
421
            {
422
                { "00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043", 0 }
423
            };
8 ✔
424
            milestone = { "0000000002368b1e4ee27e2e85676ae6f9f9e69579b29093e9a82c170bf7cf8a", 123613 };
4 ✔
425
            minimum_work = base16_hash("000000000000000000000000000000000000000000000b6a51f415a67c0da307");
4 ✔
426
            break;
4 ✔
427
        }
428

429
        case chain::selection::regtest:
10 ✔
430
        {
431
            proof_of_work_limit = 0x207fffff;
10 ✔
432
            subsidy_interval_blocks = 150;
10 ✔
433
            retargeting_interval_seconds = 24 * 60 * 60;
10 ✔
434
            genesis_block = chain::block
20 ✔
435
            {
436
                data_chunk
10 ✔
437
                {
438
                    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
439
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
440
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
441
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
442
                    0x00, 0x00, 0x00, 0x00, 0x3b, 0xa3, 0xed, 0xfd,
443
                    0x7a, 0x7b, 0x12, 0xb2, 0x7a, 0xc7, 0x2c, 0x3e,
444
                    0x67, 0x76, 0x8f, 0x61, 0x7f, 0xc8, 0x1b, 0xc3,
445
                    0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa,
446
                    0x4b, 0x1e, 0x5e, 0x4a, 0xda, 0xe5, 0x49, 0x4d,
447
                    0xff, 0xff, 0x7f, 0x20, 0x02, 0x00, 0x00, 0x00,
448
                    0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
449
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
450
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
451
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
452
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
453
                    0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, 0x1d,
454
                    0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54,
455
                    0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, 0x2f,
456
                    0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39,
457
                    0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x6c,
458
                    0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62,
459
                    0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, 0x20,
460
                    0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62,
461
                    0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, 0x66,
462
                    0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73,
463
                    0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05,
464
                    0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04,
465
                    0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27,
466
                    0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10,
467
                    0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6,
468
                    0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6,
469
                    0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4,
470
                    0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde,
471
                    0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57,
472
                    0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f,
473
                    0xac, 0x00, 0x00, 0x00, 0x00
474
                }, false
475
            };
10 ✔
476

477
            forks.bip16 = true;
10 ✔
478
            forks.bip30 = true;
10 ✔
479
            forks.bip34 = true;
10 ✔
480
            forks.bip42 = true;
10 ✔
481
            forks.bip65 = true;
10 ✔
482
            forks.bip66 = true;
10 ✔
483
            forks.bip68 = true;
10 ✔
484
            forks.bip90 = true;
10 ✔
485
            forks.bip112 = true;
10 ✔
486
            forks.bip113 = true;
10 ✔
487
            forks.bip141 = true;
10 ✔
488
            forks.bip143 = true;
10 ✔
489
            forks.bip147 = true;
10 ✔
490
            forks.bip341 = true;
10 ✔
491
            forks.bip342 = true;
10 ✔
492
            forks.bip54_timewarp = true;
10 ✔
493
            forks.bip54_timespan = true;
10 ✔
494
            forks.bip54_sigops = true;
10 ✔
495
            forks.bip54_txsize = true;
10 ✔
496
            forks.bip54_coinbase = true;
10 ✔
497
            forks.retarget = false;                    // !regtest
10 ✔
498
            forks.difficult = true;                    // !testnet
10 ✔
499
            forks.time_warp_patch = false;             // testnet4
10 ✔
500
            forks.block_storm_patch = false;           // testnet4
10 ✔
501
            forks.signet = false;                      // signet
10 ✔
502
            forks.ltc_time_warp_patch = false;         // litecoin
10 ✔
503
            forks.ltc_retarget_overflow_patch = false; // litecoin
10 ✔
504
            forks.ltc_scrypt_proof_of_work = false;    // litecoin
10 ✔
505

506
            bip16_activation_time = 0x4f3af580;
10 ✔
507
            bip34_activation_threshold = 0;
10 ✔
508
            bip34_enforcement_threshold = 0;
10 ✔
509
            bip34_activation_sample = 0;
10 ✔
510
            bip90_bip34_height = 100000000;
10 ✔
511
            bip90_bip65_height = 1351;
10 ✔
512
            bip90_bip66_height = 1251;
10 ✔
513

514
            // bip9's are fixed and closed, so assume genesis activation.
515
            // bip90 assumes a historical bip34 activation block, so use genesis.
516
            bip9_bit0_active_checkpoint = { "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206", 0 };
10 ✔
517
            bip9_bit1_active_checkpoint = { "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206", 0 };
10 ✔
518
            bip9_bit2_active_checkpoint = { "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206", 0 };
10 ✔
519
            bip54_timewarp_deployment.start = chain::chain_state::deployment::always_active;
10 ✔
520
            bip54_timespan_deployment.start = chain::chain_state::deployment::always_active;
10 ✔
521
            bip54_sigops_deployment.start = chain::chain_state::deployment::always_active;
10 ✔
522
            bip54_txsize_deployment.start = chain::chain_state::deployment::always_active;
10 ✔
523
            bip54_coinbase_deployment.start = chain::chain_state::deployment::always_active;
10 ✔
524
            checkpoints = {};
10 ✔
525
            milestone = { "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206", 0 };
10 ✔
526
            minimum_work = base16_hash("0000000000000000000000000000000000000000000000000000000000000000");
10 ✔
527
            break;
10 ✔
528
        }
529

530
        case chain::selection::signet:
1 ✔
531
        {
532
            proof_of_work_limit = 0x1e0377ae;
1 ✔
533
            genesis_block = chain::block
2 ✔
534
            {
535
                data_chunk
1 ✔
536
                {
537
                    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
538
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
539
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
540
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
541
                    0x00, 0x00, 0x00, 0x00, 0x3b, 0xa3, 0xed, 0xfd,
542
                    0x7a, 0x7b, 0x12, 0xb2, 0x7a, 0xc7, 0x2c, 0x3e,
543
                    0x67, 0x76, 0x8f, 0x61, 0x7f, 0xc8, 0x1b, 0xc3,
544
                    0x88, 0x8a, 0x51, 0x32, 0x3a, 0x9f, 0xb8, 0xaa,
545
                    0x4b, 0x1e, 0x5e, 0x4a, 0x00, 0x8f, 0x4d, 0x5f,
546
                    0xae, 0x77, 0x03, 0x1e, 0x8a, 0xd2, 0x22, 0x03,
547
                    0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
548
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
549
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
550
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
551
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
552
                    0xff, 0xff, 0x4d, 0x04, 0xff, 0xff, 0x00, 0x1d,
553
                    0x01, 0x04, 0x45, 0x54, 0x68, 0x65, 0x20, 0x54,
554
                    0x69, 0x6d, 0x65, 0x73, 0x20, 0x30, 0x33, 0x2f,
555
                    0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x30, 0x39,
556
                    0x20, 0x43, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x6c,
557
                    0x6c, 0x6f, 0x72, 0x20, 0x6f, 0x6e, 0x20, 0x62,
558
                    0x72, 0x69, 0x6e, 0x6b, 0x20, 0x6f, 0x66, 0x20,
559
                    0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20, 0x62,
560
                    0x61, 0x69, 0x6c, 0x6f, 0x75, 0x74, 0x20, 0x66,
561
                    0x6f, 0x72, 0x20, 0x62, 0x61, 0x6e, 0x6b, 0x73,
562
                    0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, 0x05,
563
                    0x2a, 0x01, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04,
564
                    0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27,
565
                    0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7, 0x10,
566
                    0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6,
567
                    0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde, 0xb6,
568
                    0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4,
569
                    0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12, 0xde,
570
                    0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57,
571
                    0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d, 0x5f,
572
                    0xac, 0x00, 0x00, 0x00, 0x00
573
                }, false
574
            };
1 ✔
575

576
            forks.bip16 = true;
1 ✔
577
            forks.bip30 = true;
1 ✔
578
            forks.bip34 = true;
1 ✔
579
            forks.bip42 = true;
1 ✔
580
            forks.bip65 = true;
1 ✔
581
            forks.bip66 = true;
1 ✔
582
            forks.bip68 = true;
1 ✔
583
            forks.bip90 = true;
1 ✔
584
            forks.bip112 = true;
1 ✔
585
            forks.bip113 = true;
1 ✔
586
            forks.bip141 = true;
1 ✔
587
            forks.bip143 = true;
1 ✔
588
            forks.bip147 = true;
1 ✔
589
            forks.bip341 = true;
1 ✔
590
            forks.bip342 = true;
1 ✔
591
            forks.bip54_timewarp = true;
1 ✔
592
            forks.bip54_timespan = true;
1 ✔
593
            forks.bip54_sigops = true;
1 ✔
594
            forks.bip54_txsize = true;
1 ✔
595
            forks.bip54_coinbase = true;
1 ✔
596
            forks.retarget = true;                     // !regtest
1 ✔
597
            forks.difficult = true;                    // !testnet
1 ✔
598
            forks.time_warp_patch = false;             // testnet4
1 ✔
599
            forks.block_storm_patch = false;           // testnet4
1 ✔
600
            forks.signet = true;                       // signet
1 ✔
601
            forks.ltc_time_warp_patch = false;         // litecoin
1 ✔
602
            forks.ltc_retarget_overflow_patch = false; // litecoin
1 ✔
603
            forks.ltc_scrypt_proof_of_work = false;    // litecoin
1 ✔
604

605
            bip16_activation_time = 1329264000;
1 ✔
606
            bip34_activation_threshold = 51;
1 ✔
607
            bip34_enforcement_threshold = 75;
1 ✔
608
            bip34_activation_sample = 100;
1 ✔
609
            bip90_bip34_height = 1;
1 ✔
610
            bip90_bip65_height = 1;
1 ✔
611
            bip90_bip66_height = 1;
1 ✔
612
            bip9_bit0_active_checkpoint = { "00000086d6b2636cb2a392d45edc4ec544a10024d30141c9adf4bfd9de533b53", 1 };
1 ✔
613
            bip9_bit1_active_checkpoint = { "00000086d6b2636cb2a392d45edc4ec544a10024d30141c9adf4bfd9de533b53", 1 };
1 ✔
614
            bip9_bit2_active_checkpoint = { "00000086d6b2636cb2a392d45edc4ec544a10024d30141c9adf4bfd9de533b53", 1 };
1 ✔
615
            checkpoints =
2 ✔
616
            {
617
                { "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6", 0 }
618
            };
2 ✔
619
            milestone = { "00000002a5e0ba0498f1e9f4591af0b66b63c654665efe65206fd0ae7bbaf923", 321295 };
1 ✔
620
            minimum_work = base16_hash("00000000000000000000000000000000000000000000000000001090e9dc1520");
1 ✔
621
            signet_challenge = base16_chunk("512103ad5e0edad18cb1f0fc0d28a3d4f1f3e445640337489abb10404f2d1e086be430210359ef5021964fe22d6f8e05b2463c9540ce96883fe3b278760f048f5189f2e6c452ae");
1 ✔
622
            break;
1 ✔
623
        }
624

625
        default:
166 ✔
626
        case chain::selection::none:
627
        {
628
        }
629
    }
630
}
322 ✔
631

632
// Computed properties.
633
// ----------------------------------------------------------------------------
634
// These are not used internal to system.
635

636
// The exact maximum amount of money (as of bip42).
637
//*****************************************************************************
638
// CONSENSUS: This assumes bip42 as otherwise money supply is unbounded.
639
//*****************************************************************************
640
//*****************************************************************************
641
// CONSENSUS: The satoshi client uses a "sanity check" value that is
642
// effectively based on a round but incorrect value of recursive_money,
643
// which is higher than this true value. Despite comments to the contrary
644
// in the satoshi code, the value could not be consensus critical unless it was
645
// *less* than the true value. This is non a consensus-critical method, as the
646
// consensus limit on money is stricly a function of subsidy recursion and
647
// overspend constraints.
648
//*****************************************************************************
649
uint64_t settings::max_money() const NOEXCEPT
17 ✔
650
{
651
    std::function<uint64_t(uint64_t)> total = [&](uint64_t subsidy) NOEXCEPT
17 ✔
652
    {
653
        // Guarded by parameterization (config).
654
        BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
655
        return is_zero(subsidy) ? 0 : safe_add(subsidy, total(subsidy >> 1));
579 ✔
656
        BC_POP_WARNING()
657
    };
658

659
    // Guarded by parameterization (config).
660
    BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
661
    return safe_multiply<uint64_t>(total(initial_subsidy()),
17 ✔
662
        subsidy_interval_blocks);
34 ✔
663
    BC_POP_WARNING()
664
}
665

666
// The initial block subsidy in satoshis.
667
uint64_t settings::initial_subsidy() const NOEXCEPT
23 ✔
668
{
669
    return bitcoin_to_satoshi(initial_subsidy_bitcoin);
23 ✔
670
}
671

672
// Used to initialize initial subsidy setting.
673
uint64_t settings::bitcoin_to_satoshi(uint64_t value) const NOEXCEPT
30 ✔
674
{
675
    // Guarded by parameterization (config).
676
    BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
677
    return safe_multiply(value, chain::satoshi_per_bitcoin);
30 ✔
678
    BC_POP_WARNING()
679
}
680

UNCOV
681
uint32_t settings::flags() const NOEXCEPT
×
682
{
UNCOV
683
    return chain::chain_state::configured_flags(forks);
×
684
}
685

686
// Computed properties.
687
// ----------------------------------------------------------------------------
688
// These are used by node.
689

690
chain::checkpoints settings::sorted_checkpoints() const NOEXCEPT
8 ✔
691
{
692
    return sort_copy(checkpoints);
8 ✔
693
}
694

695
chain::checkpoint settings::top_checkpoint() const NOEXCEPT
2 ✔
696
{
697
    if (checkpoints.empty())
2 ✔
698
        return { genesis_block.hash(), zero };
1 ✔
699

700
    return sorted_checkpoints().back();
1 ✔
701
}
702

703
// Computed properties.
704
// ----------------------------------------------------------------------------
705
// These are used internal to system.
706

707
// The lower bound for the retargeting timespan.
708
uint32_t settings::minimum_timespan() const NOEXCEPT
29 ✔
709
{
710
    // TODO: optimize to prevent recomputation.
711
    return chain::chain_state::minimum_timespan(retargeting_interval_seconds,
29 ✔
712
        retargeting_factor);
29 ✔
713
}
714

715
// The upper bound for the retargeting timespan.
716
uint32_t settings::maximum_timespan() const NOEXCEPT
29 ✔
717
{
718
    // TODO: optimize to prevent recomputation.
719
    return chain::chain_state::maximum_timespan(retargeting_interval_seconds,
29 ✔
720
        retargeting_factor);
29 ✔
721
}
722

723
// The target number of blocks for 2 weeks of work (2016 blocks).
724
uint32_t settings::retargeting_interval() const NOEXCEPT
148 ✔
725
{
726
    // TODO: optimize to prevent recomputation.
727
    return chain::chain_state::retargeting_interval(
728
        retargeting_interval_seconds, block_spacing_seconds);
148 ✔
729
}
730

731
} // namespace system
732
} // namespace libbitcoin
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc