refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform
Summary: This is a partial backport of Core PR13743 : https://github.com/bitcoin/bitcoin/pull/13743/commits/2196c51821e340c9a9d2c76c30f9402370f84994
Test Plan:
make check
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D4132