Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 95899df

Browse files
ziggie1984adrienlacombe
authored andcommitted
check for new wallet loaded message
1 parent 8762fbb commit 95899df

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

bus/infrastructure.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ const (
3737
// bitcoind's wallet.
3838
walletName = "satstack"
3939

40-
errDuplicateWalletLoadMsg = "Duplicate -wallet filename specified."
41-
errWalletAlreadyLoadedMsg = "Wallet file verification failed. Refusing to load database. Data file"
40+
errDuplicateWalletLoadMsg = "Duplicate -wallet filename specified."
41+
errWalletAlreadyLoadedMsgOld = "Wallet file verification failed. Refusing to load database. Data file"
42+
// Cores Responds changes so adding the new one but keeping the old for backwards compatibility
43+
errWalletAlreadyLoadedMsgNew = "Wallet file verification failed. SQLiteDatabase: Unable to obtain an exclusive lock on the database"
4244
)
4345

4446
// Bus represents a transport allowing access to Bitcoin RPC methods.
@@ -303,7 +305,12 @@ func loadOrCreateWallet(client *rpcclient.Client) (bool, error) {
303305
return false, nil
304306
}
305307

306-
if rpcErr.Code == btcjson.ErrRPCWallet && strings.Contains(rpcErr.Message, errWalletAlreadyLoadedMsg) {
308+
if rpcErr.Code == btcjson.ErrRPCWallet && strings.Contains(rpcErr.Message, errWalletAlreadyLoadedMsgOld) {
309+
// wallet already loaded. Ignore the error and return.
310+
return false, nil
311+
}
312+
313+
if rpcErr.Code == btcjson.ErrRPCWallet && strings.Contains(rpcErr.Message, errWalletAlreadyLoadedMsgNew) {
307314
// wallet already loaded. Ignore the error and return.
308315
return false, nil
309316
}

0 commit comments

Comments
 (0)