diff --git a/src/app_service/service/accounts/service.nim b/src/app_service/service/accounts/service.nim index 688de31b4c..a64d5f2e24 100644 --- a/src/app_service/service/accounts/service.nim +++ b/src/app_service/service/accounts/service.nim @@ -701,6 +701,8 @@ QtObject: hashedCurrentPassword: hashedCurrentPassword, newPassword: newPassword ) + + DB_BLOCKED_DUE_TO_PROFILE_MIGRATION = true self.threadpool.start(arg) proc onConvertToKeycardAccount*(self: Service, response: string) {.slot.} = diff --git a/src/app_service/service/wallet_account/service.nim b/src/app_service/service/wallet_account/service.nim index 81f4d98727..4cd03e02a4 100644 --- a/src/app_service/service/wallet_account/service.nim +++ b/src/app_service/service/wallet_account/service.nim @@ -153,10 +153,13 @@ QtObject: result.walletAccounts = initOrderedTable[string, WalletAccountDto]() proc fetchAccounts*(self: Service): seq[WalletAccountDto] = - let response = status_go_accounts.getAccounts() - return response.result.getElems().map( - x => x.toWalletAccountDto() - ).filter(a => not a.isChat) + try: + let response = status_go_accounts.getAccounts() + return response.result.getElems().map( + x => x.toWalletAccountDto() + ).filter(a => not a.isChat) + except Exception as e: + error "error: ", procName="fetchAccounts", errName = e.name, errDesription = e.msg proc setEnsName(self: Service, account: WalletAccountDto) = let chainId = self.networkService.getNetworkForEns().chainId diff --git a/src/backend/core.nim b/src/backend/core.nim index 5ca8caf8dd..c73c5dc785 100644 --- a/src/backend/core.nim +++ b/src/backend/core.nim @@ -7,6 +7,10 @@ export response_type logScope: topics = "rpc" +## we guard majority db calls which may occure during Profile KeyPair migration +## (if there is a need we can guard other non rpc calls as well in the same way) +var DB_BLOCKED_DUE_TO_PROFILE_MIGRATION* = false + proc callRPC*(inputJSON: string): string = return $status_go.callRPC(inputJSON) @@ -16,6 +20,9 @@ proc callPrivateRPCRaw*(inputJSON: string): string {.raises: [].} = proc makePrivateRpcCall*( methodName: string, inputJSON: JsonNode ): RpcResponse[JsonNode] {.raises: [RpcException, ValueError, Defect, SerializationError].} = + if DB_BLOCKED_DUE_TO_PROFILE_MIGRATION: + debug "DB blocked due to profile migration, unable to proceed with the rpc call", rpc_method=methodName + raise newException(RpcException, "db closed due to profile migration") try: debug "NewBE_callPrivateRPC", rpc_method=methodName let rpcResponseRaw = status_go.callPrivateRPC($inputJSON)