From a01205b408ddbf057864dd92ca9863061d6845c5 Mon Sep 17 00:00:00 2001 From: Lukas Korba Date: Thu, 29 Feb 2024 13:31:27 +0100 Subject: [PATCH] TCA-conformations - Proposal conforms to the Equatable - .zero Proposal added TCA-conformations - internal protection level -> public TCA-conformations - zip317 enabled TCA-conformations - removed public .zero Proposal TCA-conformations - testOnlyFakeProposal for testing purposes outside SDK TCA-conformations - updated code TCA-conformations - typos fixed --- .../ZcashLightClientKit/Model/Proposal.swift | 17 +++++++++++++++-- .../Rust/ZcashRustBackend.swift | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Sources/ZcashLightClientKit/Model/Proposal.swift b/Sources/ZcashLightClientKit/Model/Proposal.swift index 0111c588..fac1c62d 100644 --- a/Sources/ZcashLightClientKit/Model/Proposal.swift +++ b/Sources/ZcashLightClientKit/Model/Proposal.swift @@ -8,11 +8,24 @@ import Foundation /// A data structure that describes a series of transactions to be created. -public struct Proposal { +public struct Proposal: Equatable { let inner: FfiProposal /// Returns the total fee to be paid across all proposed transactions, in zatoshis. public func totalFeeRequired() -> Zatoshi { - return Zatoshi(Int64(inner.balance.feeRequired)) + Zatoshi(Int64(inner.balance.feeRequired)) + } +} + +public extension Proposal { + /// IMPORTANT: Use of this function is for testing purposes only, not recommended to use in production. + /// The instance of `Proposal` should never be created on client's side. + static func testOnlyFakeProposal(totalFee: UInt64) -> Self { + var ffiProposal = FfiProposal() + var balance = FfiTransactionBalance() + + balance.feeRequired = totalFee + + return Self(inner: ffiProposal) } } diff --git a/Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift b/Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift index 99d128a6..290bce63 100644 --- a/Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift +++ b/Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift @@ -13,7 +13,7 @@ let globalDBLock = NSLock() actor ZcashRustBackend: ZcashRustBackendWelding { let minimumConfirmations: UInt32 = 10 - let useZIP317Fees = false + let useZIP317Fees = true let dbData: (String, UInt) let fsBlockDbRoot: (String, UInt)