Repository navigation
Conversation
Use saved wallet networks for wallet commands and REPL sessions instead of the global default. Skip the mainnet warning for wallet listing and shell completions, and keep log-level filtering.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #395
The mainnet warning fires whenever
--network bitcoinis passed, even for commands that never touch the network (wallets list,completions, entering the REPL), and it goes by the CLI flag rather than the network a saved wallet actually runs on. So a saved signet wallet warns just because the flag says bitcoin, and a saved mainnet wallet stays silent when the flag says testnet.This moves the warning to the network that is effective for each command:
wallet configwarns on the CLI network, since that is what gets savedWalletRuntime, so the warning follows the wallet, not the flagwallets,completions) don't warnkeyanddescriptor) keeps warning on the CLI network as a conservative defaultOnly where the warning is emitted changes; no command's operations are affected.
Tests: new
tests/integration/mainnet_warning.rscovers the false positives (wallets list,completions, a testnet wallet under--network bitcoin), the false negatives (a mainnet wallet under--network testnet, wallet config on mainnet) andRUST_LOGsuppression, on both the direct and REPL paths. The two existing init tests that assertedwallets listwarns now assert againstkey generate, which keeps the conservative warning.