react-native-zcash 0.6.10 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2460000.json +8 -0
  3. package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +937 -425
  4. package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +17 -31
  5. package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +2 -2
  6. package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +15 -46
  7. package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +15 -4
  8. package/ios/ZCashLightClientKit/Block/FilesystemStorage/FSCompactBlockRepository.swift +4 -4
  9. package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +35 -10
  10. package/ios/ZCashLightClientKit/Block/Utils/InternalSyncProgress.swift +200 -0
  11. package/ios/ZCashLightClientKit/Block/Validate/BlockValidator.swift +51 -0
  12. package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +2 -1
  13. package/ios/ZCashLightClientKit/CombineSynchronizer.swift +5 -2
  14. package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +26 -13
  15. package/ios/ZCashLightClientKit/DAO/BlockDao.swift +112 -0
  16. package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +42 -40
  17. package/ios/ZCashLightClientKit/DAO/UnspentTransactionOutputDao.swift +4 -13
  18. package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +0 -9
  19. package/ios/ZCashLightClientKit/Entity/BlockProgress.swift +24 -0
  20. package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +10 -7
  21. package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
  22. package/ios/ZCashLightClientKit/Error/ZcashError.swift +12 -121
  23. package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +5 -43
  24. package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +6 -72
  25. package/ios/ZCashLightClientKit/Initializer.swift +26 -47
  26. package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +12 -0
  27. package/ios/ZCashLightClientKit/Model/Checkpoint.swift +0 -12
  28. package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +0 -15
  29. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/compact_formats.pb.swift +46 -150
  30. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/compact_formats.proto +16 -30
  31. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/service.proto +6 -32
  32. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.grpc.swift +22 -259
  33. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.pb.swift +7 -193
  34. package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +0 -8
  35. package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +28 -18
  36. package/ios/ZCashLightClientKit/Repository/CompactBlockRepository.swift +1 -1
  37. package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +6 -2
  38. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2460000.json +8 -0
  39. package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +158 -293
  40. package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +64 -58
  41. package/ios/ZCashLightClientKit/Rust/zcashlc.h +513 -619
  42. package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +8 -2
  43. package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +15 -3
  44. package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +30 -11
  45. package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +50 -41
  46. package/ios/ZCashLightClientKit/Synchronizer.swift +65 -51
  47. package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +2 -2
  48. package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +7 -7
  49. package/ios/ZCashLightClientKit/Utils/OSLogger.swift +3 -3
  50. package/ios/libzcashlc.xcframework/Info.plist +0 -4
  51. package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
  52. package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
  53. package/package.json +1 -1
  54. package/ios/ZCashLightClientKit/Block/Actions/Action.swift +0 -98
  55. package/ios/ZCashLightClientKit/Block/Actions/ClearAlreadyScannedBlocksAction.swift +0 -35
  56. package/ios/ZCashLightClientKit/Block/Actions/ClearCacheAction.swift +0 -30
  57. package/ios/ZCashLightClientKit/Block/Actions/DownloadAction.swift +0 -67
  58. package/ios/ZCashLightClientKit/Block/Actions/EnhanceAction.swift +0 -97
  59. package/ios/ZCashLightClientKit/Block/Actions/FetchUTXOsAction.swift +0 -33
  60. package/ios/ZCashLightClientKit/Block/Actions/MigrateLegacyCacheDBAction.swift +0 -70
  61. package/ios/ZCashLightClientKit/Block/Actions/ProcessSuggestedScanRangesAction.swift +0 -60
  62. package/ios/ZCashLightClientKit/Block/Actions/RewindAction.swift +0 -48
  63. package/ios/ZCashLightClientKit/Block/Actions/SaplingParamsAction.swift +0 -33
  64. package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +0 -95
  65. package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +0 -55
  66. package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +0 -58
  67. package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +0 -60
  68. package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +0 -24
  69. package/ios/ZCashLightClientKit/Block/Utils/SyncControlData.swift +0 -25
  70. package/ios/ZCashLightClientKit/Extensions/Bool+ToData.swift +0 -15
  71. package/ios/ZCashLightClientKit/Extensions/Data+ToOtherTypes.swift +0 -18
  72. package/ios/ZCashLightClientKit/Extensions/Int+ToData.swift +0 -15
  73. package/ios/ZCashLightClientKit/Model/ScanProgress.swift +0 -29
  74. package/ios/ZCashLightClientKit/Model/ScanRange.swift +0 -31
  75. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2092500.json +0 -8
  76. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2095000.json +0 -8
  77. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2097500.json +0 -8
  78. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2102500.json +0 -8
  79. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2105000.json +0 -8
  80. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2107500.json +0 -8
  81. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2112500.json +0 -8
  82. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2115000.json +0 -8
  83. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2117500.json +0 -8
  84. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2122500.json +0 -8
  85. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2125000.json +0 -8
  86. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2127500.json +0 -8
  87. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2132500.json +0 -8
  88. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2135000.json +0 -8
  89. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2137500.json +0 -8
  90. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2142500.json +0 -8
  91. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2145000.json +0 -8
  92. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2147500.json +0 -8
  93. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2152500.json +0 -8
  94. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2155000.json +0 -8
  95. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2157500.json +0 -8
  96. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2162500.json +0 -8
  97. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2165000.json +0 -8
  98. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2167500.json +0 -8
  99. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2172500.json +0 -8
  100. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2175000.json +0 -8
  101. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2177500.json +0 -8
  102. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2182500.json +0 -8
  103. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2185000.json +0 -8
  104. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2187500.json +0 -8
  105. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2192500.json +0 -8
  106. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2195000.json +0 -8
  107. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2197500.json +0 -8
  108. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2202500.json +0 -8
  109. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2205000.json +0 -8
  110. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2207500.json +0 -8
  111. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2212500.json +0 -8
  112. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2215000.json +0 -8
  113. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2217500.json +0 -8
  114. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2222500.json +0 -8
  115. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2225000.json +0 -8
  116. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2227500.json +0 -8
  117. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2232500.json +0 -8
  118. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2235000.json +0 -8
  119. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2237500.json +0 -8
  120. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2242500.json +0 -8
  121. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2245000.json +0 -8
  122. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2247500.json +0 -8
  123. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2252500.json +0 -8
  124. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2255000.json +0 -8
  125. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2257500.json +0 -8
  126. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2262500.json +0 -8
  127. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2265000.json +0 -8
  128. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2267500.json +0 -8
  129. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2350000.json +0 -8
  130. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2360000.json +0 -8
  131. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2370000.json +0 -8
  132. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2380000.json +0 -8
  133. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2390000.json +0 -8
  134. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2400000.json +0 -8
  135. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2410000.json +0 -8
  136. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2420000.json +0 -8
  137. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2430000.json +0 -8
  138. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2440000.json +0 -8
  139. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2450000.json +0 -8
  140. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2460000.json +0 -8
  141. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2470000.json +0 -8
  142. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2480000.json +0 -8
  143. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2490000.json +0 -8
  144. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2500000.json +0 -8
  145. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2510000.json +0 -8
  146. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2520000.json +0 -8
  147. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2530000.json +0 -8
  148. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2540000.json +0 -8
  149. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2550000.json +0 -8
  150. package/ios/ZCashLightClientKit/Utils/ZcashFileManager.swift +0 -16
