@ryanofsky That sounds good to me! I am not sure how to access the interfaces::Wallet instance from rpcwallet.cpp though. It seems like it only has access to CWallet (while the QT side only has access to interfaces::Wallet).
rpcwallet.cpp shouldn’t need to access interfaces::Wallet here (and in general) because interfaces::Wallet doesn’t contain any real functionality, it’s just a high level wrapper around selected wallet functions that GUI code uses to indirectly control wallets.
So the idea is just to implement a standalone function in wallet code:
0bool SignMessage(CWallet& wallet, message, options...)
and to call this function both from wallet/rpcwallet.cpp and interfaces/wallet.cpp (just adding a one-line WalletImpl::signMessage() wrapper method in the interface code).
Is the idea to add two signmessage functions, where the interface one simply calls down into m_wallet->SignMessage(..)?
Sorry! Just realized I had a typo in #16440 (review), which is fixed now but was probably pretty confusing. I was trying to suggest not having a CWallet::SignMesage(...) method, but instead defining a standalone SignMessage(CWallet&, ...) function. Really either a method or a standalone function would be fine, but the function seemed better because we’re gradually breaking CWallet up and pulling functionality out of it, so adding new functionality there without a reason seemed to be moving in wrong direction.