Commit afdfd3c
MarcoFalke
Merge #20403: wallet: upgradewallet fixes, improvements, test coverage
3eb6f8b wallet (not for backport): improve upgradewallet error messages (Jon Atack)
ca8cd89 wallet: fix and improve upgradewallet error responses (Jon Atack)
99d56e3 wallet: fix and improve upgradewallet result responses (Jon Atack)
2498b04 Don't upgrade to HD split if it is already supported (Andrew Chow)
c46c18b wallet: refactor GetClosestWalletFeature() (Jon Atack)
Pull request description:
This follows up on #18836 and #20282 to fix and improve the as-yet unreleased `upgradewallet` feature and also implement review follow-up in bitcoin/bitcoin#18836 (comment).
This PR fixes 4 upgradewallet issues:
- this bug: bitcoin/bitcoin#20403 (comment)
- it returns nothing in the absence of an RPC error, which isn't reassuring for users
- it returns the same thing both in the case of a successful upgrade and when no upgrade took place
- the error message object is currently dead code
This PR fixes the above and provides:
...user feedback to not silently return without upgrading
```
{
"wallet_name": "disable private keys",
"previous_version": 169900,
"current_version": 169900,
"result": "Already at latest version. Wallet version unchanged."
}
```
...better feedback after successfully upgrading
```
{
"wallet_name": "watch-only",
"previous_version": 159900,
"current_version": 169900,
"result": "Wallet upgraded successfully from version 159900 to version 169900."
}
```
...helpful error responses
```
{
"wallet_name": "blank",
"previous_version": 169900,
"current_version": 169900,
"error": "Cannot downgrade wallet from version 169900 to version 159900. Wallet version unchanged."
}
{
"wallet_name": "blank",
"previous_version": 130000,
"current_version": 130000,
"error": "Cannot upgrade a non HD split wallet from version 130000 to version 169899 without upgrading to support pre-split keypool. Please use version 169900 or no version specified."
}
```
updated help:
```
upgradewallet ( version )
Upgrade the wallet. Upgrades to the latest version if no version number is specified.
New keys may be generated and a new wallet backup will need to be made.
Arguments:
1. version (numeric, optional, default=169900) The version number to upgrade to. Default is the latest wallet version.
Result:
{ (json object)
"wallet_name" : "str", (string) Name of wallet this operation was performed on
"previous_version" : n, (numeric) Version of wallet before this operation
"current_version" : n, (numeric) Version of wallet after this operation
"result" : "str", (string, optional) Description of result, if no error
"error" : "str" (string, optional) Error message (if there is one)
}
```
ACKs for top commit:
achow101:
ACK 3eb6f8b
MarcoFalke:
review ACK 3eb6f8b 🛡
Tree-SHA512: b767314069e26b5933b123acfea6aa40708507f504bdb22884da020a4ca1332af38a7072b061e36281533af9f4e236d94d3c129daf6fe5b55241127537038eedFile tree
5 files changed
+79
-54
lines changed- src/wallet
- test/functional
5 files changed
+79
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4234 | 4234 | | |
4235 | 4235 | | |
4236 | 4236 | | |
4237 | | - | |
| 4237 | + | |
4238 | 4238 | | |
4239 | 4239 | | |
4240 | 4240 | | |
| |||
4465 | 4465 | | |
4466 | 4466 | | |
4467 | 4467 | | |
4468 | | - | |
| 4468 | + | |
4469 | 4469 | | |
4470 | 4470 | | |
4471 | | - | |
| 4471 | + | |
4472 | 4472 | | |
4473 | 4473 | | |
4474 | 4474 | | |
4475 | 4475 | | |
| 4476 | + | |
| 4477 | + | |
| 4478 | + | |
| 4479 | + | |
4476 | 4480 | | |
4477 | 4481 | | |
4478 | 4482 | | |
| |||
4495 | 4499 | | |
4496 | 4500 | | |
4497 | 4501 | | |
4498 | | - | |
4499 | | - | |
| 4502 | + | |
| 4503 | + | |
| 4504 | + | |
| 4505 | + | |
| 4506 | + | |
| 4507 | + | |
| 4508 | + | |
| 4509 | + | |
| 4510 | + | |
| 4511 | + | |
| 4512 | + | |
4500 | 4513 | | |
| 4514 | + | |
4501 | 4515 | | |
4502 | | - | |
| 4516 | + | |
| 4517 | + | |
| 4518 | + | |
| 4519 | + | |
| 4520 | + | |
| 4521 | + | |
| 4522 | + | |
4503 | 4523 | | |
4504 | 4524 | | |
4505 | 4525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
459 | | - | |
| 459 | + | |
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4111 | 4111 | | |
4112 | 4112 | | |
4113 | 4113 | | |
4114 | | - | |
4115 | | - | |
4116 | | - | |
| 4114 | + | |
| 4115 | + | |
4117 | 4116 | | |
4118 | 4117 | | |
4119 | 4118 | | |
4120 | 4119 | | |
4121 | 4120 | | |
4122 | 4121 | | |
4123 | 4122 | | |
4124 | | - | |
| 4123 | + | |
4125 | 4124 | | |
4126 | 4125 | | |
4127 | 4126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
102 | 98 | | |
103 | 99 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| |||
92 | 90 | | |
93 | 91 | | |
94 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
95 | 119 | | |
96 | 120 | | |
97 | 121 | | |
| |||
158 | 182 | | |
159 | 183 | | |
160 | 184 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 185 | + | |
| 186 | + | |
169 | 187 | | |
170 | 188 | | |
171 | 189 | | |
172 | 190 | | |
173 | 191 | | |
174 | 192 | | |
175 | 193 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 194 | + | |
| 195 | + | |
182 | 196 | | |
183 | 197 | | |
184 | 198 | | |
185 | | - | |
| 199 | + | |
186 | 200 | | |
187 | 201 | | |
188 | 202 | | |
189 | 203 | | |
190 | 204 | | |
191 | 205 | | |
192 | | - | |
193 | | - | |
194 | | - | |
| 206 | + | |
| 207 | + | |
195 | 208 | | |
196 | 209 | | |
197 | 210 | | |
198 | 211 | | |
199 | 212 | | |
200 | 213 | | |
201 | | - | |
| 214 | + | |
| 215 | + | |
202 | 216 | | |
203 | 217 | | |
204 | 218 | | |
| |||
208 | 222 | | |
209 | 223 | | |
210 | 224 | | |
211 | | - | |
212 | | - | |
| 225 | + | |
213 | 226 | | |
214 | 227 | | |
215 | 228 | | |
| |||
236 | 249 | | |
237 | 250 | | |
238 | 251 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
245 | 256 | | |
246 | 257 | | |
247 | | - | |
248 | | - | |
| 258 | + | |
249 | 259 | | |
250 | 260 | | |
251 | 261 | | |
| |||
271 | 281 | | |
272 | 282 | | |
273 | 283 | | |
274 | | - | |
275 | | - | |
| 284 | + | |
276 | 285 | | |
277 | 286 | | |
278 | 287 | | |
| |||
333 | 342 | | |
334 | 343 | | |
335 | 344 | | |
336 | | - | |
337 | | - | |
| 345 | + | |
| 346 | + | |
338 | 347 | | |
339 | 348 | | |
340 | 349 | | |
341 | 350 | | |
342 | 351 | | |
343 | 352 | | |
344 | 353 | | |
| 354 | + | |
345 | 355 | | |
346 | 356 | | |
0 commit comments