[backport#15842] refactor: replace isPotentialtip/waitForNotifications by higher method
Summary:
Add GUARDED_BY(cs_wallet) annotation to m_last_block_processed, given
that its now guarded by cs_wallet instead of cs_main
https://github.com/bitcoin/bitcoin/pull/15842/commits/422677963a7b41e340b911b4cd53d29dd8d63f21
Add WITH_LOCK macro: run code while locking a mutex
Results from ryanofksy suggestion on isPotentialTip/
waitForNotifications refactoring
https://github.com/bitcoin/bitcoin/pull/15842/commits/edfe9438ca54274815f076fc21beb790df5aa0a2
Depends on D6258
Backport of Core PR15842
Test Plan:
ninja check-all
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D6260