Commit e2fc94f
authored
performance: reduce PoW checks on blockindex load (#36)
* performance: reduce PoW checks on blockindex load
When the blockindex is constructed from disk on startup, currently
each header is subjected to a PoW check. This is relatively cheap
for Bitcoin's SHA256D, but less optimal when having to perform
FactorN's ghash function.
This changes the frequency at which the PoW check is performed to
be configurable with the startup argument idxpowcheckrate,
specifying a denominator at which PoW is checked during initial
blockindex construction when the node starts, and sets the default
value to 100 - meaning 1 in 100 blockheaders that are loaded from
disk will be selected randomly to undergo a PoW check.
More paranoid node operators can lower the value, at the cost of
startup performance.
Note: All leveldb records that are read by the iterator are still
subjected to internal integrity checks.
* lint: allow -idxpowcheckrate to be undocumented for now1 parent 896a16b commit e2fc94f
4 files changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
280 | 287 | | |
281 | 288 | | |
282 | 289 | | |
| |||
301 | 308 | | |
302 | 309 | | |
303 | 310 | | |
304 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
305 | 315 | | |
| 316 | + | |
306 | 317 | | |
307 | 318 | | |
308 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments