Commit d90308b
committed
Add code to force coverage
The RandomOrphan function and the function ecdsa_signature_parse_der_lax
in pubkey.cpp were causing non-deterministic test coverage.
In the former, if a random orphan was selected the index of which is bigger
than the max. orphan index in mapOrphanTransactions, the last orphan was
returned from RandomOrphan. If the random number generated was never large
enough, this condition would not be fulfilled and the corresponding
branch wouldn't run. The proposed solution is to force one of the 50
dependant orphans to depend on the last orphan in mapOrphanTransactions
using the newly introduced function OrphanByIndex
(and passing it a large uint256), forcing this branch to always run
at least once.
In the latter, if values for ECDSA R or S (or both) had no leading
zeros, some code would not be executed. The solution was to find a
constant value for the public key and a corresponding signature that would
be comprised of R and S values with leading zeros and calling
CPubKey::Verify at the end of the test forcing this code to always run
at least once at the end even if it hadn't throughout the test.
Removed denialofservice_tests test entry from the list of non-deterministic
tests in the coverage script.1 parent 195822f commit d90308b
File tree
2 files changed
+40
-4
lines changed- contrib/devtools
- src/test
2 files changed
+40
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
356 | 358 | | |
357 | 359 | | |
358 | 360 | | |
359 | | - | |
| 361 | + | |
360 | 362 | | |
361 | 363 | | |
362 | 364 | | |
363 | | - | |
| 365 | + | |
364 | 366 | | |
365 | 367 | | |
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
369 | 397 | | |
370 | 398 | | |
371 | 399 | | |
| |||
391 | 419 | | |
392 | 420 | | |
393 | 421 | | |
394 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
395 | 430 | | |
396 | 431 | | |
397 | 432 | | |
| |||
445 | 480 | | |
446 | 481 | | |
447 | 482 | | |
| 483 | + | |
| 484 | + | |
448 | 485 | | |
449 | 486 | | |
450 | 487 | | |
0 commit comments