Fix warnings
This commit is contained in:
parent
1f21540fd6
commit
b58c20b3b0
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
// Created by Francisco Gindre on 10/9/20.
|
||||
//
|
||||
|
||||
//swiftlint:disable force_unwrapping
|
||||
import XCTest
|
||||
import ZcashLightClientKit
|
||||
|
||||
|
|
|
@ -151,7 +151,6 @@ class MigrationManager {
|
|||
}
|
||||
let derivationTool = DerivationTool.default
|
||||
|
||||
|
||||
for tuple in zip(accounts, viewingKeys) {
|
||||
let tAddr = try derivationTool.deriveTransparentAddressFromPublicKey(tuple.1.extpub)
|
||||
var account = tuple.0
|
||||
|
|
|
@ -138,7 +138,6 @@ class CompactBlockStreamDownloadOperation: ZcashOperation {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class CompactBlockBatchDownloadOperation: ZcashOperation {
|
||||
enum CompactBlockBatchDownloadOperationError: Error {
|
||||
case startHeightMissing
|
||||
|
|
|
@ -93,7 +93,6 @@ public enum CompactBlockProgress {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protocol EnhancementStreamDelegate: AnyObject {
|
||||
func transactionEnhancementProgressUpdated(_ progress: EnhancementProgress)
|
||||
}
|
||||
|
@ -116,7 +115,6 @@ public struct EnhancementStreamProgress: EnhancementProgress {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public extension Notification.Name {
|
||||
/**
|
||||
Processing progress update
|
||||
|
@ -503,7 +501,6 @@ public class CompactBlockProcessor {
|
|||
|
||||
func validateServerInfo(_ info: LightWalletdInfo) throws {
|
||||
|
||||
|
||||
do {
|
||||
// check network types
|
||||
guard let remoteNetworkType = ZcashSDK.NetworkType(info.chainName) else {
|
||||
|
@ -560,7 +557,6 @@ public class CompactBlockProcessor {
|
|||
public func rewindTo(_ height: BlockHeight?) throws -> BlockHeight {
|
||||
self.stop()
|
||||
|
||||
|
||||
let lastDownloaded = try downloader.lastDownloadedBlockHeight()
|
||||
let height = Int32(height ?? lastDownloaded)
|
||||
let nearestHeight = rustBackend.getNearestRewindHeight(dbData: config.dataDb, height: height)
|
||||
|
@ -810,7 +806,7 @@ public class CompactBlockProcessor {
|
|||
|
||||
func notifyProgress(_ progress: CompactBlockProgress) {
|
||||
|
||||
var userInfo = [AnyHashable : Any]()
|
||||
var userInfo = [AnyHashable: Any]()
|
||||
userInfo[CompactBlockProcessorNotificationKey.progress] = progress
|
||||
|
||||
LoggerProxy.debug("""
|
||||
|
@ -1248,7 +1244,6 @@ extension CompactBlockProcessor: CompactBlockProgressDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
extension CompactBlockProcessor: EnhancementStreamDelegate {
|
||||
func transactionEnhancementProgressUpdated(_ progress: EnhancementProgress) {
|
||||
NotificationCenter.default.post(name: .blockProcessorEnhancementProgress, object: self, userInfo: [ CompactBlockProcessorNotificationKey.enhancementProgress : progress])
|
||||
|
|
|
@ -65,7 +65,7 @@ public class SDKMetrics {
|
|||
static func blockReportFromNotification(_ notification: Notification) -> BlockMetricReport? {
|
||||
|
||||
guard notification.name == notificationName,
|
||||
let info = notification.userInfo,
|
||||
let info = notification.userInfo,
|
||||
let startHeight = info[startBlockHeightKey] as? BlockHeight,
|
||||
let targetHeight = info[targetBlockHeightKey] as? BlockHeight,
|
||||
let task = info[taskReportedKey] as? TaskReported,
|
||||
|
|
|
@ -37,9 +37,7 @@ class ZcashOperation: Operation {
|
|||
self.init()
|
||||
self.handlerDispatchQueue = completionDispatchQueue
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func shouldCancel() -> Bool {
|
||||
self.error != nil || isCancelled || dependencyCancelled()
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ protocol AccountEntity {
|
|||
var transparentAddress: String { get set }
|
||||
}
|
||||
|
||||
|
||||
struct Account: AccountEntity, Encodable, Decodable {
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
|
@ -129,7 +128,7 @@ class AccountSQDAO: AccountRepository {
|
|||
class CachingAccountDao: AccountRepository {
|
||||
|
||||
var dao: AccountRepository
|
||||
lazy var cache: [Int : AccountEntity] = {
|
||||
lazy var cache: [Int: AccountEntity] = {
|
||||
var c = [Int : AccountEntity]()
|
||||
guard let all = try? dao.getAll() else {
|
||||
return c
|
||||
|
@ -146,7 +145,7 @@ class CachingAccountDao: AccountRepository {
|
|||
|
||||
func getAll() throws -> [AccountEntity] {
|
||||
guard cache.isEmpty else {
|
||||
return cache.values.sorted(by: {$0.account < $1.account})
|
||||
return cache.values.sorted(by: { $0.account < $1.account })
|
||||
}
|
||||
let all = try dao.getAll()
|
||||
|
||||
|
|
|
@ -149,9 +149,7 @@ public class Initializer {
|
|||
self.walletBirthday = WalletBirthday.birthday(with: walletBirthday)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Initialize the wallet with the given seed and return the related private keys for each
|
||||
account specified or null if the wallet was previously initialized and block data exists on
|
||||
disk. When this method returns null, that signals that the wallet will need to retrieve the
|
||||
|
|
|
@ -32,12 +32,10 @@ public struct WalletBirthday {
|
|||
public private(set) var tree: String = ""
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Groups a Sapling Extended Full Viewing Key an a tranparent address extended public key.
|
||||
*/
|
||||
|
||||
|
||||
public typealias ExtendedFullViewingKey = String
|
||||
public typealias ExtendedPublicKey = String
|
||||
|
||||
|
@ -46,7 +44,6 @@ public protocol UnifiedViewingKey {
|
|||
var extpub: ExtendedPublicKey { get set }
|
||||
}
|
||||
|
||||
|
||||
public typealias TransparentAddress = String
|
||||
public typealias SaplingShieldedAddress = String
|
||||
|
||||
|
|
|
@ -125,11 +125,9 @@ class ZcashRustBackend: ZcashRustBackendWelding {
|
|||
let extpubPtr = UnsafeMutablePointer<CChar>.allocate(capacity: extpubCStr.count)
|
||||
extpubPtr.initialize(from:extpubCStr, count: extpubCStr.count)
|
||||
|
||||
|
||||
ffiUvks.append(FFIUnifiedViewingKey(extfvk: extfvkPtr, extpub: extpubPtr))
|
||||
}
|
||||
|
||||
|
||||
var result = false
|
||||
ffiUvks.withContiguousMutableStorageIfAvailable { p in
|
||||
let slice = UnsafeMutablePointer<FFIUVKBoxedSlice>.allocate(capacity: 1)
|
||||
|
@ -137,7 +135,6 @@ class ZcashRustBackend: ZcashRustBackendWelding {
|
|||
|
||||
result = zcashlc_init_accounts_table_with_keys(dbData.0, dbData.1, slice)
|
||||
slice.deinitialize(count: 1)
|
||||
// slice.deallocate()
|
||||
}
|
||||
|
||||
defer {
|
||||
|
|
|
@ -72,7 +72,6 @@ public protocol ZcashRustBackendWelding {
|
|||
*/
|
||||
static func initAccountsTable(dbData: URL, uvks: [UnifiedViewingKey]) throws -> Bool
|
||||
|
||||
|
||||
/**
|
||||
initialize the blocks table from a given checkpoint (birthday)
|
||||
- Parameters:
|
||||
|
@ -199,7 +198,6 @@ public protocol ZcashRustBackendWelding {
|
|||
*/
|
||||
static func putUnspentTransparentOutput(dbData: URL, address: String, txid: [UInt8], index: Int, script: [UInt8], value: Int64, height: BlockHeight) throws -> Bool
|
||||
|
||||
|
||||
/**
|
||||
clears the cached utxos for the given address from the specified height on
|
||||
- Parameters:
|
||||
|
|
|
@ -314,7 +314,6 @@ extension LightWalletGRPCService: LightWalletService {
|
|||
case .ok:
|
||||
result(.success(blocks.asZcashCompactBlocks()))
|
||||
|
||||
|
||||
default:
|
||||
result(.failure(.mapCode(status)))
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ public enum ConnectionState {
|
|||
case shutdown
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Primary interface for interacting with the SDK. Defines the contract that specific
|
||||
implementations like SdkSynchronizer fulfill.
|
||||
|
@ -291,7 +290,6 @@ public enum SyncStatus: Equatable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Kind of transactions handled by a Synchronizer
|
||||
*/
|
||||
|
@ -315,9 +313,6 @@ public enum RewindPolicy {
|
|||
case quick
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
extension SyncStatus {
|
||||
public static func == (lhs: SyncStatus, rhs: SyncStatus) -> Bool {
|
||||
switch lhs {
|
||||
|
|
|
@ -326,10 +326,8 @@ extension DerivationTool: KeyValidation {
|
|||
throw KeyDerivationErrors.derivationError(underlyingError: error)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fileprivate struct ConcreteUnifiedAddress: UnifiedAddress {
|
||||
var tAddress: TransparentAddress
|
||||
var zAddress: SaplingShieldedAddress
|
||||
|
|
|
@ -327,9 +327,7 @@ public class SDKSynchronizer: Synchronizer {
|
|||
let progress = userInfo[CompactBlockProcessorNotificationKey.progress] as? CompactBlockProgress else {
|
||||
return
|
||||
}
|
||||
var blockDate: Date? = nil
|
||||
|
||||
|
||||
self.notify(progress: progress)
|
||||
}
|
||||
|
||||
|
@ -608,7 +606,6 @@ public class SDKSynchronizer: Synchronizer {
|
|||
|
||||
var height: BlockHeight?
|
||||
|
||||
|
||||
switch policy {
|
||||
case .quick:
|
||||
break
|
||||
|
@ -637,7 +634,7 @@ public class SDKSynchronizer: Synchronizer {
|
|||
// MARK: notify state
|
||||
private func notify(progress: CompactBlockProgress) {
|
||||
|
||||
var userInfo = [AnyHashable : Any]()
|
||||
var userInfo = [AnyHashable: Any]()
|
||||
userInfo[NotificationKeys.progress] = progress
|
||||
userInfo[NotificationKeys.blockHeight] = progress.progressHeight
|
||||
userInfo[NotificationKeys.blockDate] = progress.progressHeight
|
||||
|
@ -807,8 +804,6 @@ extension ConnectionState {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fileprivate struct NullEnhancementProgress: EnhancementProgress {
|
||||
var totalTransactions: Int { 0 }
|
||||
var enhancedTransactions: Int { 0 }
|
||||
|
|
Loading…
Reference in New Issue