Fix Tests. deleted two obsolete ones

This commit is contained in:
Francisco Gindre 2021-05-07 15:50:50 -03:00
parent 39837009a4
commit 90c7a4d755
14 changed files with 33 additions and 395 deletions

View File

@ -33,16 +33,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if let wallet = wallet { if let wallet = wallet {
return wallet return wallet
} else { } else {
let unifiedViewingKeys = try! DerivationTool.default.deriveUnifiedViewingKeysFromSeed(DemoAppConfig.seed, numberOfAccounts: 1)
let wallet = Initializer(cacheDbURL:try! __cacheDbURL(), let wallet = Initializer(cacheDbURL:try! __cacheDbURL(),
dataDbURL: try! __dataDbURL(), dataDbURL: try! __dataDbURL(),
pendingDbURL: try! __pendingDbURL(), pendingDbURL: try! __pendingDbURL(),
endpoint: DemoAppConfig.endpoint, endpoint: DemoAppConfig.endpoint,
spendParamsURL: try! __spendParamsURL(), spendParamsURL: try! __spendParamsURL(),
outputParamsURL: try! __outputParamsURL(), outputParamsURL: try! __outputParamsURL(),
viewingKeys: unifiedViewingKeys,
loggerProxy: loggerProxy) loggerProxy: loggerProxy)
let unifiedViewingKeys = try! DerivationTool.default.deriveUnifiedViewingKeysFromSeed(DemoAppConfig.seed, numberOfAccounts: 1)
try! wallet.initialize(unifiedViewingKeys: unifiedViewingKeys, walletBirthday: DemoAppConfig.birthdayHeight) try! wallet.initialize()
var storage = SampleStorage.shared var storage = SampleStorage.shared
storage!.seed = Data(DemoAppConfig.seed) storage!.seed = Data(DemoAppConfig.seed)
storage!.privateKey = try! DerivationTool.default.deriveSpendingKeys(seed: DemoAppConfig.seed, numberOfAccounts: 1)[0] storage!.privateKey = try! DerivationTool.default.deriveSpendingKeys(seed: DemoAppConfig.seed, numberOfAccounts: 1)[0]

View File

@ -38,14 +38,8 @@ class MigrationManager {
static let latestCacheDbMigrationVersion: Int32 = CacheDbMigration.none.rawValue static let latestCacheDbMigrationVersion: Int32 = CacheDbMigration.none.rawValue
static let latestPendingDbMigrationVersion: Int32 = PendingDbMigration.none.rawValue static let latestPendingDbMigrationVersion: Int32 = PendingDbMigration.none.rawValue
func performMigration(seedBytes: [UInt8]) throws {
try migrateDataDb(seedBytes: seedBytes)
try migrateCacheDb()
try migratePendingDb()
}
func performMigration(uvks: [UnifiedViewingKey]) throws { func performMigration(uvks: [UnifiedViewingKey]) throws {
try performVersion1Migration(viewingKeys: uvks) try migrateDataDb(uvks: uvks)
try migrateCacheDb() try migrateCacheDb()
try migratePendingDb() try migratePendingDb()
} }
@ -76,7 +70,7 @@ class MigrationManager {
} }
} }
fileprivate func migrateDataDb(seedBytes: [UInt8]) throws { fileprivate func migrateDataDb(uvks: [UnifiedViewingKey]) throws {
let currentDataDbVersion = try dataDb.connection().getUserVersion() let currentDataDbVersion = try dataDb.connection().getUserVersion()
LoggerProxy.debug("Attempting to perform migration for data Db - currentVersion: \(currentDataDbVersion). Latest version is: \(Self.latestDataDbMigrationVersion)") LoggerProxy.debug("Attempting to perform migration for data Db - currentVersion: \(currentDataDbVersion). Latest version is: \(Self.latestDataDbMigrationVersion)")
@ -88,7 +82,7 @@ class MigrationManager {
} }
switch version { switch version {
case .version1: case .version1:
try performVersion1Migration(seedBytes) try performVersion1Migration(viewingKeys: uvks)
case .none: case .none:
break break
} }

View File

@ -737,7 +737,7 @@ public class CompactBlockProcessor {
Processor State: \(self.state) Processor State: \(self.state)
latestHeight: \(self.latestBlockHeight) latestHeight: \(self.latestBlockHeight)
attempts: \(self.retryAttempts) attempts: \(self.retryAttempts)
lowerbound: \(self.lowerBoundHeight) lowerbound: \(String(describing: self.lowerBoundHeight))
""") """)
try self.start() try self.start()
} else if self.maxAttemptsReached { } else if self.maxAttemptsReached {

View File

@ -34,11 +34,6 @@ public class LightWalletGRPCService {
let channel: Channel let channel: Channel
let connectionDelegate: ConnectionStatusManager let connectionDelegate: ConnectionStatusManager
let compactTxStreamer: CompactTxStreamerClient let compactTxStreamer: CompactTxStreamerClient
// public init(channel: Channel, timeout: TimeInterval = 10) {
// self.channel = channel
// compactTxStreamer = CompactTxStreamerClient(channel: self.channel, defaultCallOptions: Self.defaultCallOptions(with: timeout))
// }
public convenience init(endpoint: LightWalletEndpoint) { public convenience init(endpoint: LightWalletEndpoint) {
self.init(host: endpoint.host, port: endpoint.port, secure: endpoint.secure) self.init(host: endpoint.host, port: endpoint.port, secure: endpoint.secure)
@ -92,7 +87,7 @@ public class LightWalletGRPCService {
extension LightWalletGRPCService: LightWalletService { extension LightWalletGRPCService: LightWalletService {
public func closeConnection() { public func closeConnection() {
channel.close() _ = channel.close()
} }
public func fetchTransaction(txId: Data) throws -> TransactionEntity { public func fetchTransaction(txId: Data) throws -> TransactionEntity {

View File

@ -15,7 +15,7 @@ class BlockDownloaderTests: XCTestCase {
var storage: CompactBlockRepository! var storage: CompactBlockRepository!
var cacheDB = try! __cacheDbURL() var cacheDB = try! __cacheDbURL()
override func setUp() { override func setUp() {
service = LightWalletGRPCService(channel: ChannelProvider().channel()) service = LightWalletGRPCService(endpoint: LightWalletEndpointBuilder.default)
storage = try! TestDbBuilder.diskCompactBlockStorage(at: cacheDB) storage = try! TestDbBuilder.diskCompactBlockStorage(at: cacheDB)
downloader = CompactBlockDownloader(service: service, storage: storage) downloader = CompactBlockDownloader(service: service, storage: storage)
} }

View File

@ -45,7 +45,7 @@ class BlockScanOperationTests: XCTestCase {
let scanStartedExpect = XCTestExpectation(description: self.description + "scan started") let scanStartedExpect = XCTestExpectation(description: self.description + "scan started")
let scanExpect = XCTestExpectation(description: self.description + "scan") let scanExpect = XCTestExpectation(description: self.description + "scan")
let latestScannedBlockExpect = XCTestExpectation(description: self.description + "latestScannedHeight") let latestScannedBlockExpect = XCTestExpectation(description: self.description + "latestScannedHeight")
let service = LightWalletGRPCService(channel: ChannelProvider().channel()) let service = LightWalletGRPCService(endpoint: LightWalletEndpointBuilder.default)
let blockCount = 100 let blockCount = 100
let range = ZcashSDK.SAPLING_ACTIVATION_HEIGHT ... ZcashSDK.SAPLING_ACTIVATION_HEIGHT + blockCount let range = ZcashSDK.SAPLING_ACTIVATION_HEIGHT ... ZcashSDK.SAPLING_ACTIVATION_HEIGHT + blockCount
let downloadOperation = CompactBlockDownloadOperation(downloader: CompactBlockDownloader.sqlDownloader(service: service, at: cacheDbURL)!, range: range) let downloadOperation = CompactBlockDownloadOperation(downloader: CompactBlockDownloader.sqlDownloader(service: service, at: cacheDbURL)!, range: range)

View File

@ -21,7 +21,7 @@ class DownloadOperationTests: XCTestCase {
func testSingleOperation() { func testSingleOperation() {
let expect = XCTestExpectation(description: self.description) let expect = XCTestExpectation(description: self.description)
let service = LightWalletGRPCService(channel: ChannelProvider().channel()) let service = LightWalletGRPCService(endpoint: LightWalletEndpointBuilder.default)
let storage = try! TestDbBuilder.inMemoryCompactBlockStorage() let storage = try! TestDbBuilder.inMemoryCompactBlockStorage()
let downloader = CompactBlockDownloader(service: service, storage: storage) let downloader = CompactBlockDownloader(service: service, storage: storage)
let blockCount = 100 let blockCount = 100

View File

@ -16,7 +16,7 @@ class LightWalletServiceTests: XCTestCase {
override func setUp() { override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class. // Put setup code here. This method is called before the invocation of each test method in the class.
channel = ChannelProvider().channel() channel = ChannelProvider().channel()
service = LightWalletGRPCService(channel: channel) service = LightWalletGRPCService(endpoint: LightWalletEndpointBuilder.default)
} }
override func tearDown() { override func tearDown() {

View File

@ -1,262 +0,0 @@
//
// OutboundTransactionManagerTests.swift
// ZcashLightClientKit-Unit-Tests
//
// Created by Francisco Gindre on 11/26/19.
//
import XCTest
@testable import ZcashLightClientKit
class OutboundTransactionManagerTests: XCTestCase {
var transactionManager: OutboundTransactionManager!
var encoder: TransactionEncoder!
var pendingRespository: PendingTransactionSQLDAO!
var dataDbHandle = TestDbHandle(originalDb: TestDbBuilder.prePopulatedDataDbURL()!)
var cacheDbHandle = TestDbHandle(originalDb: TestDbBuilder.prePopulatedCacheDbURL()!)
var pendingDbhandle = TestDbHandle(originalDb: try! TestDbBuilder.pendingTransactionsDbURL())
var service: LightWalletService!
var initializer: Initializer!
let spendingKey = "secret-extended-key-test1qvpevftsqqqqpqy52ut2vv24a2qh7nsukew7qg9pq6djfwyc3xt5vaxuenshp2hhspp9qmqvdh0gs2ljpwxders5jkwgyhgln0drjqaguaenfhehz4esdl4kwlm5t9q0l6wmzcrvcf5ed6dqzvct3e2ge7f6qdvzhp02m7sp5a0qjssrwpdh7u6tq89hl3wchuq8ljq8r8rwd6xdwh3nry9at80z7amnj3s6ah4jevnvfr08gxpws523z95g6dmn4wm6l3658kd4xcq9rc0qn"
let recipientAddress = "ztestsapling1ctuamfer5xjnnrdr3xdazenljx0mu0gutcf9u9e74tr2d3jwjnt0qllzxaplu54hgc2tyjdc2p6"
let zpend: Int = 500_000
override func setUp() {
try! dataDbHandle.setUp()
try! cacheDbHandle.setUp()
pendingRespository = PendingTransactionSQLDAO(dbProvider: pendingDbhandle.connectionProvider(readwrite: true))
try! pendingRespository.createrTableIfNeeded()
initializer = Initializer(cacheDbURL: cacheDbHandle.readWriteDb,
dataDbURL: dataDbHandle.readWriteDb,
pendingDbURL: try! TestDbBuilder.pendingTransactionsDbURL(),
endpoint: LightWalletEndpointBuilder.default,
spendParamsURL: try! __spendParamsURL(),
outputParamsURL: try! __outputParamsURL())
encoder = WalletTransactionEncoder(initializer: initializer)
transactionManager = PersistentTransactionManager(encoder: encoder, service: MockLightWalletService(latestBlockHeight: 620999), repository: pendingRespository)
}
override func tearDown() {
transactionManager = nil
encoder = nil
service = nil
initializer = nil
pendingRespository = nil
dataDbHandle.dispose()
cacheDbHandle.dispose()
pendingDbhandle.dispose()
}
func testInitSpend() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
var tx: PendingTransactionEntity?
XCTAssertNoThrow(try { tx = try transactionManager.initSpend(zatoshi: zpend, toAddress: recipientAddress, memo: nil, from: 0) }())
guard let pendingTx = tx else {
XCTFail("failed to create pending transaction")
return
}
XCTAssertEqual(pendingTx.toAddress, recipientAddress)
XCTAssertEqual(pendingTx.memo, nil)
XCTAssertEqual(pendingTx.value, zpend)
}
func testEncodeSpendSucess() {
let expect = XCTestExpectation(description: self.description)
var tx: PendingTransactionEntity?
XCTAssertNoThrow(try { tx = try transactionManager.initSpend(zatoshi: zpend, toAddress: recipientAddress, memo: nil, from: 0) }())
guard let pendingTx = tx else {
XCTFail("failed to create pending transaction")
return
}
transactionManager.encode(spendingKey: spendingKey, pendingTransaction: pendingTx) { (result) in
expect.fulfill()
switch result {
case .failure(let error):
XCTFail("failed with error: \(error)")
case .success(let tx):
XCTAssertEqual(tx.id, pendingTx.id)
XCTAssertTrue(tx.encodeAttempts > 0)
XCTAssertFalse(tx.isFailedEncoding)
}
}
wait(for: [expect], timeout: 20)
}
func testSubmitFailed() {
transactionManager = PersistentTransactionManager(encoder: encoder, service: SlightlyBadLightWalletService(latestBlockHeight: 620999), repository: pendingRespository)
let submitExpect = XCTestExpectation(description: "submit")
guard let tx = submittableTx() else {
XCTFail("failed to encode and all that")
return
}
transactionManager.submit(pendingTransaction: tx) { (result) in
submitExpect.fulfill()
switch result {
case .failure(_):
let failedTx = try? self.pendingRespository.find(by: tx.id!)
XCTAssertTrue(failedTx?.isFailedSubmit ?? false)
case .success(_):
XCTFail("test should have failed but succeeeded!")
}
}
wait(for: [submitExpect], timeout: 5)
}
private func submittableTx() -> PendingTransactionEntity? {
let encodeExpect = XCTestExpectation(description: "encode")
var tx: PendingTransactionEntity?
XCTAssertNoThrow(try { tx = try transactionManager.initSpend(zatoshi: zpend, toAddress: recipientAddress, memo: nil, from: 0) }())
guard let pendingTx = tx else {
XCTFail("failed to create pending transaction")
return nil
}
var encodedTx: PendingTransactionEntity?
transactionManager.encode(spendingKey: spendingKey, pendingTransaction: pendingTx) { (result) in
encodeExpect.fulfill()
switch result {
case .failure(let error):
XCTFail("failed with error: \(error)")
case .success(let tx):
XCTAssertEqual(tx.id, pendingTx.id)
encodedTx = tx
}
}
wait(for: [encodeExpect], timeout: 20)
guard let submittableTx = encodedTx else {
XCTFail("failed to encode tx")
return nil
}
return submittableTx
}
func testSubmit() {
let submitExpect = XCTestExpectation(description: "submit")
guard let tx = submittableTx() else {
XCTFail("failed to encode and all that")
return
}
transactionManager.submit(pendingTransaction: tx) { (result) in
submitExpect.fulfill()
switch result {
case .failure(let error):
XCTFail("submission failed with error: \(error)")
let failedTx = try? self.pendingRespository.find(by: tx.id!)
XCTAssertTrue(failedTx?.isFailedSubmit ?? false)
case .success(let successfulTx):
XCTAssertEqual(tx.id, successfulTx.id)
XCTAssertTrue(successfulTx.isSubmitted)
XCTAssertTrue(successfulTx.isSubmitSuccess)
}
}
wait(for: [submitExpect], timeout: 5)
}
func testApplyMinedHeight() {
var tx: PendingTransactionEntity?
let minedHeight = 789_000
XCTAssertNoThrow(try { tx = try transactionManager.initSpend(zatoshi: zpend, toAddress: recipientAddress, memo: nil, from: 0) }())
guard let pendingTx = tx else {
XCTFail("failed to create pending transaction")
return
}
var minedTransaction: PendingTransactionEntity?
XCTAssertNoThrow(try { minedTransaction = try transactionManager.applyMinedHeight(pendingTransaction: pendingTx, minedHeight: minedHeight)}())
guard let minedTx = minedTransaction else {
XCTFail("failed to apply mined height")
return
}
XCTAssertTrue(minedTx.isMined)
XCTAssertEqual(minedTx.minedHeight, minedHeight)
}
func testCancel() {
var tx: PendingTransactionEntity?
XCTAssertNoThrow(try { tx = try transactionManager.initSpend(zatoshi: zpend, toAddress: recipientAddress, memo: nil, from: 0) }())
guard let pendingTx = tx else {
XCTFail("failed to create pending transaction")
return
}
let cancellationResult = transactionManager.cancel(pendingTransaction: pendingTx)
guard let id = pendingTx.id else {
XCTFail("transaction with no id")
return
}
guard let retrievedTransaction = try! pendingRespository.find(by: id) else {
XCTFail("failed to retrieve previously created transation")
return
}
XCTAssertEqual(cancellationResult, retrievedTransaction.isCancelled)
}
func testAllPendingTransactions() {
let txCount = 100
for i in 0 ..< txCount {
var tx: PendingTransactionEntity?
XCTAssertNoThrow(try { tx = try transactionManager.initSpend(zatoshi: zpend, toAddress: recipientAddress, memo: nil, from: 0) }())
guard tx != nil else {
XCTFail("failed to create pending transaction \(i)")
return
}
}
guard let allPending = try! transactionManager.allPendingTransactions() else {
XCTFail("failed to retrieve all pending transactions")
return
}
XCTAssertEqual(allPending.count, txCount)
}
}

View File

@ -262,13 +262,16 @@ class TestSynchronizerBuilder {
downloader: downloader, downloader: downloader,
spendParamsURL: spendParamsURL, spendParamsURL: spendParamsURL,
outputParamsURL: outputParamsURL, outputParamsURL: outputParamsURL,
viewingKeys: [unifiedViewingKey],
walletBirthday: walletBirthday.height, walletBirthday: walletBirthday.height,
loggerProxy: loggerProxy loggerProxy: loggerProxy
) )
try initializer.initialize(unifiedViewingKeys: [unifiedViewingKey], walletBirthday: walletBirthday.height)
return ([spendingKey], try SDKSynchronizer(initializer: initializer) let synchronizer = try SDKSynchronizer(initializer: initializer)
)
try synchronizer.prepare()
return ([spendingKey], synchronizer)
} }
static func build( static func build(
rustBackend: ZcashRustBackendWelding.Type, rustBackend: ZcashRustBackendWelding.Type,

View File

@ -1,102 +0,0 @@
//
// WalletTransactionEncoderTests.swift
// ZcashLightClientKit-Unit-Tests
//
// Created by Francisco Gindre on 11/20/19.
//
import XCTest
@testable import ZcashLightClientKit
class WalletTransactionEncoderTests: XCTestCase {
var repository: TransactionRepository!
var rustBackend = ZcashRustBackend.self
var transactionEncoder: WalletTransactionEncoder!
var dataDbHandle = TestDbHandle(originalDb: TestDbBuilder.prePopulatedDataDbURL()!)
var cacheDbHandle = TestDbHandle(originalDb: TestDbBuilder.prePopulatedCacheDbURL()!)
var initializer: Initializer!
let spendingKey = "secret-extended-key-test1qvpevftsqqqqpqy52ut2vv24a2qh7nsukew7qg9pq6djfwyc3xt5vaxuenshp2hhspp9qmqvdh0gs2ljpwxders5jkwgyhgln0drjqaguaenfhehz4esdl4kwlm5t9q0l6wmzcrvcf5ed6dqzvct3e2ge7f6qdvzhp02m7sp5a0qjssrwpdh7u6tq89hl3wchuq8ljq8r8rwd6xdwh3nry9at80z7amnj3s6ah4jevnvfr08gxpws523z95g6dmn4wm6l3658kd4xcq9rc0qn"
let recipientAddress = "ztestsapling1ctuamfer5xjnnrdr3xdazenljx0mu0gutcf9u9e74tr2d3jwjnt0qllzxaplu54hgc2tyjdc2p6"
let zpend: Int = 1_000
let queue: OperationQueue = OperationQueue()
override func setUp() {
try! dataDbHandle.setUp()
try! cacheDbHandle.setUp()
queue.maxConcurrentOperationCount = 1
queue.qualityOfService = .userInitiated
initializer = Initializer(cacheDbURL: cacheDbHandle.readWriteDb,
dataDbURL: dataDbHandle.readWriteDb,
pendingDbURL: try! TestDbBuilder.pendingTransactionsDbURL(),
endpoint: LightWalletEndpointBuilder.default,
spendParamsURL: try! __spendParamsURL(),
outputParamsURL: try! __outputParamsURL())
repository = TransactionSQLDAO(dbProvider: dataDbHandle.connectionProvider(readwrite: false))
transactionEncoder = WalletTransactionEncoder(initializer: initializer)
}
override func tearDown() {
repository = nil
dataDbHandle.dispose()
cacheDbHandle.dispose()
}
func testCreateTransaction() {
var transaction: EncodedTransaction?
XCTAssertNoThrow(try { transaction = try transactionEncoder.createTransaction(spendingKey: spendingKey, zatoshi: zpend, to: recipientAddress, memo: nil, from: 0)}())
guard let tx = transaction else {
XCTFail("transaction is nil. error: \(String(describing: rustBackend.getLastError()))")
return
}
var retrievedTx: TransactionEntity?
XCTAssertNoThrow(try { retrievedTx = try repository.findBy(rawId: tx.transactionId) }())
XCTAssertNotNil(retrievedTx, "transaction not found")
}
func testCreateSpend() {
XCTAssert(initializer.getBalance() >= zpend)
var spendId: Int?
XCTAssertNoThrow(try { spendId = try transactionEncoder.createSpend(spendingKey: self.spendingKey, zatoshi: self.zpend, to: self.recipientAddress, memo: nil, from: 0) }())
guard let id = spendId else {
XCTFail("failed to create spend. error: \(String(describing: rustBackend.getLastError()))")
return
}
var tx: TransactionEntity?
XCTAssertNoThrow(try { tx = try repository.findBy(id: id)}())
XCTAssertNotNil(tx, "Transaction Id: \(id), not found. rust error: \(String(describing: rustBackend.getLastError()))")
}
func testSpendGlobalQueue() throws {
var txId: Int64 = -1
let expectation = XCTestExpectation(description: self.description)
DispatchQueue.global().async {
txId = self.rustBackend.createToAddress(dbData: self.dataDbHandle.readWriteDb,
account: 0,
extsk: self.spendingKey,
to: self.recipientAddress,
value: Int64(self.zpend),
memo: nil,
spendParamsPath: try! __spendParamsURL().path,
outputParamsPath: try! __outputParamsURL().path)
expectation.fulfill()
}
wait(for: [expectation], timeout: 240)
XCTAssertTrue(txId >= 0)
}
}

View File

@ -18,7 +18,7 @@ class ZcashLightClientKitTests: XCTestCase {
var service: LightWalletGRPCService! var service: LightWalletGRPCService!
override func setUp() { override func setUp() {
super.setUp() super.setUp()
service = LightWalletGRPCService(channel: ChannelProvider().channel()) service = LightWalletGRPCService(endpoint: LightWalletEndpointBuilder.default)
latestBlockHeight = try! service.latestBlock().compactBlockHeight()! latestBlockHeight = try! service.latestBlock().compactBlockHeight()!
} }

View File

@ -38,6 +38,10 @@ enum DarksideDataset: String {
} }
class DarksideWalletService: LightWalletService { class DarksideWalletService: LightWalletService {
func closeConnection() {
}
func fetchUTXOs(for tAddress: String, height: BlockHeight) throws -> [UnspentTransactionOutputEntity] { func fetchUTXOs(for tAddress: String, height: BlockHeight) throws -> [UnspentTransactionOutputEntity] {
return [] return []
} }
@ -73,15 +77,16 @@ class DarksideWalletService: LightWalletService {
} }
var channel: Channel var channel: Channel
init(channelProvider: ChannelProvider) { init(endpoint: LightWalletEndpoint) {
self.channel = ChannelProvider().channel() self.channel = ChannelProvider().channel()
self.service = LightWalletGRPCService(channel: channel) self.service = LightWalletGRPCService(endpoint: endpoint)
self.darksideService = DarksideStreamerClient(channel: channel) self.darksideService = DarksideStreamerClient(channel: channel)
} }
convenience init() { convenience init() {
self.init(channelProvider: ChannelProvider()) self.init(endpoint: LightWalletEndpointBuilder.default)
} }
var service: LightWalletGRPCService var service: LightWalletGRPCService
var darksideService: DarksideStreamerClient var darksideService: DarksideStreamerClient

View File

@ -18,6 +18,10 @@ struct LightWalletServiceMockResponse: LightWalletServiceResponse {
} }
class MockLightWalletService: LightWalletService { class MockLightWalletService: LightWalletService {
func closeConnection() {
}
func fetchUTXOs(for tAddress: String, height: BlockHeight) throws -> [UnspentTransactionOutputEntity] { func fetchUTXOs(for tAddress: String, height: BlockHeight) throws -> [UnspentTransactionOutputEntity] {
[] []
} }
@ -38,9 +42,8 @@ class MockLightWalletService: LightWalletService {
} }
private var service = LightWalletGRPCService(endpoint: LightWalletEndpointBuilder.default)
private var service = LightWalletGRPCService(channel: ChannelProvider().channel())
var latestHeight: BlockHeight var latestHeight: BlockHeight
init(latestBlockHeight: BlockHeight) { init(latestBlockHeight: BlockHeight) {