This fix is a based on the fix by Antoine Riard <ariard@student.42.fr> in
https://github.com/bitcoin/bitcoin/pull/18600.Unlike that PR, which implements some new behavior, this just restores previous
wallet notification and status behavior for transactions removed from the
mempool because they conflict with transactions in a block. The behavior was
accidentally changed in two CWallet::BlockConnected updates:
a31be09bfd77eed497a8e251d31358e16e2f2eb1 and
7e89994133725125dddbfa8d45484e3b9ed51c6e from
https://github.com/bitcoin/bitcoin/pull/16624, causing issue
https://github.com/bitcoin/bitcoin/issues/18325.The change here could be improved and replaced with a more comprehensive
cleanup, so it includes a detailed comment explaining future considerations.Co-authored-by: Antoine Riard <ariard@student.42.fr>
This is a backport of core#18982 [1/2]
https://github.com/bitcoin/bitcoin/pull/18982/commits/b604c5c8b5892842f13dee89ae31812a28ab25d1
Backport note: The test is already included in D9972, because it seemed to work without this fix. But now we have seen intermittent CI failures.