New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wallet: remove unused variable spk_man in import* RPCs #17377
wallet: remove unused variable spk_man in import* RPCs #17377
Conversation
See #17300 (comment). |
@practicalswift Snap! :) |
@practicalswift @jonatack Oops, I overlooked that. Mental note to myself: also search through merged/closed PRs about a change that is likely to having been discussed already, not only currently open ones. Thanks for pointing out! |
From the earlier comment:
You could add a function |
Each of the following RPC functions define a variable reference "LegacyScriptPubKeyMan& spk_man" which is not used, leading to compiler warnings: - importprivkey - importaddress - importpubkey - importwallet - importmulti The call to GetLegacyScriptPubKeyMan() still serves the purpose to throw an error if the wallet doesn't have a LegacyScriptPubKeyMan instance. This commit introduces a new function RequireLegacyScriptPubKeyMan() which in turn calls GetLegacyScriptPubKeyMan() but discards its return value.
c57de2e
to
606422b
Compare
@Sjors: Good idea, I updated the commit and the PR description accordingly. If someone else wants to work on this who has more background knowledge about future use etc., probably on the course of a larger cleanup PR (@ryanofsky, @achow101 ?), feel free to close it though -- I wouldn't have opened it in the first place if I knew about #17338 and #17300 (comment). |
|
Sorry for causing these warnings. Feel free to pull in changes from b07b07c in #17381 to avoid conflicts with that PR. I think the changes in that commit are a little better than current changes here (606422b), because they extend the getter function to cover |
Agree @ryanofsky's version is more thorough, so let's go with that. |
Closing in favour of #17381. |
Whoops. We should probably merge something to get rid of these warnings to avoid people wasting their time creating PR after PR fixing them. |
Each of the following RPC functions
define a variable reference
LegacyScriptPubKeyMan& spk_man
which is not used, leading to compiler warnings in the current master branch (bdda137):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):bitcoin/src/wallet/rpcdump.cpp
Lines 90 to 97 in bdda137
This commit
casts the functions return value tointroduces a new functionvoid
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 callsGetLegacyScriptPubKeyMan()
but discards its return value.