@@ -35,11 +35,9 @@ protocol ZcashRustBackendWelding {
35
35
  /// have been received by the currently-available account (in order to enable
36
36
  /// automated account recovery).
37
37
  /// - parameter seed: byte array of the zip32 seed
38
- /// - parameter treeState: The TreeState Protobuf object for the height prior to the account birthday
39
- /// - parameter recoverUntil: the fully-scanned height up to which the account will be treated as "being recovered"
40
38
  /// - Returns: The `UnifiedSpendingKey` structs for the number of accounts created
41
39
  /// - Throws: `rustCreateAccount`.
42
- func createAccount(seed: [UInt8], treeState: TreeState, recoverUntil: UInt32?) async throws -> UnifiedSpendingKey
40
+ func createAccount(seed: [UInt8]) async throws -> UnifiedSpendingKey
43
41
 
44
42
  /// Creates a transaction to the given address from the given account
45
43
  /// - Parameter usk: `UnifiedSpendingKey` for the account that controls the funds to be spent.
@@ -52,7 +50,7 @@ protocol ZcashRustBackendWelding {
52
50
  to address: String,
53
51
  value: Int64,
54
52
  memo: MemoBytes?
55
- ) async throws -> Data
53
+ ) async throws -> Int64
56
54
 
57
55
  /// Scans a transaction for any information that can be decrypted by the accounts in the wallet, and saves it to the wallet.
58
56
  /// - parameter tx: the transaction to decrypt
