Accounts service is cleared if on NodeStopped signal

This commit is contained in:
Sale Djenic 2021-10-17 13:40:58 +02:00 committed by Iuri Matias
parent 11cdd608f3
commit 72197f86f5
3 changed files with 10 additions and 0 deletions

View File

@ -48,6 +48,7 @@ method init*(self: Controller) =
self.events.on(SignalType.NodeStopped.event) do(e:Args):
echo "-NEW-EVENT-- NodeStopped: ", repr(e)
self.events.emit("nodeStopped", Args())
self.accountsService.clear()
self.delegate.emitLogOut()
self.events.on(SignalType.NodeReady.event) do(e:Args):

View File

@ -58,6 +58,12 @@ method init*(self: Service) =
except Exception as e:
error "error: ", methodName="init", errName = e.name, errDesription = e.msg
method clear*(self: Service) =
self.generatedAccounts = @[]
self.loggedInAccount = AccountDto()
self.importedAccount = GeneratedAccountDto()
self.isFirstTimeAccountLogin = false
method validateMnemonic*(self: Service, mnemonic: string): string =
try:
let response = status_go_general.validateMnemonic(mnemonic)

View File

@ -48,4 +48,7 @@ method importMnemonic*(self: ServiceInterface, mnemonic: string): bool {.base.}
method login*(self: ServiceInterface, account: AccountDto, password: string):
string {.base.} =
raise newException(ValueError, "No implementation available")
method clear*(self: ServiceInterface) {.base.} =
raise newException(ValueError, "No implementation available")