This PR extends our test coverage to demonstrate the issue, then removes newline escape sequences printed in the wallet warning
field in RPCs createwallet
, loadwallet
, unloadwallet
, and restorewallet
.
before
0$ ./src/bitcoin-cli -signet createwallet w1 false false "" false false
1{
2 "name": "w1",
3 "warning": "Empty string given as passphrase, wallet will not be encrypted.\nWallet created successfully. The legacy wallet type is being deprecated and support for creating and opening legacy wallets will be removed in the future."
4}
after
0$ ./src/bitcoin-cli -signet createwallet w2 false false "" false false
1{
2 "name": "w2",
3 "warning": "Empty string given as passphrase, wallet will not be encrypted. Wallet created successfully. The legacy wallet type is being deprecated and support for creating and opening legacy wallets will be removed in the future."
4}
Rationale: Our RPC is returning newline presentation elements embedded in JSON string field responses. These are a client-side concern, not a server-side one. If it is important for the RPC client to know how many warnings have been returned in order to display them on separate lines, then it may be a good idea after this to gradually replace the warning
string field with a warnings
JSON array of strings, as we do in several other RPCs. I’m happy to do that in a follow-up, as it would be orthogonal to this change: first the warnings
field would be added and the warning
field deprecated, then after a release or so the latter could possibly be removed. In the meantime, this is a simple and focused fix.