@@ -91,10 +89,14 @@ protocol ZcashRustBackendWelding {
91
89
  /// - `rustGetNextAvailableAddressInvalidAddress` if generated unified address isn't valid.
92
90
  func getNextAvailableAddress(account: Int32) async throws -> UnifiedAddress
93
91
 
94
- /// Get memo from note.
95
- /// - parameter txId: ID of transaction containing the note
96
- /// - parameter outputIndex: output index of note
97
- func getMemo(txId: Data, outputIndex: UInt16) async throws -> Memo?
92
+ /// Get received memo from note.
93
+ /// - parameter idNote: note_id of note where the memo is located
94
+ func getReceivedMemo(idNote: Int64) async -> Memo?
95
+
96
+ /// Get sent memo from note.
97
+ /// - parameter idNote: note_id of note where the memo is located
98
+ /// - Returns: a `Memo` if any
99
+ func getSentMemo(idNote: Int64) async -> Memo?
98
100
 
99
101
  /// Get the verified cached transparent balance for the given address
100
102
  /// - parameter account; the account index to query
@@ -103,6 +105,14 @@ protocol ZcashRustBackendWelding {
103
105
  /// - `rustGetTransparentBalance` if rust layer returns error.
104
106
  func getTransparentBalance(account: Int32) async throws -> Int64
105
107
 
108
+ /// Initialize the accounts table from a set of unified full viewing keys.
109
+ /// - Note: this function should only be used when restoring an existing seed phrase. when creating a new wallet, use `createAccount()` instead.
110
+ /// - Parameter ufvks: an array of UnifiedFullViewingKeys
111
+ /// - Throws:
112
+ /// - `rustInitAccountsTableViewingKeyCotainsNullBytes` if any of the key in `ufvks` contains null bytes before end.
113
+ /// - `rustInitAccountsTableViewingKeyIsInvalid` if any of the key in `ufvks` isn't valid.
114
+ func initAccountsTable(ufvks: [UnifiedFullViewingKey]) async throws
115
+
106
116
  /// Initializes the data db. This will performs any migrations needed on the sqlite file
107
117
  /// provided. Some migrations might need that callers provide the seed bytes.
108
118
  /// - Parameter seed: ZIP-32 compliant seed bytes for this wallet
@@ -112,6 +122,23 @@ protocol ZcashRustBackendWelding {
112
122
  /// Throws `rustInitDataDb` if rust layer returns error.
113
123
  func initDataDb(seed: [UInt8]?) async throws -> DbInitResult
114
124
 
125
+ /// Initialize the blocks table from a given checkpoint (heigh, hash, time, saplingTree and networkType).
126
+ /// - parameter height: represents the block height of the given checkpoint
127
+ /// - parameter hash: hash of the merkle tree
128
+ /// - parameter time: in milliseconds from reference
129
+ /// - parameter saplingTree: hash of the sapling tree
130
+ /// - Throws:
131
+ /// - `rustInitBlocksTableHashContainsNullBytes` if `hash` contains null bytes before end.
132
+ /// - `rustInitBlocksTableSaplingTreeContainsNullBytes` if `saplingTree` contains null bytes before end.
133
+ /// - `rustInitBlocksTableDataDbNotEmpty` if data DB is not empty.
134
+ /// - `rustInitBlocksTable` if rust layer returns error.
135
+ func initBlocksTable(
136
+ height: Int32,
137
+ hash: String,
138
+ time: UInt32,
139
+ saplingTree: String
140
+ ) async throws
141
+
115
142
  /// Returns a list of the transparent receivers for the diversified unified addresses that have
116
143
  /// been allocated for the provided account.
117
144
  /// - parameter account: index of the given account
@@ -132,6 +159,26 @@ protocol ZcashRustBackendWelding {
132
159
  /// - `rustGetVerifiedTransparentBalance` if rust layer returns error.
133
160
  func getVerifiedTransparentBalance(account: Int32) async throws -> Int64
134
161
 
162
+ /// Checks that the scanned blocks in the data database, when combined with the recent
163
+ /// `CompactBlock`s in the cache database, form a valid chain.
164
+ /// This function is built on the core assumption that the information provided in the
165
+ /// cache database is more likely to be accurate than the previously-scanned information.
166
+ /// This follows from the design (and trust) assumption that the `lightwalletd` server
167
+ /// provides accurate block information as of the time it was requested.
168
+ /// - parameter fsBlockDbRoot: `URL` pointing to the filesystem root directory where the fsBlock cache is.
169
+ /// this directory is expected to contain a `/blocks` sub-directory with the blocks stored in the convened filename
170
+ /// format `{height}-{hash}-block`. This directory has must be granted both write and read permissions.
171
+ /// - parameter dbData: location of the data db file
172
+ /// - parameter networkType: the network type
173
+ /// - parameter limit: a limit to validate a fixed number of blocks instead of the whole cache.
174
+ /// - Throws:
175
+ /// - `rustValidateCombinedChainValidationFailed` if there was an error during validation unrelated to chain validity.
176
+ /// - `rustValidateCombinedChainInvalidChain(upperBound)` if the combined chain is invalid. `upperBound` is the height of the highest invalid
177
+ /// block(on the assumption that the highest block in the cache database is correct).
178
+ ///
179
+ /// - Important: This function does not mutate either of the databases.
180
+ func validateCombinedChain(limit: UInt32) async throws
181
+
135
182
  /// Resets the state of the database to only contain block and transaction information up to the given height. clears up all derived data as well
136
183
  /// - parameter height: height to rewind to.
137
184
  /// - Throws: `rustRewindToHeight` if rust layer returns error.
@@ -143,62 +190,21 @@ protocol ZcashRustBackendWelding {
143
190
  /// - Throws: `rustRewindCacheToHeight` if rust layer returns error.
144
191
  func rewindCacheToHeight(height: Int32) async throws
145
192
 
146
- func putSaplingSubtreeRoots(startIndex: UInt64, roots: [SubtreeRoot]) async throws
147
-
148
- /// Updates the wallet's view of the blockchain.
149
- ///
150
- /// This method is used to provide the wallet with information about the state of the blockchain,
151
- /// and detect any previously scanned data that needs to be re-validated before proceeding with
152
- /// scanning. It should be called at wallet startup prior to calling `suggestScanRanges`
153
- /// in order to provide the wallet with the information it needs to correctly prioritize scanning
154
- /// operations.
155
- func updateChainTip(height: Int32) async throws
156
-
157
- /// Returns the height to which the wallet has been fully scanned.
158
- ///
159
- /// This is the height for which the wallet has fully trial-decrypted this and all
160
- /// preceding blocks beginning with the wallet's birthday height.
161
- func fullyScannedHeight() async throws -> BlockHeight?
162
-
163
- /// Returns the maximum height that the wallet has scanned.
164
- ///
165
- /// If the wallet is fully synced, this will be equivalent to `fullyScannedHeight`;
166
- /// otherwise the maximal scanned height is likely to be greater than the fully scanned
167
- /// height due to the fact that out-of-order scanning can leave gaps.
168
- func maxScannedHeight() async throws -> BlockHeight?
169
-
170
- /// Returns the scan progress derived from the current wallet state.
171
- func getScanProgress() async throws -> ScanProgress?
172
-
173
- /// Returns a list of suggested scan ranges based upon the current wallet state.
174
- ///
175
- /// This method should only be used in cases where the `CompactBlock` data that will be
176
- /// made available to `scanBlocks` for the requested block ranges includes note
177
- /// commitment tree size information for each block; or else the scan is likely to fail if
178
- /// notes belonging to the wallet are detected.
179
- func suggestScanRanges() async throws -> [ScanRange]
180
-
181
193
  /// Scans new blocks added to the cache for any transactions received by the tracked
182
- /// accounts, while checking that they form a valid chan.
183
- ///
184
- /// This function is built on the core assumption that the information provided in the
185
- /// block cache is more likely to be accurate than the previously-scanned information.
186
- /// This follows from the design (and trust) assumption that the `lightwalletd` server
187
- /// provides accurate block information as of the time it was requested.
188
- ///
189
- /// This function **assumes** that the caller is handling rollbacks.
190
- ///
194
+ /// accounts.
195
+ /// This function pays attention only to cached blocks with heights greater than the
196
+ /// highest scanned block in `db_data`. Cached blocks with lower heights are not verified
197
+ /// against previously-scanned blocks. In particular, this function **assumes** that the
198
+ /// caller is handling rollbacks.
191
199
  /// For brand-new light client databases, this function starts scanning from the Sapling
192
200
  /// activation height. This height can be fast-forwarded to a more recent block by calling
193
201
  /// [`initBlocksTable`] before this function.
194
- ///
195
202
  /// Scanned blocks are required to be height-sequential. If a block is missing from the
196
203
  /// cache, an error will be signalled.
197
204
  ///
198
- /// - parameter fromHeight: scan starting from the given height.
199
- /// - parameter limit: scan up to limit blocks.
205
+ /// - parameter limit: scan up to limit blocks. pass 0 to set no limit.
200
206
  /// - Throws: `rustScanBlocks` if rust layer returns error.
201
- func scanBlocks(fromHeight: Int32, limit: UInt32) async throws
207
+ func scanBlocks(limit: UInt32) async throws
202
208
 
203
209
  /// Upserts a UTXO into the data db database
204
210
  /// - parameter txid: the txid bytes for the UTXO
@@ -223,7 +229,7 @@ protocol ZcashRustBackendWelding {
223
229
  usk: UnifiedSpendingKey,
224
230
  memo: MemoBytes?,
225
231
  shieldingThreshold: Zatoshi
226
- ) async throws -> Data
232
+ ) async throws -> Int64
227
233
 
228
234
  /// Gets the consensus branch id for the given height
229
235
  /// - Parameter height: the height you what to know the branch id for
@@ -246,5 +252,5 @@ protocol ZcashRustBackendWelding {
246
252
  /// this directory is expected to contain a `/blocks` sub-directory with the blocks stored in the convened filename
247
253
  /// format `{height}-{hash}-block`. This directory has must be granted both write and read permissions.
248
254
  /// - Returns `BlockHeight` of the latest cached block or `.empty` if no blocks are stored.
249
- func latestCachedBlockHeight() async throws -> BlockHeight
255
+ func latestCachedBlockHeight() async -> BlockHeight
250
256
  }