wallet: Handle duplicate fileid exception
Summary:
Loading two identical wallet files caused a crash
Handle the duplicate fileid exception thrown at CheckUniqueFileid in tow cases:
- when duplicate wallets are set on the command line - catch in LoadWallets;
- when a duplicate wallet is loaded dynamically - catch in LoadWallet.
This is a backport of Core PR16923
Test Plan:
ninja all check-all
In bitcoin-qt, backup the currently open wallet to a file named wallet.dat,
then in the console window type loadwallet /path/to/wallet/.
Check that the program does not crash and you get a useful error message dialog.
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D8898