diff options
author | MacroFake <falke.marco@gmail.com> | 2022-05-06 11:46:10 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-05-06 11:46:20 +0200 |
commit | 59ac8bacd573891d84e8ab96ff43ea12bd266f26 (patch) | |
tree | 4e8cbf8d93eb1c36bf5695fce62ea0a7c474cc86 /CONTRIBUTING.md | |
parent | 77a9997d97f922c1fe286e8e5e0a2f072e0a59be (diff) | |
parent | 308dd2e93e92f4cac4e7d75478316af9bb2b77b8 (diff) |
Merge bitcoin/bitcoin#24804: Sanity assert GetAncestor() != nullptr where appropriate
308dd2e93e92f4cac4e7d75478316af9bb2b77b8 Sanity assert GetAncestor() != nullptr where appropriate (Adam Jonas)
Pull request description:
Re-opening #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 <jonas@chaincode.com>
Co-Authored-By: danra <danra@users.noreply.github.com>
ACKs for top commit:
jonatack:
ACK 308dd2e93e92f4cac4e7d75478316af9bb2b77b8
Tree-SHA512: 5bfdaab1499607ae2c3cd3e2e9e8c37850bfd0e327e680f4e36c81f9c6d98a543af78ecfac1ab0e06325d264412615a04d52005875780c7db2a4d81bd2d2259a
Diffstat (limited to 'CONTRIBUTING.md')
0 files changed, 0 insertions, 0 deletions