Each of the following RPC functions
- importprivkey
- importaddress
- importpubkey
- importwallet
- importmulti
define a variable reference LegacyScriptPubKeyMan& spk_man which is not used, leading to compiler warnings in the current master branch (bdda137878904e9401a84e308ac74c93c2ef87c1):
CXX wallet/libbitcoin_wallet_a-rpcdump.o
wallet/rpcdump.cpp:137:28: warning: unused variable 'spk_man' [-Wunused-variable]
LegacyScriptPubKeyMan& spk_man = GetLegacyScriptPubKeyMan(*wallet);
^
wallet/rpcdump.cpp:265:28: warning: unused variable 'spk_man' [-Wunused-variable]
LegacyScriptPubKeyMan& spk_man = GetLegacyScriptPubKeyMan(*pwallet);
^
wallet/rpcdump.cpp:468:28: warning: unused variable 'spk_man' [-Wunused-variable]
LegacyScriptPubKeyMan& spk_man = GetLegacyScriptPubKeyMan(*wallet);
^
wallet/rpcdump.cpp:552:28: warning: unused variable 'spk_man' [-Wunused-variable]
LegacyScriptPubKeyMan& spk_man = GetLegacyScriptPubKeyMan(*wallet);
^
wallet/rpcdump.cpp:1349:28: warning: unused variable 'spk_man' [-Wunused-variable]
LegacyScriptPubKeyMan& spk_man = GetLegacyScriptPubKeyMan(*wallet);
^
5 warnings generated.
The call to GetLegacyScriptPubKeyMan() still serves the purpose to throw an error if the wallet doesn't have a LegacyScriptPubKeyMan instance (indicating that the command is not supported, as pointed out by the error message):
https://github.com/bitcoin/bitcoin/blob/bdda137878904e9401a84e308ac74c93c2ef87c1/src/wallet/rpcdump.cpp#L90-L97
This commit casts the functions return value to introduces a new function void to point out that the value is thrown away, and adds a comment on why the function call is needed as well.RequireLegacyScriptPubKeyMan() which in turn calls GetLegacyScriptPubKeyMan() but discards its return value.