Fix Merge Mistakes

This commit is contained in:
Francisco Gindre 2022-09-12 14:36:30 -03:00
parent a81a77f494
commit 1a73985307
2 changed files with 8 additions and 8 deletions

View File

@ -555,6 +555,7 @@ public class SDKSynchronizer: Synchronizer {
Task { Task {
do { do {
let transaction = try await transactionManager.encode( let transaction = try await transactionManager.encode(
spendingKey: spendingKey,
pendingTransaction: spend pendingTransaction: spend
) )
let submittedTx = try await transactionManager.submit(pendingTransaction: transaction) let submittedTx = try await transactionManager.submit(pendingTransaction: transaction)

View File

@ -19,7 +19,6 @@ enum TransactionManagerError: Error {
} }
class PersistentTransactionManager: OutboundTransactionManager { class PersistentTransactionManager: OutboundTransactionManager {
var repository: PendingTransactionRepository var repository: PendingTransactionRepository
var encoder: TransactionEncoder var encoder: TransactionEncoder
var service: LightWalletService var service: LightWalletService
@ -88,26 +87,26 @@ class PersistentTransactionManager: OutboundTransactionManager {
return pending return pending
} catch StorageError.updateFailed { } catch StorageError.updateFailed {
result(.failure(TransactionManagerError.updateFailed(pendingTransaction))) throw TransactionManagerError.updateFailed(pendingTransaction)
} catch MemoBytes.Errors.invalidUTF8 { } catch MemoBytes.Errors.invalidUTF8 {
result(.failure(TransactionManagerError.shieldingEncodingFailed(pendingTransaction, reason: "Memo contains invalid UTF-8 bytes"))) throw TransactionManagerError.shieldingEncodingFailed(pendingTransaction, reason: "Memo contains invalid UTF-8 bytes")
} catch MemoBytes.Errors.tooLong(let length) { } catch MemoBytes.Errors.tooLong(let length) {
result(.failure(TransactionManagerError.shieldingEncodingFailed(pendingTransaction, reason: "Memo is too long. expected 512 bytes, received \(length)"))) throw TransactionManagerError.shieldingEncodingFailed(pendingTransaction, reason: "Memo is too long. expected 512 bytes, received \(length)")
} catch { } catch {
result(.failure(error)) throw error
} }
} }
func encode( func encode(
spendingKey: String, spendingKey: SaplingExtendedSpendingKey,
pendingTransaction: PendingTransactionEntity pendingTransaction: PendingTransactionEntity
) async throws -> PendingTransactionEntity { ) async throws -> PendingTransactionEntity {
do { do {
let encodedTransaction = try self.encoder.createTransaction( let encodedTransaction = try self.encoder.createTransaction(
spendingKey: spendingKey, spendingKey: spendingKey,
zatoshi: pendingTransaction.intValue, zatoshi: pendingTransaction.value,
to: pendingTransaction.toAddress, to: pendingTransaction.toAddress,
memo: pendingTransaction.memo?.asZcashTransactionMemo(), memoBytes: try pendingTransaction.memo.intoMemoBytes(),
from: pendingTransaction.accountIndex from: pendingTransaction.accountIndex
) )
let transaction = try self.encoder.expandEncodedTransaction(encodedTransaction) let transaction = try self.encoder.expandEncodedTransaction(encodedTransaction)