fix issue 201 Throw exception when seed can't be provided
This commit is contained in:
parent
bfc717dc07
commit
d4dfb23657
|
@ -44,7 +44,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
walletBirthdayHeight: BlockHeight(DemoAppConfig.birthdayHeight)) // Init or DIE
|
||||
|
||||
var storage = SampleStorage.shared
|
||||
storage!.seed = Data(DemoAppConfig().seed())
|
||||
storage!.seed = Data(try! DemoAppConfig().seed())
|
||||
storage!.privateKey = addresses?[0]
|
||||
self.wallet = wallet
|
||||
return wallet
|
||||
|
@ -133,7 +133,7 @@ extension AppDelegate {
|
|||
}
|
||||
|
||||
extension DemoAppConfig: SeedProvider {
|
||||
func seed() -> [UInt8] {
|
||||
func seed() throws -> [UInt8] {
|
||||
DemoAppConfig.seed
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ public class Initializer {
|
|||
|
||||
self.processor = CompactBlockProcessorBuilder.buildProcessor(configuration: CompactBlockProcessor.Configuration(cacheDb: cacheDbURL, dataDb: dataDbURL, walletBirthday: walletBirthday?.height ?? self.lowerBoundHeight), downloader: self.downloader, transactionRepository: transactionRepository, backend: rustBackend)
|
||||
|
||||
guard let accounts = rustBackend.initAccountsTable(dbData: dataDbURL, seed: seedProvider.seed(), accounts: Int32(numberOfAccounts)) else {
|
||||
guard let accounts = rustBackend.initAccountsTable(dbData: dataDbURL, seed: try seedProvider.seed(), accounts: Int32(numberOfAccounts)) else {
|
||||
throw rustBackend.lastError() ?? InitializerError.accountInitFailed
|
||||
}
|
||||
|
||||
|
|
|
@ -11,5 +11,5 @@ import Foundation
|
|||
Describes an interface for an entity that provides seed bytes
|
||||
*/
|
||||
public protocol SeedProvider {
|
||||
func seed() -> [UInt8]
|
||||
func seed() throws -> [UInt8]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue