Merge pull request #582 from zcash/fix_transparent_balance_error_handling
[#581] getTransparentBalanceForAccount error not handled
This commit is contained in:
commit
c2177fe83f
|
@ -140,8 +140,7 @@
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/zcash-hackworks/zcash-light-client-ffi",
|
"location" : "https://github.com/zcash-hackworks/zcash-light-client-ffi",
|
||||||
"state" : {
|
"state" : {
|
||||||
"branch" : "bin/librustzcash_0_7",
|
"revision" : "9ca1958bb4d7755b7d3ca29d176483b4127f1259"
|
||||||
"revision" : "e8fbb84c1bec44af9dbef7e27c85f25e8f51a5af"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/zcash-hackworks/zcash-light-client-ffi",
|
"location" : "https://github.com/zcash-hackworks/zcash-light-client-ffi",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "57c2de3825aab0ab8b5f4100dc0184e52ca86ba1"
|
"revision" : "b9915d53cf563a31722e70a4388e9dce72ea6194"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -16,7 +16,7 @@ let package = Package(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.8.0"),
|
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.8.0"),
|
||||||
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.13.0"),
|
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.13.0"),
|
||||||
.package(name:"libzcashlc", url: "https://github.com/zcash-hackworks/zcash-light-client-ffi", revision: "57c2de3825aab0ab8b5f4100dc0184e52ca86ba1")
|
.package(name:"libzcashlc", url: "https://github.com/zcash-hackworks/zcash-light-client-ffi", revision: "b9915d53cf563a31722e70a4388e9dce72ea6194")
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
.target(
|
.target(
|
||||||
|
|
|
@ -267,12 +267,18 @@ class ZcashRustBackend: ZcashRustBackendWelding {
|
||||||
}
|
}
|
||||||
|
|
||||||
let dbData = dbData.osStr()
|
let dbData = dbData.osStr()
|
||||||
return zcashlc_get_total_transparent_balance_for_account(
|
let balance = zcashlc_get_total_transparent_balance_for_account(
|
||||||
dbData.0,
|
dbData.0,
|
||||||
dbData.1,
|
dbData.1,
|
||||||
networkType.networkId,
|
networkType.networkId,
|
||||||
account
|
account
|
||||||
)
|
)
|
||||||
|
|
||||||
|
guard balance >= 0 else {
|
||||||
|
throw throwDataDbError(lastError() ?? .genericError(message: "Error getting Total Transparent balance from account \(account)"))
|
||||||
|
}
|
||||||
|
|
||||||
|
return balance
|
||||||
}
|
}
|
||||||
|
|
||||||
static func getVerifiedBalance(dbData: URL, account: Int32, networkType: NetworkType) -> Int64 {
|
static func getVerifiedBalance(dbData: URL, account: Int32, networkType: NetworkType) -> Int64 {
|
||||||
|
|
Loading…
Reference in New Issue