Commit 308dd2e
Sanity assert GetAncestor() != nullptr where appropriate
Add sanity asserts for return value of `CBlockIndex::GetAncestor()` where appropriate.
In validation.cpp `CheckSequenceLocks`, check the return value of `tip->GetAncestor(maxInputHeight)` stored into `lp->maxInputBlock`. If it ever returns `nullptr` because the ancestor isn't found, it's going to be a bad bug to keep going, since a `LockPoints` object with the `maxInputBlock` member set to `nullptr` signifies no relative lock time.
In the other places, the added asserts would prevent accidental dereferencing of a null pointer which is undefined behavior.
Co-Authored-By: Aurèle Oulès <[email protected]>
Co-Authored-By: danra <[email protected]>1 parent b1c5991 commit 308dd2e
File tree
5 files changed
+39
-28
lines changed- src
- consensus
- rpc
- test
5 files changed
+39
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | | - | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1618 | 1618 | | |
1619 | 1619 | | |
1620 | 1620 | | |
1621 | | - | |
1622 | | - | |
1623 | | - | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
1624 | 1624 | | |
1625 | 1625 | | |
1626 | 1626 | | |
| |||
1761 | 1761 | | |
1762 | 1762 | | |
1763 | 1763 | | |
1764 | | - | |
1765 | | - | |
| 1764 | + | |
1766 | 1765 | | |
1767 | 1766 | | |
1768 | 1767 | | |
| |||
1773 | 1772 | | |
1774 | 1773 | | |
1775 | 1774 | | |
1776 | | - | |
1777 | | - | |
| 1775 | + | |
| 1776 | + | |
1778 | 1777 | | |
1779 | 1778 | | |
1780 | 1779 | | |
| |||
1892 | 1891 | | |
1893 | 1892 | | |
1894 | 1893 | | |
1895 | | - | |
| 1894 | + | |
1896 | 1895 | | |
1897 | | - | |
| 1896 | + | |
1898 | 1897 | | |
1899 | 1898 | | |
1900 | 1899 | | |
1901 | 1900 | | |
1902 | 1901 | | |
1903 | | - | |
| 1902 | + | |
1904 | 1903 | | |
1905 | 1904 | | |
1906 | 1905 | | |
1907 | 1906 | | |
1908 | 1907 | | |
1909 | | - | |
| 1908 | + | |
1910 | 1909 | | |
1911 | 1910 | | |
1912 | 1911 | | |
1913 | | - | |
| 1912 | + | |
1914 | 1913 | | |
1915 | 1914 | | |
1916 | 1915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
450 | | - | |
451 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
| 454 | + | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
458 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
459 | 461 | | |
460 | 462 | | |
461 | 463 | | |
| |||
500 | 502 | | |
501 | 503 | | |
502 | 504 | | |
503 | | - | |
504 | | - | |
505 | | - | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
506 | 510 | | |
507 | 511 | | |
508 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
250 | 255 | | |
251 | 256 | | |
252 | 257 | | |
| |||
4077 | 4082 | | |
4078 | 4083 | | |
4079 | 4084 | | |
4080 | | - | |
4081 | | - | |
| 4085 | + | |
| 4086 | + | |
| 4087 | + | |
4082 | 4088 | | |
4083 | | - | |
| 4089 | + | |
4084 | 4090 | | |
4085 | 4091 | | |
4086 | 4092 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
161 | | - | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
0 commit comments