Rename `UnifiedViewingKey` to `UnifiedFullViewingKey`
The type does not yet match ZIP 316, but performing this rename first makes the subsequent commit simpler.
This commit is contained in:
parent
6d0f241ed6
commit
b0343d4c38
|
@ -33,8 +33,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
if let wallet = wallet {
|
||||
return wallet
|
||||
} else {
|
||||
let unifiedViewingKeys = try! DerivationTool(networkType: kZcashNetwork.networkType)
|
||||
.deriveUnifiedViewingKeysFromSeed(DemoAppConfig.seed, numberOfAccounts: 1)
|
||||
let unifiedFullViewingKeys = try! DerivationTool(networkType: kZcashNetwork.networkType)
|
||||
.deriveUnifiedFullViewingKeysFromSeed(DemoAppConfig.seed, numberOfAccounts: 1)
|
||||
|
||||
let wallet = Initializer(
|
||||
cacheDbURL: try! cacheDbURLHelper(),
|
||||
|
@ -44,7 +44,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
network: kZcashNetwork,
|
||||
spendParamsURL: try! spendParamsURLHelper(),
|
||||
outputParamsURL: try! outputParamsURLHelper(),
|
||||
viewingKeys: unifiedViewingKeys,
|
||||
viewingKeys: unifiedFullViewingKeys,
|
||||
walletBirthday: DemoAppConfig.birthdayHeight,
|
||||
loggerProxy: loggerProxy
|
||||
)
|
||||
|
|
|
@ -43,13 +43,13 @@ class MigrationManager {
|
|||
self.network = networkType
|
||||
}
|
||||
|
||||
func performMigration(uvks: [UnifiedViewingKey]) throws {
|
||||
try migrateDataDb(uvks: uvks)
|
||||
func performMigration(ufvks: [UnifiedFullViewingKey]) throws {
|
||||
try migrateDataDb(ufvks: ufvks)
|
||||
try migrateCacheDb()
|
||||
try migratePendingDb()
|
||||
}
|
||||
|
||||
func performVersion1Migration(viewingKeys: [UnifiedViewingKey]) throws {
|
||||
func performVersion1Migration(viewingKeys: [UnifiedFullViewingKey]) throws {
|
||||
LoggerProxy.debug("Starting migration version 1 from viewing Keys")
|
||||
let db = try self.dataDb.connection()
|
||||
|
||||
|
@ -143,9 +143,9 @@ class MigrationManager {
|
|||
|
||||
let derivationTool = DerivationTool(networkType: self.network)
|
||||
|
||||
let uvks = try derivationTool.deriveUnifiedViewingKeysFromSeed(seedBytes, numberOfAccounts: accounts.count)
|
||||
let ufvks = try derivationTool.deriveUnifiedFullViewingKeysFromSeed(seedBytes, numberOfAccounts: accounts.count)
|
||||
|
||||
try performVersion1Migration(viewingKeys: uvks)
|
||||
try performVersion1Migration(viewingKeys: ufvks)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ private extension MigrationManager {
|
|||
}
|
||||
}
|
||||
|
||||
func migrateDataDb(uvks: [UnifiedViewingKey]) throws {
|
||||
func migrateDataDb(ufvks: [UnifiedFullViewingKey]) throws {
|
||||
let currentDataDbVersion = try dataDb.connection().getUserVersion()
|
||||
LoggerProxy.debug(
|
||||
"Attempting to perform migration for data Db - currentVersion: \(currentDataDbVersion)." +
|
||||
|
@ -197,7 +197,7 @@ private extension MigrationManager {
|
|||
}
|
||||
switch version {
|
||||
case .version1:
|
||||
try performVersion1Migration(viewingKeys: uvks)
|
||||
try performVersion1Migration(viewingKeys: ufvks)
|
||||
case .none:
|
||||
break
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class Initializer {
|
|||
private(set) var storage: CompactBlockStorage
|
||||
private(set) var downloader: CompactBlockDownloader
|
||||
private(set) var network: ZcashNetwork
|
||||
private(set) public var viewingKeys: [UnifiedViewingKey]
|
||||
private(set) public var viewingKeys: [UnifiedFullViewingKey]
|
||||
/// The effective birthday of the wallet based on the height provided when initializing
|
||||
/// and the checkpoints available on this SDK
|
||||
private(set) public var walletBirthday: BlockHeight
|
||||
|
@ -100,7 +100,7 @@ public class Initializer {
|
|||
network: ZcashNetwork,
|
||||
spendParamsURL: URL,
|
||||
outputParamsURL: URL,
|
||||
viewingKeys: [UnifiedViewingKey],
|
||||
viewingKeys: [UnifiedFullViewingKey],
|
||||
walletBirthday: BlockHeight,
|
||||
alias: String = "",
|
||||
loggerProxy: Logger? = nil
|
||||
|
@ -149,7 +149,7 @@ public class Initializer {
|
|||
storage: CompactBlockStorage,
|
||||
spendParamsURL: URL,
|
||||
outputParamsURL: URL,
|
||||
viewingKeys: [UnifiedViewingKey],
|
||||
viewingKeys: [UnifiedFullViewingKey],
|
||||
walletBirthday: BlockHeight,
|
||||
alias: String = "",
|
||||
loggerProxy: Logger? = nil
|
||||
|
@ -227,7 +227,7 @@ public class Initializer {
|
|||
do {
|
||||
guard try rustBackend.initAccountsTable(
|
||||
dbData: dataDbURL,
|
||||
uvks: viewingKeys,
|
||||
ufvks: viewingKeys,
|
||||
networkType: network.networkType
|
||||
) else {
|
||||
throw rustBackend.lastError() ?? InitializerError.accountInitFailed
|
||||
|
@ -245,7 +245,7 @@ public class Initializer {
|
|||
networkType: self.network.networkType
|
||||
)
|
||||
|
||||
try migrationManager.performMigration(uvks: viewingKeys)
|
||||
try migrationManager.performMigration(ufvks: viewingKeys)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,12 @@
|
|||
public typealias ExtendedFullViewingKey = String
|
||||
public typealias ExtendedPublicKey = String
|
||||
|
||||
public protocol UnifiedViewingKey {
|
||||
/**
|
||||
A ZIP 316 Unified Full Viewing Key.
|
||||
|
||||
TODO: Use the correct ZIP 316 format.
|
||||
*/
|
||||
public protocol UnifiedFullViewingKey {
|
||||
var extfvk: ExtendedFullViewingKey { get set }
|
||||
var extpub: ExtendedPublicKey { get set }
|
||||
}
|
||||
|
|
|
@ -111,37 +111,37 @@ class ZcashRustBackend: ZcashRustBackendWelding {
|
|||
return extsks
|
||||
}
|
||||
|
||||
static func initAccountsTable(dbData: URL, uvks: [UnifiedViewingKey], networkType: NetworkType) throws -> Bool {
|
||||
static func initAccountsTable(dbData: URL, ufvks: [UnifiedFullViewingKey], networkType: NetworkType) throws -> Bool {
|
||||
let dbData = dbData.osStr()
|
||||
|
||||
var ffiUvks: [FFIUnifiedViewingKey] = []
|
||||
for uvk in uvks {
|
||||
guard !uvk.extfvk.containsCStringNullBytesBeforeStringEnding() else {
|
||||
var ffiUfvks: [FFIUnifiedViewingKey] = []
|
||||
for ufvk in ufvks {
|
||||
guard !ufvk.extfvk.containsCStringNullBytesBeforeStringEnding() else {
|
||||
throw RustWeldingError.malformedStringInput
|
||||
}
|
||||
guard !uvk.extpub.containsCStringNullBytesBeforeStringEnding() else {
|
||||
guard !ufvk.extpub.containsCStringNullBytesBeforeStringEnding() else {
|
||||
throw RustWeldingError.malformedStringInput
|
||||
}
|
||||
|
||||
guard try self.isValidExtendedFullViewingKey(uvk.extfvk, networkType: networkType) else {
|
||||
guard try self.isValidExtendedFullViewingKey(ufvk.extfvk, networkType: networkType) else {
|
||||
throw RustWeldingError.malformedStringInput
|
||||
}
|
||||
|
||||
let extfvkCStr = [CChar](String(uvk.extfvk).utf8CString)
|
||||
let extfvkCStr = [CChar](String(ufvk.extfvk).utf8CString)
|
||||
|
||||
let extfvkPtr = UnsafeMutablePointer<CChar>.allocate(capacity: extfvkCStr.count)
|
||||
extfvkPtr.initialize(from: extfvkCStr, count: extfvkCStr.count)
|
||||
|
||||
let extpubCStr = [CChar](String(uvk.extpub).utf8CString)
|
||||
let extpubCStr = [CChar](String(ufvk.extpub).utf8CString)
|
||||
let extpubPtr = UnsafeMutablePointer<CChar>.allocate(capacity: extpubCStr.count)
|
||||
extpubPtr.initialize(from: extpubCStr, count: extpubCStr.count)
|
||||
|
||||
ffiUvks.append(FFIUnifiedViewingKey(extfvk: extfvkPtr, extpub: extpubPtr))
|
||||
ffiUfvks.append(FFIUnifiedViewingKey(extfvk: extfvkPtr, extpub: extpubPtr))
|
||||
}
|
||||
|
||||
var result = false
|
||||
|
||||
ffiUvks.withContiguousMutableStorageIfAvailable { pointer in
|
||||
ffiUfvks.withContiguousMutableStorageIfAvailable { pointer in
|
||||
let slice = UnsafeMutablePointer<FFIUVKBoxedSlice>.allocate(capacity: 1)
|
||||
slice.initialize(to: FFIUVKBoxedSlice(ptr: pointer.baseAddress, len: UInt(pointer.count)))
|
||||
|
||||
|
@ -150,9 +150,9 @@ class ZcashRustBackend: ZcashRustBackendWelding {
|
|||
}
|
||||
|
||||
defer {
|
||||
for uvk in ffiUvks {
|
||||
uvk.extfvk.deallocate()
|
||||
uvk.extpub.deallocate()
|
||||
for ufvk in ffiUfvks {
|
||||
ufvk.extfvk.deallocate()
|
||||
ufvk.extpub.deallocate()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,13 +488,13 @@ class ZcashRustBackend: ZcashRustBackendWelding {
|
|||
return extsks
|
||||
}
|
||||
|
||||
static func deriveUnifiedViewingKeyFromSeed(
|
||||
static func deriveUnifiedFullViewingKeyFromSeed(
|
||||
_ seed: [UInt8],
|
||||
numberOfAccounts: Int,
|
||||
networkType: NetworkType
|
||||
) throws -> [UnifiedViewingKey] {
|
||||
) throws -> [UnifiedFullViewingKey] {
|
||||
guard
|
||||
let uvksStruct = zcashlc_derive_unified_viewing_keys_from_seed(
|
||||
let ufvksStruct = zcashlc_derive_unified_viewing_keys_from_seed(
|
||||
seed,
|
||||
UInt(seed.count),
|
||||
Int32(numberOfAccounts),
|
||||
|
@ -507,16 +507,16 @@ class ZcashRustBackend: ZcashRustBackendWelding {
|
|||
throw RustWeldingError.unableToDeriveKeys
|
||||
}
|
||||
|
||||
let uvksSize = uvksStruct.pointee.len
|
||||
let ufvksSize = ufvksStruct.pointee.len
|
||||
|
||||
guard let uvksArrayPointer = uvksStruct.pointee.ptr, uvksSize > 0 else {
|
||||
guard let ufvksArrayPointer = ufvksStruct.pointee.ptr, ufvksSize > 0 else {
|
||||
throw RustWeldingError.unableToDeriveKeys
|
||||
}
|
||||
|
||||
var uvks: [UnifiedViewingKey] = []
|
||||
var ufvks: [UnifiedFullViewingKey] = []
|
||||
|
||||
for item in 0 ..< Int(uvksSize) {
|
||||
let itemPointer = uvksArrayPointer.advanced(by: item)
|
||||
for item in 0 ..< Int(ufvksSize) {
|
||||
let itemPointer = ufvksArrayPointer.advanced(by: item)
|
||||
|
||||
guard let extfvk = String(validatingUTF8: itemPointer.pointee.extfvk) else {
|
||||
throw RustWeldingError.unableToDeriveKeys
|
||||
|
@ -526,12 +526,12 @@ class ZcashRustBackend: ZcashRustBackendWelding {
|
|||
throw RustWeldingError.unableToDeriveKeys
|
||||
}
|
||||
|
||||
uvks.append(UVK(extfvk: extfvk, extpub: extpub))
|
||||
ufvks.append(UFVK(extfvk: extfvk, extpub: extpub))
|
||||
}
|
||||
|
||||
zcashlc_free_uvk_array(uvksStruct)
|
||||
zcashlc_free_uvk_array(ufvksStruct)
|
||||
|
||||
return uvks
|
||||
return ufvks
|
||||
}
|
||||
|
||||
static func deriveShieldedAddressFromSeed(
|
||||
|
@ -687,7 +687,7 @@ class ZcashRustBackend: ZcashRustBackendWelding {
|
|||
}
|
||||
}
|
||||
|
||||
private struct UVK: UnifiedViewingKey {
|
||||
private struct UFVK: UnifiedFullViewingKey {
|
||||
var extfvk: ExtendedFullViewingKey
|
||||
var extpub: ExtendedPublicKey
|
||||
}
|
||||
|
|
|
@ -70,9 +70,9 @@ public protocol ZcashRustBackendWelding {
|
|||
initialize the accounts table from a set of unified viewing keys
|
||||
- Parameters:
|
||||
- dbData: location of the data db
|
||||
- uvks: an array of UnifiedViewingKeys
|
||||
- ufvks: an array of UnifiedFullViewingKeys
|
||||
*/
|
||||
static func initAccountsTable(dbData: URL, uvks: [UnifiedViewingKey], networkType: NetworkType) throws -> Bool
|
||||
static func initAccountsTable(dbData: URL, ufvks: [UnifiedFullViewingKey], networkType: NetworkType) throws -> Bool
|
||||
|
||||
/**
|
||||
initialize the blocks table from a given checkpoint (birthday)
|
||||
|
@ -379,7 +379,7 @@ public protocol ZcashRustBackendWelding {
|
|||
*/
|
||||
static func derivedTransparentAddressFromPublicKey(_ pubkey: String, networkType: NetworkType) throws -> String
|
||||
|
||||
static func deriveUnifiedViewingKeyFromSeed(_ seed: [UInt8], numberOfAccounts: Int, networkType: NetworkType) throws -> [UnifiedViewingKey]
|
||||
static func deriveUnifiedFullViewingKeyFromSeed(_ seed: [UInt8], numberOfAccounts: Int, networkType: NetworkType) throws -> [UnifiedFullViewingKey]
|
||||
|
||||
/**
|
||||
Gets the consensus branch id for the given height
|
||||
|
|
|
@ -86,15 +86,15 @@ public protocol KeyDeriving {
|
|||
func deriveTransparentAddressFromPublicKey(_ pubkey: String) throws -> String
|
||||
|
||||
/**
|
||||
derives unified viewing keys from seedbytes, specifying a number of accounts
|
||||
derives unified full viewing keys from seedbytes, specifying a number of accounts
|
||||
- Returns an array of unified viewing key tuples.
|
||||
*/
|
||||
func deriveUnifiedViewingKeysFromSeed(_ seed: [UInt8], numberOfAccounts: Int) throws -> [UnifiedViewingKey]
|
||||
func deriveUnifiedFullViewingKeysFromSeed(_ seed: [UInt8], numberOfAccounts: Int) throws -> [UnifiedFullViewingKey]
|
||||
|
||||
/**
|
||||
derives a Unified Address from a Unified Viewing Key
|
||||
derives a Unified Address from a Unified Full Viewing Key
|
||||
*/
|
||||
func deriveUnifiedAddressFromUnifiedViewingKey(_ uvk: UnifiedViewingKey) throws -> UnifiedAddress
|
||||
func deriveUnifiedAddressFromUnifiedFullViewingKey(_ ufvk: UnifiedFullViewingKey) throws -> UnifiedAddress
|
||||
}
|
||||
|
||||
public enum KeyDerivationErrors: Error {
|
||||
|
@ -236,24 +236,24 @@ public class DerivationTool: KeyDeriving {
|
|||
}
|
||||
}
|
||||
|
||||
public func deriveUnifiedViewingKeysFromSeed(_ seed: [UInt8], numberOfAccounts: Int) throws -> [UnifiedViewingKey] {
|
||||
public func deriveUnifiedFullViewingKeysFromSeed(_ seed: [UInt8], numberOfAccounts: Int) throws -> [UnifiedFullViewingKey] {
|
||||
guard numberOfAccounts > 0 else {
|
||||
throw KeyDerivationErrors.invalidInput
|
||||
}
|
||||
do {
|
||||
return try rustwelding.deriveUnifiedViewingKeyFromSeed(seed, numberOfAccounts: numberOfAccounts, networkType: networkType)
|
||||
return try rustwelding.deriveUnifiedFullViewingKeyFromSeed(seed, numberOfAccounts: numberOfAccounts, networkType: networkType)
|
||||
} catch {
|
||||
throw KeyDerivationErrors.derivationError(underlyingError: error)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
derives a Unified Address from a Unified Viewing Key
|
||||
derives a Unified Address from a Unified Full Viewing Key
|
||||
*/
|
||||
public func deriveUnifiedAddressFromUnifiedViewingKey(_ uvk: UnifiedViewingKey) throws -> UnifiedAddress {
|
||||
public func deriveUnifiedAddressFromUnifiedFullViewingKey(_ ufvk: UnifiedFullViewingKey) throws -> UnifiedAddress {
|
||||
do {
|
||||
let tAddress = try deriveTransparentAddressFromPublicKey(uvk.extpub)
|
||||
let zAddress = try deriveShieldedAddress(viewingKey: uvk.extfvk)
|
||||
let tAddress = try deriveTransparentAddressFromPublicKey(ufvk.extpub)
|
||||
let zAddress = try deriveShieldedAddress(viewingKey: ufvk.extfvk)
|
||||
return ConcreteUnifiedAddress(tAddress: tAddress, zAddress: zAddress)
|
||||
} catch {
|
||||
throw KeyDerivationErrors.unableToDerive
|
||||
|
|
|
@ -19,7 +19,7 @@ class BlockScanOperationTests: XCTestCase {
|
|||
var cacheDbURL: URL!
|
||||
var dataDbURL: URL!
|
||||
|
||||
var uvk = UVFakeKey(
|
||||
var ufvk = UFVFakeKey(
|
||||
extfvk: "zxviewtestsapling1qw88ayg8qqqqpqyhg7jnh9mlldejfqwu46pm40ruwstd8znq3v3l4hjf33qcu2a5e36katshcfhcxhzgyfugj2lkhmt40j45cv38rv3frnghzkxcx73k7m7afw9j7ujk7nm4dx5mv02r26umxqgar7v3x390w2h3crqqgjsjly7jy4vtwzrmustm5yudpgcydw7x78awca8wqjvkqj8p8e3ykt7lrgd7xf92fsfqjs5vegfsja4ekzpfh5vtccgvs5747xqm6qflmtqpr8s9u", // swiftlint:disable:this line_length
|
||||
extpub: "02075a7f5f7507d64022dad5954849f216b0f1b09b2d588be663d8e7faeb5aaf61"
|
||||
)
|
||||
|
@ -160,7 +160,7 @@ class BlockScanOperationTests: XCTestCase {
|
|||
|
||||
try self.rustWelding.initDataDb(dbData: dataDbURL, networkType: network.networkType)
|
||||
|
||||
guard try self.rustWelding.initAccountsTable(dbData: self.dataDbURL, uvks: [uvk], networkType: network.networkType) else {
|
||||
guard try self.rustWelding.initAccountsTable(dbData: self.dataDbURL, ufvks: [ufvk], networkType: network.networkType) else {
|
||||
XCTFail("failed to init account table")
|
||||
return
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ extension BlockScanOperationTests: CompactBlockProgressDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
struct UVFakeKey: UnifiedViewingKey {
|
||||
struct UFVFakeKey: UnifiedFullViewingKey {
|
||||
var extfvk: ExtendedFullViewingKey
|
||||
var extpub: ExtendedPublicKey
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ class DerivatioToolTestnetTests: XCTestCase {
|
|||
}
|
||||
|
||||
func testDeriveUnifiedKeysFromSeed() throws {
|
||||
let unifiedKeys = try derivationTool.deriveUnifiedViewingKeysFromSeed([UInt8](seedData), numberOfAccounts: 1)
|
||||
let unifiedKeys = try derivationTool.deriveUnifiedFullViewingKeysFromSeed([UInt8](seedData), numberOfAccounts: 1)
|
||||
XCTAssertEqual(unifiedKeys.count, 1)
|
||||
|
||||
XCTAssertEqual(unifiedKeys[0].extfvk, expectedViewingKey)
|
||||
|
@ -89,7 +89,7 @@ class DerivatioToolTestnetTests: XCTestCase {
|
|||
}
|
||||
|
||||
func testDeriveQuiteALotOfUnifiedKeysFromSeed() throws {
|
||||
let unifiedKeys = try derivationTool.deriveUnifiedViewingKeysFromSeed([UInt8](seedData), numberOfAccounts: 10)
|
||||
let unifiedKeys = try derivationTool.deriveUnifiedFullViewingKeysFromSeed([UInt8](seedData), numberOfAccounts: 10)
|
||||
XCTAssertEqual(unifiedKeys.count, 10)
|
||||
|
||||
XCTAssertEqual(unifiedKeys[0].extfvk, expectedViewingKey)
|
||||
|
|
|
@ -79,7 +79,7 @@ class DerivationToolMainnetTests: XCTestCase {
|
|||
}
|
||||
|
||||
func testDeriveUnifiedKeysFromSeed() throws {
|
||||
let unifiedKeys = try derivationTool.deriveUnifiedViewingKeysFromSeed([UInt8](seedData), numberOfAccounts: 1)
|
||||
let unifiedKeys = try derivationTool.deriveUnifiedFullViewingKeysFromSeed([UInt8](seedData), numberOfAccounts: 1)
|
||||
XCTAssertEqual(unifiedKeys.count, 1)
|
||||
|
||||
XCTAssertEqual(unifiedKeys[0].extfvk, expectedViewingKey)
|
||||
|
@ -88,7 +88,7 @@ class DerivationToolMainnetTests: XCTestCase {
|
|||
}
|
||||
|
||||
func testDeriveQuiteALotOfUnifiedKeysFromSeed() throws {
|
||||
let unifiedKeys = try derivationTool.deriveUnifiedViewingKeysFromSeed([UInt8](seedData), numberOfAccounts: 10)
|
||||
let unifiedKeys = try derivationTool.deriveUnifiedFullViewingKeysFromSeed([UInt8](seedData), numberOfAccounts: 10)
|
||||
XCTAssertEqual(unifiedKeys.count, 10)
|
||||
|
||||
XCTAssertEqual(unifiedKeys[0].extfvk, expectedViewingKey)
|
||||
|
|
|
@ -35,7 +35,7 @@ class WalletTests: XCTestCase {
|
|||
|
||||
func testWalletInitialization() throws {
|
||||
let derivationTool = DerivationTool(networkType: network.networkType)
|
||||
let uvk = try derivationTool.deriveUnifiedViewingKeysFromSeed(seedData.bytes, numberOfAccounts: 1)
|
||||
let ufvk = try derivationTool.deriveUnifiedFullViewingKeysFromSeed(seedData.bytes, numberOfAccounts: 1)
|
||||
let wallet = Initializer(
|
||||
cacheDbURL: try __cacheDbURL(),
|
||||
dataDbURL: try __dataDbURL(),
|
||||
|
@ -44,7 +44,7 @@ class WalletTests: XCTestCase {
|
|||
network: network,
|
||||
spendParamsURL: try __spendParamsURL(),
|
||||
outputParamsURL: try __outputParamsURL(),
|
||||
viewingKeys: uvk,
|
||||
viewingKeys: ufvk,
|
||||
walletBirthday: 663194
|
||||
)
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class MockRustBackend: ZcashRustBackendWelding {
|
|||
-1
|
||||
}
|
||||
|
||||
static func initAccountsTable(dbData: URL, uvks: [UnifiedViewingKey], networkType: NetworkType) throws -> Bool {
|
||||
static func initAccountsTable(dbData: URL, ufvks: [UnifiedFullViewingKey], networkType: NetworkType) throws -> Bool {
|
||||
false
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ class MockRustBackend: ZcashRustBackendWelding {
|
|||
throw KeyDerivationErrors.unableToDerive
|
||||
}
|
||||
|
||||
static func deriveUnifiedViewingKeyFromSeed(_ seed: [UInt8], numberOfAccounts: Int, networkType: NetworkType) throws -> [UnifiedViewingKey] {
|
||||
static func deriveUnifiedFullViewingKeyFromSeed(_ seed: [UInt8], numberOfAccounts: Int, networkType: NetworkType) throws -> [UnifiedFullViewingKey] {
|
||||
throw KeyDerivationErrors.unableToDerive
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ class TestCoordinator {
|
|||
}
|
||||
|
||||
guard
|
||||
let uvk = try derivationTool
|
||||
.deriveUnifiedViewingKeysFromSeed(
|
||||
let ufvk = try derivationTool
|
||||
.deriveUnifiedFullViewingKeysFromSeed(
|
||||
TestSeed().seed(),
|
||||
numberOfAccounts: 1
|
||||
)
|
||||
|
@ -76,7 +76,7 @@ class TestCoordinator {
|
|||
|
||||
try self.init(
|
||||
spendingKey: spendingKey,
|
||||
unifiedViewingKey: uvk,
|
||||
unifiedFullViewingKey: ufvk,
|
||||
walletBirthday: walletBirthday,
|
||||
channelProvider: channelProvider,
|
||||
network: network
|
||||
|
@ -85,7 +85,7 @@ class TestCoordinator {
|
|||
|
||||
required init(
|
||||
spendingKey: String,
|
||||
unifiedViewingKey: UnifiedViewingKey,
|
||||
unifiedFullViewingKey: UnifiedFullViewingKey,
|
||||
walletBirthday: BlockHeight,
|
||||
channelProvider: ChannelProvider,
|
||||
network: ZcashNetwork
|
||||
|
@ -124,7 +124,7 @@ class TestCoordinator {
|
|||
spendParamsURL: try __spendParamsURL(),
|
||||
outputParamsURL: try __outputParamsURL(),
|
||||
spendingKey: spendingKey,
|
||||
unifiedViewingKey: unifiedViewingKey,
|
||||
unifiedFullViewingKey: unifiedFullViewingKey,
|
||||
walletBirthday: walletBirthday,
|
||||
network: network,
|
||||
loggerProxy: SampleLogger(logLevel: .debug)
|
||||
|
@ -288,7 +288,7 @@ enum TestSynchronizerBuilder {
|
|||
spendParamsURL: URL,
|
||||
outputParamsURL: URL,
|
||||
spendingKey: String,
|
||||
unifiedViewingKey: UnifiedViewingKey,
|
||||
unifiedFullViewingKey: UnifiedFullViewingKey,
|
||||
walletBirthday: BlockHeight,
|
||||
network: ZcashNetwork,
|
||||
loggerProxy: Logger? = nil
|
||||
|
@ -301,7 +301,7 @@ enum TestSynchronizerBuilder {
|
|||
network: network,
|
||||
spendParamsURL: spendParamsURL,
|
||||
outputParamsURL: outputParamsURL,
|
||||
viewingKeys: [unifiedViewingKey],
|
||||
viewingKeys: [unifiedFullViewingKey],
|
||||
walletBirthday: walletBirthday,
|
||||
alias: "",
|
||||
loggerProxy: loggerProxy
|
||||
|
@ -340,7 +340,7 @@ enum TestSynchronizerBuilder {
|
|||
}
|
||||
|
||||
guard let uvk = try DerivationTool(networkType: network.networkType)
|
||||
.deriveUnifiedViewingKeysFromSeed(seedBytes, numberOfAccounts: 1)
|
||||
.deriveUnifiedFullViewingKeysFromSeed(seedBytes, numberOfAccounts: 1)
|
||||
.first
|
||||
else {
|
||||
throw TestCoordinator.CoordinatorError.builderError
|
||||
|
@ -360,7 +360,7 @@ enum TestSynchronizerBuilder {
|
|||
spendParamsURL: spendParamsURL,
|
||||
outputParamsURL: outputParamsURL,
|
||||
spendingKey: spendingKey,
|
||||
unifiedViewingKey: uvk,
|
||||
unifiedFullViewingKey: uvk,
|
||||
walletBirthday: walletBirthday,
|
||||
network: network
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue