Skip to content

Commit

Permalink
Fix rebase/merge conflicts and compile errors derived from it
Browse files Browse the repository at this point in the history
  • Loading branch information
pacu committed Aug 26, 2022
1 parent 134f453 commit ed2dc40
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
"package": "libzcashlc",
"repositoryURL": "https://github.com/zcash-hackworks/zcash-light-client-ffi",
"state": {
"branch": "shield_funds_to_zip_316",
"revision": "63e26a09715486a9ac378e7276cf4f2c09044c57",
"branch": "bin/shield_funds_to_zip_316",
"revision": "2c427bfece56a036bb0370764e4a045c2e456aa5",
"version": null
}
}
Expand Down
11 changes: 0 additions & 11 deletions Sources/ZcashLightClientKit/Entity/AccountEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ struct Account: AccountEntity, Encodable, Decodable {
var transparentAddress: String
}

extension Account: UnifiedAddress {
var encoding: String {
get {
address
}
set {
address = newValue
}
}
}

extension Account: Hashable {
func hash(into hasher: inout Hasher) {
hasher.combine(account)
Expand Down
9 changes: 6 additions & 3 deletions Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import libzcashlc

class ZcashRustBackend: ZcashRustBackendWelding {

static let minimumConfirmations: UInt32 = 10

static func lastError() -> RustWeldingError? {
guard let message = getLastError() else { return nil }

Expand Down Expand Up @@ -254,7 +256,7 @@ class ZcashRustBackend: ZcashRustBackendWelding {

static func getVerifiedBalance(dbData: URL, account: Int32, networkType: NetworkType) -> Int64 {
let dbData = dbData.osStr()
return zcashlc_get_verified_balance(dbData.0, dbData.1, account, networkType.networkId)
return zcashlc_get_verified_balance(dbData.0, dbData.1, account, networkType.networkId, minimumConfirmations)
}

static func getVerifiedTransparentBalance(dbData: URL, address: String, networkType: NetworkType) throws -> Int64 {
Expand All @@ -268,7 +270,7 @@ class ZcashRustBackend: ZcashRustBackendWelding {

let dbData = dbData.osStr()

return zcashlc_get_verified_transparent_balance(dbData.0, dbData.1, [CChar](address.utf8CString), networkType.networkId)
return zcashlc_get_verified_transparent_balance(dbData.0, dbData.1, [CChar](address.utf8CString), networkType.networkId, minimumConfirmations)
}

static func getTransparentBalance(dbData: URL, address: String, networkType: NetworkType) throws -> Int64 {
Expand Down Expand Up @@ -418,7 +420,8 @@ class ZcashRustBackend: ZcashRustBackendWelding {
UInt(spendParamsPath.lengthOfBytes(using: .utf8)),
outputParamsPath,
UInt(outputParamsPath.lengthOfBytes(using: .utf8)),
networkType.networkId
networkType.networkId,
minimumConfirmations
)
}

Expand Down
11 changes: 10 additions & 1 deletion Sources/ZcashLightClientKit/Rust/ZcashRustBackendWelding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ enum ZcashRustBackendWeldingConstants {
static let validChain: Int32 = -1
}

/**
Enumeration of potential return states for database initialization. If `seedRequired` is returned, the caller must
re-attempt initialization providing the seed
*/
public enum DbInitResult {
case success
case seedRequired
}

protocol ZcashRustBackendWelding {
/**
gets the latest error if available. Clear the existing error
Expand All @@ -37,7 +46,7 @@ protocol ZcashRustBackendWelding {
initializes the data db
- Parameter dbData: location of the data db sql file
*/
static func initDataDb(dbData: URL, networkType: NetworkType) throws
static func initDataDb(dbData: URL, seed: [UInt8]?, networkType: NetworkType) throws -> DbInitResult

/**
- Returns: true when the address is valid and shielded. Returns false in any other case
Expand Down

0 comments on commit ed2dc40

Please # to comment.