This PR replaces raw pointers in rpcwallet.cpp
and rpcdump.cpp
with shared_ptr. The motivation for this PR is described here #18590
The currently available unit and functional tests complete without errors.
It seems that this PR is indirectly related to this issue: #13063 (review)
Notice: I have deliberately not changed the class WalletRescanReserver
whose constructor expects a raw pointer, because it’s external and affects other areas, which I didn’t touch to avoid making this PR “viral”.