[backport#17381 1/5] Add EnsureLegacyScriptPubKeyMan and use in rpcwallet.cpp
Summary:
This also fixes unused variable warnings in rpcdump.cpp
https://github.com/bitcoin/bitcoin/pull/17381/commits/b07b07cd8779355ba1dd16e7eb4af42e0ae1c587
Partial backport of Core PR17381
Test Plan:
ninja check check-functional
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D7416