This relates to PR #23602.
rpcwallet is the file that takes longest to compile, especially with sanitizers enabled it can take several 10s of seconds.
Allow faster incremental and parallel builds by starting to split it up. First, split off signmessage, which is unrelated to other stuff such as wallet file handling, wallet encryption, tx creation, or wallet status/info.
That PR moves signmessage and the send* RPCs to separate files in wallet/rpc/. I suggest we go even further with this split and do something like the following:
-
Move(Done in #23647).wallet/rpcdump.cpp => wallet/rpc/backup.cppand combine withbackupwalletandrestorewalletRPCs. -
Introduce(Done in #23640).wallet/rpc/util.cppand move the helper functions there, likeGetWalletForJSONRPCRequestandEnsureWalletIsUnlocked, etc. - Introduce
wallet/rpc/addresses.cppand movegetnewaddress,getrawchangeaddress,setlabel,listaddressgroupings,addmultisigaddress,keypoolrefill,newkeypool,getaddressinfo,getaddressesbylabel,listlabels, andwalletdisplayaddressthere. - Introduce
wallet/rpc/transactions.cppand movelistreceivedbyaddress,listreceivedbylabel,listtransactions,listsinceblock,gettransaction,abandontransaction, andrescanblockchainthere. - Introduce
wallet/rpc/utxos.cppand movegetreceivedbyaddress,getreceivedbylabel,getbalance,getunconfirmedbalance,lockunspent,listlockunspent,getbalances, andlistunspentthere. -
Move the(Done in #23647).walletpassphrase,walletpassphrasechange,walletlock, andencryptwalletRPCs towallet/rpc/encrypt.cpp. - Move the spending / signing / transaction-creation RPCs to wallet/rpc/spend.cpp.
- This would leave rpcwallet.cpp with only the
getwalletinfo,listwalletdir,listwallets,loadwallet,setwalletflag,createwallet,unloadwallet,sethdseed, andupgradewalletRPCs, which are the “core” wallet management RPCs, so it makes sense. It could be moved to thewallet/rpc/directory though under a different name.
Obviously this would be a lot of movement, so it would be good to get thoughts on it first.
I’ll open PRs in stages for this if there is agreement to proceed.