diff options
author | fanquake <fanquake@gmail.com> | 2022-09-19 16:04:53 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-09-19 16:10:47 +0100 |
commit | 9f650062fc4350d8c50ac8890cddd4d99f20f895 (patch) | |
tree | 430b245d15ac864ad9eda59e021439ebe7d6e915 /qa/rpc-tests/test_framework | |
parent | 55e1deb745531a0749f668ed7265770c70a58563 (diff) | |
parent | c3e536555aa3a7db773170671da1256a2ace2094 (diff) |
Merge bitcoin/bitcoin#26005: Wallet: Fix error handling (copy_file failure in RestoreWallet, and in general via interfaces)
c3e536555aa3a7db773170671da1256a2ace2094 Bugfix: Wallet: Return util::Error rather than non-error nullptr when CreateWallet/LoadWallet/RestoreWallet fail (Luke Dashjr)
335ff98c8a64eda38a2a2334102bd253f108c253 Bugfix: Wallet: Wrap RestoreWallet content in a try block to ensure exceptions become returned errors and incomplete wallet directory is removed (Luke Dashjr)
Pull request description:
Bug 1: `copy_file` can throw exceptions, but `RestoreWallet` is expected to return a nullptr with a populated `errors` parameter. This is fixed by wrapping `copy_file` and `LoadWallet` (for good measure) in a `try` block, and converting any exceptions to the intended return style.
Bug 2: `util::Result` turns what would have been a `false` unique_ptr into a `true` nullptr result, which leads to nullptr dereferences in at least the 3 cases of wallet creation/loading/restoring. This is fixed by keeping the pointer as a plain `std::unique_ptr` until actually returning it (ie, after the nullptr check).
Fixes https://github.com/bitcoin-core/gui/issues/661
ACKs for top commit:
achow101:
ACK c3e536555aa3a7db773170671da1256a2ace2094
Tree-SHA512: 4291b3dbbb147acea2e63a704324c9371bc16ecb4237f8753729b0b0a6e55c9758ad61bfe8bd432fd7b0bae95d8b63a9831e61ac8b8d5c0197b550a2e0f4a105
Diffstat (limited to 'qa/rpc-tests/test_framework')
0 files changed, 0 insertions, 0 deletions