Commit 59ac8ba
MacroFake
Merge bitcoin#24804: Sanity assert GetAncestor() != nullptr where appropriate
308dd2e Sanity assert GetAncestor() != nullptr where appropriate (Adam Jonas)
Pull request description:
Re-opening bitcoin#17232. I have rebased the PR and addressed jonatack's nit suggestions.
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: Adam Jonas <[email protected]>
Co-Authored-By: danra <[email protected]>
ACKs for top commit:
jonatack:
ACK 308dd2e
Tree-SHA512: 5bfdaab1499607ae2c3cd3e2e9e8c37850bfd0e327e680f4e36c81f9c6d98a543af78ecfac1ab0e06325d264412615a04d52005875780c7db2a4d81bd2d2259aFile 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 | |
|---|---|---|---|
| |||
1613 | 1613 | | |
1614 | 1614 | | |
1615 | 1615 | | |
1616 | | - | |
1617 | | - | |
1618 | | - | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
1619 | 1619 | | |
1620 | 1620 | | |
1621 | 1621 | | |
| |||
1756 | 1756 | | |
1757 | 1757 | | |
1758 | 1758 | | |
1759 | | - | |
1760 | | - | |
| 1759 | + | |
1761 | 1760 | | |
1762 | 1761 | | |
1763 | 1762 | | |
| |||
1768 | 1767 | | |
1769 | 1768 | | |
1770 | 1769 | | |
1771 | | - | |
1772 | | - | |
| 1770 | + | |
| 1771 | + | |
1773 | 1772 | | |
1774 | 1773 | | |
1775 | 1774 | | |
| |||
1887 | 1886 | | |
1888 | 1887 | | |
1889 | 1888 | | |
1890 | | - | |
| 1889 | + | |
1891 | 1890 | | |
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 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
409 | | - | |
410 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
| 413 | + | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
417 | | - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
418 | 420 | | |
419 | 421 | | |
420 | 422 | | |
| |||
459 | 461 | | |
460 | 462 | | |
461 | 463 | | |
462 | | - | |
463 | | - | |
464 | | - | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
465 | 469 | | |
466 | 470 | | |
467 | 471 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
| |||
4108 | 4113 | | |
4109 | 4114 | | |
4110 | 4115 | | |
4111 | | - | |
4112 | | - | |
| 4116 | + | |
| 4117 | + | |
| 4118 | + | |
4113 | 4119 | | |
4114 | | - | |
| 4120 | + | |
4115 | 4121 | | |
4116 | 4122 | | |
4117 | 4123 | | |
| |||
| 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