[#1249] Fix linter issues
- all issued fixed, one wasn't clear so new ticket is created to follow up and TODO added
This commit is contained in:
parent
2da8dce372
commit
ec8aca2890
|
@ -59,7 +59,13 @@ class SDKSynchronizerAliasDarksideTests: ZcashTestCase {
|
|||
endpoint: endpoint
|
||||
)
|
||||
|
||||
try await coordinator.reset(saplingActivation: birthday, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: branchID, chainName: chainName)
|
||||
try await coordinator.reset(
|
||||
saplingActivation: birthday,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
|
||||
coordinators.append(coordinator)
|
||||
}
|
||||
|
|
|
@ -27,13 +27,21 @@ class AdvancedReOrgTests: ZcashTestCase {
|
|||
|
||||
override func setUp() async throws {
|
||||
try await super.setUp()
|
||||
|
||||
// don't use an exact birthday, users never do.
|
||||
self.coordinator = try await TestCoordinator(
|
||||
container: mockContainer,
|
||||
walletBirthday: birthday + 50,
|
||||
network: network
|
||||
)
|
||||
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: self.branchID, chainName: self.chainName)
|
||||
|
||||
try await coordinator.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: self.branchID,
|
||||
chainName: self.chainName
|
||||
)
|
||||
}
|
||||
|
||||
override func tearDown() async throws {
|
||||
|
@ -796,7 +804,7 @@ class AdvancedReOrgTests: ZcashTestCase {
|
|||
await fulfillment(of: [firstSyncExpectation], timeout: 5)
|
||||
|
||||
sleep(1)
|
||||
let initialTotalBalance: Zatoshi = try await coordinator.synchronizer.getShieldedBalance()
|
||||
// let initialTotalBalance: Zatoshi = try await coordinator.synchronizer.getShieldedBalance()
|
||||
|
||||
let sendExpectation = XCTestExpectation(description: "send expectation")
|
||||
var pendingEntity: ZcashTransaction.Overview?
|
||||
|
@ -1044,11 +1052,20 @@ class AdvancedReOrgTests: ZcashTestCase {
|
|||
/// 8. sync to latest height
|
||||
/// 9. verify that the balance is equal to the one before the reorg
|
||||
func testReOrgChangesInboundMinedHeight() async throws {
|
||||
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: branchID, chainName: chainName)
|
||||
try await coordinator.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
|
||||
sleep(2)
|
||||
try coordinator.resetBlocks(dataset: .predefined(dataset: .txHeightReOrgBefore))
|
||||
|
||||
sleep(2)
|
||||
try coordinator.applyStaged(blockheight: 663195)
|
||||
|
||||
sleep(2)
|
||||
let firstSyncExpectation = XCTestExpectation(description: "first sync")
|
||||
|
||||
|
@ -1109,7 +1126,14 @@ class AdvancedReOrgTests: ZcashTestCase {
|
|||
// FIXME [#644]: Test works with lightwalletd v0.4.13 but is broken when using newer lightwalletd. More info is in #644.
|
||||
func testReOrgRemovesIncomingTxForever() async throws {
|
||||
await hookToReOrgNotification()
|
||||
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: branchID, chainName: chainName)
|
||||
|
||||
try await coordinator.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
|
||||
try coordinator.resetBlocks(dataset: .predefined(dataset: .txReOrgRemovesInboundTxBefore))
|
||||
|
||||
|
|
|
@ -25,12 +25,20 @@ class BalanceTests: ZcashTestCase {
|
|||
|
||||
override func setUp() async throws {
|
||||
try await super.setUp()
|
||||
|
||||
self.coordinator = try await TestCoordinator(
|
||||
container: mockContainer,
|
||||
walletBirthday: birthday,
|
||||
network: network
|
||||
)
|
||||
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: "e9ff75a6", chainName: "main")
|
||||
|
||||
try await coordinator.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: "e9ff75a6",
|
||||
chainName: "main"
|
||||
)
|
||||
}
|
||||
|
||||
override func tearDown() async throws {
|
||||
|
@ -136,9 +144,10 @@ class BalanceTests: ZcashTestCase {
|
|||
try coordinator.stageTransaction(rawTx, at: sentTxHeight)
|
||||
try coordinator.applyStaged(blockheight: sentTxHeight)
|
||||
sleep(2) // add enhance breakpoint here
|
||||
let mineExpectation = XCTestExpectation(description: "mineTxExpectation")
|
||||
|
||||
|
||||
// TODO: [#1247] needs to review this to properly solve, https://github.com/zcash/ZcashLightClientKit/issues/1247
|
||||
// let mineExpectation = XCTestExpectation(description: "mineTxExpectation")
|
||||
|
||||
// do {
|
||||
// try await coordinator.sync(
|
||||
// completion: { synchronizer in
|
||||
|
@ -286,9 +295,10 @@ class BalanceTests: ZcashTestCase {
|
|||
try coordinator.stageTransaction(rawTx, at: sentTxHeight)
|
||||
try coordinator.applyStaged(blockheight: sentTxHeight)
|
||||
sleep(2) // add enhance breakpoint here
|
||||
let mineExpectation = XCTestExpectation(description: "mineTxExpectation")
|
||||
|
||||
// TODO: [#1247] needs to review this to properly solve, https://github.com/zcash/ZcashLightClientKit/issues/1247
|
||||
// let mineExpectation = XCTestExpectation(description: "mineTxExpectation")
|
||||
|
||||
// do {
|
||||
// try await coordinator.sync(
|
||||
// completion: { synchronizer in
|
||||
|
@ -497,9 +507,10 @@ class BalanceTests: ZcashTestCase {
|
|||
try coordinator.stageTransaction(rawTx, at: sentTxHeight)
|
||||
try coordinator.applyStaged(blockheight: sentTxHeight)
|
||||
sleep(2) // add enhance breakpoint here
|
||||
let mineExpectation = XCTestExpectation(description: "mineTxExpectation")
|
||||
|
||||
|
||||
// TODO: [#1247] needs to review this to properly solve, https://github.com/zcash/ZcashLightClientKit/issues/1247
|
||||
// let mineExpectation = XCTestExpectation(description: "mineTxExpectation")
|
||||
|
||||
// do {
|
||||
// try await coordinator.sync(
|
||||
// completion: { synchronizer in
|
||||
|
|
|
@ -33,7 +33,14 @@ class DarksideSanityCheckTests: ZcashTestCase {
|
|||
network: network
|
||||
)
|
||||
|
||||
try await coordinator.reset(saplingActivation: self.birthday, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: self.branchID, chainName: self.chainName)
|
||||
try await coordinator.reset(
|
||||
saplingActivation: self.birthday,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: self.branchID,
|
||||
chainName: self.chainName
|
||||
)
|
||||
|
||||
try self.coordinator.resetBlocks(dataset: .default)
|
||||
}
|
||||
|
||||
|
@ -48,7 +55,7 @@ class DarksideSanityCheckTests: ZcashTestCase {
|
|||
}
|
||||
|
||||
func testDarkside() async throws {
|
||||
let expectedFirstBlock = (height: BlockHeight(663150), hash: "0000000002fd3be4c24c437bd22620901617125ec2a3a6c902ec9a6c06f734fc")
|
||||
// let expectedFirstBlock = (height: BlockHeight(663150), hash: "0000000002fd3be4c24c437bd22620901617125ec2a3a6c902ec9a6c06f734fc")
|
||||
let expectedLastBlock = (height: BlockHeight(663200), hash: "2fc7b4682f5ba6ba6f86e170b40f0aa9302e1d3becb2a6ee0db611ff87835e4a")
|
||||
|
||||
try coordinator.applyStaged(blockheight: expectedLastBlock.height)
|
||||
|
|
|
@ -30,7 +30,14 @@ class PendingTransactionUpdatesTest: ZcashTestCase {
|
|||
walletBirthday: birthday,
|
||||
network: network
|
||||
)
|
||||
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: "e9ff75a6", chainName: "main")
|
||||
|
||||
try await coordinator.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: "e9ff75a6",
|
||||
chainName: "main"
|
||||
)
|
||||
}
|
||||
|
||||
override func tearDown() async throws {
|
||||
|
|
|
@ -50,7 +50,13 @@ class ReOrgTests: ZcashTestCase {
|
|||
network: self.network
|
||||
)
|
||||
|
||||
try await coordinator.reset(saplingActivation: self.birthday, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: self.branchID, chainName: self.chainName)
|
||||
try await coordinator.reset(
|
||||
saplingActivation: self.birthday,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: self.branchID,
|
||||
chainName: self.chainName
|
||||
)
|
||||
|
||||
try self.coordinator.resetBlocks(dataset: .default)
|
||||
|
||||
|
@ -128,7 +134,14 @@ class ReOrgTests: ZcashTestCase {
|
|||
targetHeight: BlockHeight
|
||||
) async throws {
|
||||
do {
|
||||
try await coordinator.reset(saplingActivation: birthday, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: branchID, chainName: chainName)
|
||||
try await coordinator.reset(
|
||||
saplingActivation: birthday,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
|
||||
try coordinator.resetBlocks(dataset: .predefined(dataset: .beforeReOrg))
|
||||
try coordinator.applyStaged(blockheight: firstLatestHeight)
|
||||
sleep(1)
|
||||
|
|
|
@ -35,7 +35,14 @@ class RewindRescanTests: ZcashTestCase {
|
|||
walletBirthday: birthday,
|
||||
network: network
|
||||
)
|
||||
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: "e9ff75a6", chainName: "main")
|
||||
|
||||
try await coordinator.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: "e9ff75a6",
|
||||
chainName: "main"
|
||||
)
|
||||
}
|
||||
|
||||
override func tearDown() async throws {
|
||||
|
@ -415,9 +422,9 @@ class RewindRescanTests: ZcashTestCase {
|
|||
try coordinator.applyStaged(blockheight: sentTxHeight)
|
||||
sleep(2)
|
||||
|
||||
let mineExpectation = XCTestExpectation(description: "mineTxExpectation")
|
||||
|
||||
// TODO: [#1247] needs to review this to properly solve, https://github.com/zcash/ZcashLightClientKit/issues/1247
|
||||
// let mineExpectation = XCTestExpectation(description: "mineTxExpectation")
|
||||
|
||||
// do {
|
||||
// try await coordinator.sync(
|
||||
// completion: { synchronizer in
|
||||
|
|
|
@ -30,7 +30,15 @@ class ShieldFundsTests: ZcashTestCase {
|
|||
walletBirthday: birthday,
|
||||
network: network
|
||||
)
|
||||
try await coordinator.reset(saplingActivation: birthday, startSaplingTreeSize: 1120954, startOrchardTreeSize: 0, branchID: self.branchID, chainName: self.chainName)
|
||||
|
||||
try await coordinator.reset(
|
||||
saplingActivation: birthday,
|
||||
startSaplingTreeSize: 1120954,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: self.branchID,
|
||||
chainName: self.chainName
|
||||
)
|
||||
|
||||
try coordinator.service.clearAddedUTXOs()
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,13 @@ class SynchronizerDarksideTests: ZcashTestCase {
|
|||
network: network
|
||||
)
|
||||
|
||||
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: "e9ff75a6", chainName: "main")
|
||||
try await coordinator.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: "e9ff75a6",
|
||||
chainName: "main"
|
||||
)
|
||||
}
|
||||
|
||||
override func tearDown() async throws {
|
||||
|
|
|
@ -33,7 +33,14 @@ final class SynchronizerTests: ZcashTestCase {
|
|||
walletBirthday: birthday + 50,
|
||||
network: network
|
||||
)
|
||||
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: self.branchID, chainName: self.chainName)
|
||||
|
||||
try await coordinator.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: self.branchID,
|
||||
chainName: self.chainName
|
||||
)
|
||||
|
||||
let eventClosure: CompactBlockProcessor.EventClosure = { [weak self] event in
|
||||
switch event {
|
||||
|
|
|
@ -77,10 +77,6 @@ class TransactionEnhancementTests: ZcashTestCase {
|
|||
|
||||
let dbInit = try await rustBackend.initDataDb(seed: nil)
|
||||
|
||||
let derivationTool = DerivationTool(networkType: network.networkType)
|
||||
let spendingKey = try derivationTool.deriveUnifiedSpendingKey(seed: Environment.seedBytes, accountIndex: 0)
|
||||
let viewingKey = try derivationTool.deriveUnifiedFullViewingKey(from: spendingKey)
|
||||
|
||||
do {
|
||||
_ = try await rustBackend.createAccount(
|
||||
seed: Environment.seedBytes,
|
||||
|
@ -113,14 +109,6 @@ class TransactionEnhancementTests: ZcashTestCase {
|
|||
)
|
||||
try! await storage.create()
|
||||
|
||||
let transactionRepository = MockTransactionRepository(
|
||||
unminedCount: 0,
|
||||
receivedCount: 0,
|
||||
sentCount: 0,
|
||||
scannedHeight: 0,
|
||||
network: network
|
||||
)
|
||||
|
||||
downloader = BlockDownloaderServiceImpl(service: service, storage: storage)
|
||||
|
||||
Dependencies.setup(
|
||||
|
|
|
@ -33,7 +33,14 @@ class Z2TReceiveTests: ZcashTestCase {
|
|||
walletBirthday: birthday,
|
||||
network: network
|
||||
)
|
||||
try await coordinator.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: self.branchID, chainName: self.chainName)
|
||||
|
||||
try await coordinator.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: self.branchID,
|
||||
chainName: self.chainName
|
||||
)
|
||||
}
|
||||
|
||||
override func tearDown() async throws {
|
||||
|
|
|
@ -27,10 +27,10 @@ final class ProcessSuggestedScanRangesActionTests: ZcashTestCase {
|
|||
func testProcessSuggestedScanRangesAction_EmptyScanRanges() async throws {
|
||||
let loggerMock = LoggerMock()
|
||||
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
|
||||
let tupple = setupAction(loggerMock)
|
||||
await tupple.rustBackendMock.setSuggestScanRangesClosure( { [] } )
|
||||
await tupple.rustBackendMock.setSuggestScanRangesClosure({ [] })
|
||||
|
||||
let processSuggestedScanRangesActionAction = tupple.action
|
||||
|
||||
|
@ -54,13 +54,13 @@ final class ProcessSuggestedScanRangesActionTests: ZcashTestCase {
|
|||
func testProcessSuggestedScanRangesAction_VerifyScanRangeSetTotalProgressRange() async throws {
|
||||
let loggerMock = LoggerMock()
|
||||
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.debugFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.debugFileFunctionLineClosure = { _, _, _, _ in }
|
||||
|
||||
let tupple = setupAction(loggerMock)
|
||||
await tupple.rustBackendMock.setSuggestScanRangesClosure( { [
|
||||
await tupple.rustBackendMock.setSuggestScanRangesClosure({ [
|
||||
ScanRange(range: 0..<10, priority: .verify)
|
||||
] } )
|
||||
] })
|
||||
|
||||
let processSuggestedScanRangesActionAction = tupple.action
|
||||
|
||||
|
@ -110,13 +110,13 @@ final class ProcessSuggestedScanRangesActionTests: ZcashTestCase {
|
|||
func testProcessSuggestedScanRangesAction_VerifyScanRangeTotalProgressRangeSkipped() async throws {
|
||||
let loggerMock = LoggerMock()
|
||||
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.debugFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.debugFileFunctionLineClosure = { _, _, _, _ in }
|
||||
|
||||
let tupple = setupAction(loggerMock)
|
||||
await tupple.rustBackendMock.setSuggestScanRangesClosure( { [
|
||||
await tupple.rustBackendMock.setSuggestScanRangesClosure({ [
|
||||
ScanRange(range: 0..<10, priority: .verify)
|
||||
] } )
|
||||
] })
|
||||
|
||||
let processSuggestedScanRangesActionAction = tupple.action
|
||||
|
||||
|
@ -160,13 +160,13 @@ final class ProcessSuggestedScanRangesActionTests: ZcashTestCase {
|
|||
func testProcessSuggestedScanRangesAction_ChainTipScanRange() async throws {
|
||||
let loggerMock = LoggerMock()
|
||||
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.debugFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.debugFileFunctionLineClosure = { _, _, _, _ in }
|
||||
|
||||
let tupple = setupAction(loggerMock)
|
||||
await tupple.rustBackendMock.setSuggestScanRangesClosure( { [
|
||||
await tupple.rustBackendMock.setSuggestScanRangesClosure({ [
|
||||
ScanRange(range: 0..<10, priority: .chainTip)
|
||||
] } )
|
||||
] })
|
||||
|
||||
let processSuggestedScanRangesActionAction = tupple.action
|
||||
|
||||
|
@ -207,6 +207,7 @@ final class ProcessSuggestedScanRangesActionTests: ZcashTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable large_tuple
|
||||
private func setupAction(
|
||||
_ loggerMock: LoggerMock = LoggerMock()
|
||||
) -> (
|
||||
|
@ -239,7 +240,7 @@ final class ProcessSuggestedScanRangesActionTests: ZcashTestCase {
|
|||
mockContainer.mock(type: Logger.self, isSingleton: true) { _ in loggerMock }
|
||||
|
||||
return (
|
||||
action:ProcessSuggestedScanRangesAction(container: mockContainer),
|
||||
action: ProcessSuggestedScanRangesAction(container: mockContainer),
|
||||
serviceMock: serviceMock,
|
||||
rustBackendMock: rustBackendMock
|
||||
)
|
||||
|
|
|
@ -51,7 +51,7 @@ final class RewindActionTests: ZcashTestCase {
|
|||
let loggerMock = LoggerMock()
|
||||
let blockDownloaderServiceMock = BlockDownloaderServiceMock()
|
||||
|
||||
loggerMock.debugFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.debugFileFunctionLineClosure = { _, _, _, _ in }
|
||||
blockDownloaderMock.rewindLatestDownloadedBlockHeightClosure = { _ in }
|
||||
blockDownloaderServiceMock.rewindToClosure = { _ in }
|
||||
|
||||
|
@ -99,7 +99,7 @@ final class RewindActionTests: ZcashTestCase {
|
|||
}
|
||||
)
|
||||
|
||||
await rustBackendMock.setRewindToHeightHeightClosure( { _ in } )
|
||||
await rustBackendMock.setRewindToHeightHeightClosure({ _ in })
|
||||
|
||||
mockContainer.mock(type: ZcashRustBackendWelding.self, isSingleton: true) { _ in rustBackendMock }
|
||||
mockContainer.mock(type: BlockDownloaderService.self, isSingleton: true) { _ in blockDownloaderServiceMock }
|
||||
|
@ -109,4 +109,3 @@ final class RewindActionTests: ZcashTestCase {
|
|||
return RewindAction(container: mockContainer)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ final class UpdateChainTipActionTests: ZcashTestCase {
|
|||
let loggerMock = LoggerMock()
|
||||
let blockDownloaderMock = BlockDownloaderMock()
|
||||
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
blockDownloaderMock.stopDownloadClosure = { }
|
||||
|
||||
let updateChainTipAction = await setupAction(loggerMock, blockDownloaderMock)
|
||||
|
@ -54,7 +54,7 @@ final class UpdateChainTipActionTests: ZcashTestCase {
|
|||
let loggerMock = LoggerMock()
|
||||
let blockDownloaderMock = BlockDownloaderMock()
|
||||
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
blockDownloaderMock.stopDownloadClosure = { }
|
||||
|
||||
let updateChainTipAction = await setupAction(loggerMock, blockDownloaderMock)
|
||||
|
@ -80,7 +80,7 @@ final class UpdateChainTipActionTests: ZcashTestCase {
|
|||
let loggerMock = LoggerMock()
|
||||
let blockDownloaderMock = BlockDownloaderMock()
|
||||
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
loggerMock.infoFileFunctionLineClosure = { _, _, _, _ in }
|
||||
blockDownloaderMock.stopDownloadClosure = { }
|
||||
|
||||
let updateChainTipAction = await setupAction(loggerMock, blockDownloaderMock)
|
||||
|
@ -117,7 +117,7 @@ final class UpdateChainTipActionTests: ZcashTestCase {
|
|||
}
|
||||
)
|
||||
|
||||
await rustBackendMock.setUpdateChainTipHeightClosure( { _ in } )
|
||||
await rustBackendMock.setUpdateChainTipHeightClosure({ _ in })
|
||||
|
||||
let lightWalletdInfoMock = LightWalletdInfoMock()
|
||||
lightWalletdInfoMock.underlyingConsensusBranchID = underlyingConsensusBranchID
|
||||
|
|
|
@ -32,7 +32,10 @@ final class UpdateSubtreeRootsActionTests: ZcashTestCase {
|
|||
let tupple = setupAction(loggerMock)
|
||||
let updateSubtreeRootsActionAction = tupple.action
|
||||
tupple.serviceMock.getSubtreeRootsClosure = { _ in
|
||||
AsyncThrowingStream { continuation in continuation.finish(throwing: ZcashError.serviceSubtreeRootsStreamFailed(LightWalletServiceError.timeOut)) }
|
||||
AsyncThrowingStream { continuation in continuation.finish(
|
||||
throwing: ZcashError.serviceSubtreeRootsStreamFailed(LightWalletServiceError.timeOut)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -112,6 +115,7 @@ final class UpdateSubtreeRootsActionTests: ZcashTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable large_tuple
|
||||
private func setupAction(
|
||||
_ loggerMock: LoggerMock = LoggerMock()
|
||||
) -> (
|
||||
|
|
|
@ -44,7 +44,8 @@ class ZcashRustBackendTests: XCTestCase {
|
|||
func testInitWithShortSeedAndFail() async throws {
|
||||
let seed = "testreferencealice"
|
||||
var treeState = TreeState()
|
||||
treeState.height = 663193 // TODO: rest
|
||||
// TODO: [#1250] rest, https://github.com/zcash/ZcashLightClientKit/issues/1250
|
||||
treeState.height = 663193
|
||||
|
||||
let dbInit = try await rustBackend.initDataDb(seed: nil)
|
||||
|
||||
|
@ -54,7 +55,11 @@ class ZcashRustBackendTests: XCTestCase {
|
|||
}
|
||||
|
||||
do {
|
||||
_ = try await rustBackend.createAccount(seed: Array(seed.utf8), treeState: treeState.serializedData(partial: false).bytes, recoverUntil: nil)
|
||||
_ = try await rustBackend.createAccount(
|
||||
seed: Array(seed.utf8),
|
||||
treeState: treeState.serializedData(partial: false).bytes,
|
||||
recoverUntil: nil
|
||||
)
|
||||
XCTFail("createAccount should fail here.")
|
||||
} catch { }
|
||||
}
|
||||
|
|
|
@ -24,7 +24,14 @@ enum FakeChainBuilder {
|
|||
static let testnetPostCanopyTx = "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/testnet-canopy/post-activation-txs/ecaa6c03709d70aa25446a81690b18ddb11daac96a03fe4b5cfd0d89a49fb963.txt"
|
||||
|
||||
static func buildSingleNoteChain(darksideWallet: DarksideWalletService, branchID: String, chainName: String) throws {
|
||||
try darksideWallet.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: branchID, chainName: chainName)
|
||||
try darksideWallet.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
|
||||
try darksideWallet.useDataset(from: txMainnetBlockUrl)
|
||||
|
||||
try darksideWallet.stageBlocksCreate(from: 663151, count: 100)
|
||||
|
@ -33,7 +40,14 @@ enum FakeChainBuilder {
|
|||
}
|
||||
|
||||
static func buildChain(darksideWallet: DarksideWalletService, branchID: String, chainName: String) throws {
|
||||
try darksideWallet.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: branchID, chainName: chainName)
|
||||
try darksideWallet.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
|
||||
try darksideWallet.useDataset(from: txMainnetBlockUrl)
|
||||
|
||||
try darksideWallet.stageBlocksCreate(from: 663151, count: 100)
|
||||
|
@ -44,7 +58,14 @@ enum FakeChainBuilder {
|
|||
}
|
||||
|
||||
static func buildChainWithTxsFarFromEachOther(darksideWallet: DarksideWalletService, branchID: String, chainName: String, length: Int) throws {
|
||||
try darksideWallet.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: branchID, chainName: chainName)
|
||||
try darksideWallet.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
|
||||
try darksideWallet.useDataset(from: txMainnetBlockUrl)
|
||||
|
||||
try darksideWallet.stageBlocksCreate(from: 663151, count: length)
|
||||
|
@ -55,7 +76,14 @@ enum FakeChainBuilder {
|
|||
}
|
||||
|
||||
static func buildChain(darksideWallet: DarksideWalletService, branchID: String, chainName: String, length: Int) throws {
|
||||
try darksideWallet.reset(saplingActivation: 663150, startSaplingTreeSize: 128607, startOrchardTreeSize: 0, branchID: branchID, chainName: chainName)
|
||||
try darksideWallet.reset(
|
||||
saplingActivation: 663150,
|
||||
startSaplingTreeSize: 128607,
|
||||
startOrchardTreeSize: 0,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
|
||||
try darksideWallet.useDataset(from: txMainnetBlockUrl)
|
||||
|
||||
try darksideWallet.stageBlocksCreate(from: 663151, count: length)
|
||||
|
@ -79,7 +107,13 @@ enum FakeChainBuilder {
|
|||
chainName: String,
|
||||
length: Int
|
||||
) throws {
|
||||
try darksideWallet.reset(saplingActivation: birthday, startSaplingTreeSize: startSaplingTreeSize, startOrchardTreeSize: startOrchardTreeSize, branchID: branchID, chainName: chainName)
|
||||
try darksideWallet.reset(
|
||||
saplingActivation: birthday,
|
||||
startSaplingTreeSize: startSaplingTreeSize,
|
||||
startOrchardTreeSize: startOrchardTreeSize,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
|
||||
try darksideWallet.useDataset(testnetCanopyStartBlock)
|
||||
try darksideWallet.stageBlocksCreate(from: birthday + 1, count: length)
|
||||
|
@ -87,7 +121,13 @@ enum FakeChainBuilder {
|
|||
}
|
||||
|
||||
static func buildChainPostActivationFunds(darksideWallet: DarksideWalletService, birthday: BlockHeight, startSaplingTreeSize: UInt32, startOrchardTreeSize: UInt32, networkActivationHeight: BlockHeight, length: Int) throws {
|
||||
try darksideWallet.reset(saplingActivation: birthday, startSaplingTreeSize: startSaplingTreeSize, startOrchardTreeSize: startOrchardTreeSize, branchID: "e9ff75a6", chainName: "testnet")
|
||||
try darksideWallet.reset(
|
||||
saplingActivation: birthday,
|
||||
startSaplingTreeSize: startSaplingTreeSize,
|
||||
startOrchardTreeSize: startOrchardTreeSize,
|
||||
branchID: "e9ff75a6",
|
||||
chainName: "testnet"
|
||||
)
|
||||
|
||||
try darksideWallet.useDataset(testnetCanopyStartBlock)
|
||||
try darksideWallet.stageBlocksCreate(from: birthday + 1, count: length)
|
||||
|
|
|
@ -229,7 +229,13 @@ extension TestCoordinator {
|
|||
|
||||
await self.synchronizer.blockProcessor.update(config: newConfig)
|
||||
|
||||
try service.reset(saplingActivation: saplingActivation, startSaplingTreeSize: startSaplingTreeSize, startOrchardTreeSize: startOrchardTreeSize, branchID: branchID, chainName: chainName)
|
||||
try service.reset(
|
||||
saplingActivation: saplingActivation,
|
||||
startSaplingTreeSize: startSaplingTreeSize,
|
||||
startOrchardTreeSize: startOrchardTreeSize,
|
||||
branchID: branchID,
|
||||
chainName: chainName
|
||||
)
|
||||
}
|
||||
|
||||
func getIncomingTransactions() throws -> [RawTransaction]? {
|
||||
|
|
Loading…
Reference in New Issue