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.cpp
and combine withbackupwallet
andrestorewallet
RPCs. -
Introduce(Done in #23640).wallet/rpc/util.cpp
and move the helper functions there, likeGetWalletForJSONRPCRequest
andEnsureWalletIsUnlocked
, etc. - Introduce
wallet/rpc/addresses.cpp
and movegetnewaddress
,getrawchangeaddress
,setlabel
,listaddressgroupings
,addmultisigaddress
,keypoolrefill
,newkeypool
,getaddressinfo
,getaddressesbylabel
,listlabels
, andwalletdisplayaddress
there. - Introduce
wallet/rpc/transactions.cpp
and movelistreceivedbyaddress
,listreceivedbylabel
,listtransactions
,listsinceblock
,gettransaction
,abandontransaction
, andrescanblockchain
there. - Introduce
wallet/rpc/utxos.cpp
and movegetreceivedbyaddress
,getreceivedbylabel
,getbalance
,getunconfirmedbalance
,lockunspent
,listlockunspent
,getbalances
, andlistunspent
there. -
Move the(Done in #23647).walletpassphrase
,walletpassphrasechange
,walletlock
, andencryptwallet
RPCs 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
, andupgradewallet
RPCs, 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.