[backport#13657] wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity
Summary:
93de2891fa9cb8314573ba3a6ab764bc9c52444d wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity (Ben Woosley)
Pull request description:
According to my understanding, it should not be possible for coinbase transactions to be conflicting, thus it should not be possible for GetDepthInMainChain to return a negative result. If it did, this would also result in innacurate results for GetBlocksToMaturity due to the math therein. asserting ensures accuracy.
https://github.com/bitcoin/bitcoin/pull/13657/commits/93de2891fa9cb8314573ba3a6ab764bc9c52444d
Backport of Core PR13657
Test Plan:
ninja check check-functional
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D7026