refactor: Add and use EnsureConnman in rpc code
Summary:
This concludes backport of core#21719
https://github.com/bitcoin/bitcoin/pull/21719/commits/fafb68add5e16e8bd5b9428bcffcaee2639747cf
Depends on D12699
Note: in D7990, in getnodeaddresses and setnetworkactive, the if (!node.connman) test were replaced by if (!node.banman). As far as I can tell, this is a mistake, so I reverted to the if (!node.connman) solution to stay closer to the source material and remove 2 more blocks of boilerplate code. I don't think this matters anyway, as both the connman and the banman are always unconditionally created in AppInitMain, so I don't see how either one of them can be unavailable in the context of a RPC call.
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D12700