From b48b95d26c0bc30410a58a5fc82883657f59ef7f Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Sat, 17 Oct 2026 00:26:25 +0300 Subject: [PATCH 01/11] fix(coinjoin): consolidate more than 100 mixed coins before shielding Moving CoinJoin funds to the Shielded balance built one drain asset lock spending every CoinJoin UTXO. Dash Core v24 refuses an asset lock with more than 100 inputs (assetlocktx-too-many-inputs), peers drop it silently, and the app only saw an uncertain broadcast; Platform caps asset-lock inputs at 100 too (ticket 32500, 104 mixed coins). Same approach as the Android wallet: when the CoinJoin account holds more than 100 spendable UTXOs, sweep it first to one fresh, unused address of its own CoinJoin account (the existing balanced <=500-input chunked sweep), wait until those outputs are InstantSend-locked or mined, then run the unchanged CoinJoin-drain asset lock over the few resulting inputs. The coins never leave the CoinJoin account before the drain, so an interrupted attempt leaves them on one CoinJoin address and the next attempt drains them directly. - CoinJoinShieldPlanner: pure next-step decision (consolidate / await finality / drain), the drain builder's finality rule, and the consolidation-settled check. - SwiftDashSDKTransactionSender: CoinJoin UTXO snapshot with finality (height or IS-lock txid set), lowest-index unused external CoinJoin pool address holding no UTXO, bounded UTXO-state wait; balancedChunks made generic and reachable from tests. - CoinJoinMoveFundsViewModel: on the prepared path, authorize once up front and run the drain preauthorized (one prompt); 180 s finality cap with a retryable message; DWLogger lines for n, the plan, chunk txids and the wait outcome. The direct path (<= 100, all final) and moveToWallet are unchanged. - Sheet: "Preparing your coins" step only when preparation runs. Co-Authored-By: Claude Opus 5.5 --- .../SwiftDashSDKTransactionSender.swift | 149 +++++++++-- .../CoinJoinMoveDestinationPolicy.swift | 68 +++++ .../CoinJoinMoveFundsSheet.swift | 34 ++- .../CoinJoinMoveFundsViewModel.swift | 241 +++++++++++++++++- DashWallet/en.lproj/Localizable.strings | 9 + 5 files changed, 468 insertions(+), 33 deletions(-) diff --git a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift index d9a3367b77..95369d0b65 100644 --- a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift +++ b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift @@ -43,7 +43,7 @@ final class SwiftDashSDKTransactionSender: NSObject { /// `MAX_STANDARD_TX_INPUTS`, which the builder hard-rejects if exceeded — so /// this cap is a proactive split, and a drifted value still fails safe (an /// error) rather than mis-signing. - private static let maxInputsPerSweep = 500 + static let maxInputsPerSweep = 500 /// Relay-minimum fee rate: 1 duff/byte == 1000 duffs per kB. private static let feeRateSatPerKb: UInt64 = 1000 /// `AccountBalance.typeTag` discriminant for CoinJoin (matches @@ -263,9 +263,7 @@ final class SwiftDashSDKTransactionSender: NSObject { // CoinJoin account-0 balance descriptor (mirrors // SwiftDashSDKCoinJoinBalanceReader: typeTag 1, index 0). Used only to // address the account for UTXO enumeration. - guard let cjBalance = manager.accountBalances(for: walletId).first(where: { - $0.typeTag == Self.coinJoinTypeTag && $0.index == Self.coinJoinAccountIndex - }) else { + guard let cjBalance = Self.coinJoinAccountBalance(manager: manager, walletId: walletId) else { return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil) } @@ -288,7 +286,7 @@ final class SwiftDashSDKTransactionSender: NSObject { var txids: [Data] = [] var failedChunkCount = 0 var firstError: Error? - for (index, chunk) in Self.balancedChunks(utxos).enumerated() { + for (index, chunk) in Self.balancedChunks(utxos, maxPerChunk: Self.maxInputsPerSweep).enumerated() { do { let builder = try CoreTransactionBuilder(network: network) try builder.addInputs( @@ -346,6 +344,128 @@ final class SwiftDashSDKTransactionSender: NSObject { return outcome } + // MARK: - CoinJoin consolidation (CoinJoin → Shielded over the asset-lock input cap) + + /// The CoinJoin account-0 balance descriptor (typeTag 1, index 0 — mirrors + /// `SwiftDashSDKCoinJoinBalanceReader`), which addresses the account for + /// UTXO and address-pool enumeration. Nil when the wallet has no CoinJoin + /// account. + @MainActor + private static func coinJoinAccountBalance( + manager: PlatformWalletManager, walletId: Data + ) -> PlatformWalletManager.AccountBalance? { + manager.accountBalances(for: walletId).first(where: { + $0.typeTag == Self.coinJoinTypeTag && $0.index == Self.coinJoinAccountIndex + }) + } + + /// The CoinJoin account's spendable UTXO set, as `CoinJoinShieldPlanner` + /// reads it. + struct CoinJoinUtxoState { + struct Entry { + /// Wire-order txid (`AccountUtxo.outpointTxid`, the same order as + /// `CoinJoinSweepOutcome.txids`). + let txid: Data + let vout: UInt32 + let valueDuffs: UInt64 + /// Confirmed or InstantSend-locked — what the drain builder + /// accepts as an input (see `CoinJoinShieldPlanner.isFinal`). + let isFinal: Bool + } + + let entries: [Entry] + + var count: Int { entries.count } + var finalCount: Int { entries.reduce(0) { $0 + ($1.isFinal ? 1 : 0) } } + var totalDuffs: UInt64 { entries.reduce(0) { $0 + $1.valueDuffs } } + var txidFinality: [(txid: Data, isFinal: Bool)] { entries.map { ($0.txid, $0.isFinal) } } + } + + /// Snapshot of the CoinJoin account's spendable UTXOs with their finality. + /// Nil when the host has no wallet or manager bound; an account that does + /// not exist reads as empty. + /// + /// Reserved (`isLocked`) rows are left out: neither the drain nor the sweep + /// can spend them, so counting them would ask for a consolidation that has + /// nothing to consolidate. + @MainActor + static func coinJoinUtxoState() -> CoinJoinUtxoState? { + let host = SwiftDashSDKHost.shared + guard let wallet = host.wallet, let manager = host.manager else { return nil } + let walletId = wallet.walletId + guard let cjBalance = coinJoinAccountBalance(manager: manager, walletId: walletId) else { + return CoinJoinUtxoState(entries: []) + } + let instantLocked = Set(manager.instantSendLockTxids(for: walletId)) + let entries = manager.accountUtxos(for: walletId, balance: cjBalance) + .filter { !$0.isLocked } + .map { utxo in + CoinJoinUtxoState.Entry( + txid: utxo.outpointTxid, + vout: utxo.outpointVout, + valueDuffs: utxo.valueDuffs, + isFinal: CoinJoinShieldPlanner.isFinal( + height: utxo.height, + txid: utxo.outpointTxid, + instantLockedTxids: instantLocked)) + } + return CoinJoinUtxoState(entries: entries) + } + + /// A fresh receive address of this wallet's own CoinJoin account — the + /// consolidation destination, so the mixed coins stay in the CoinJoin + /// account until the drain asset lock spends them. + /// + /// Picked from the account's external (`.../0/index`) address pool: the + /// lowest-index address the pool has not seen used and that holds no UTXO + /// right now. Pool addresses are exactly what the SPV client watches — + /// `monitored_script_pubkeys` walks every account's pool — so an output + /// paid here is detected and lands back in the CoinJoin account, and its + /// use moves the pool's gap forward like any other receive. + @MainActor + static func unusedCoinJoinAddress() -> String? { + let host = SwiftDashSDKHost.shared + guard let wallet = host.wallet, let manager = host.manager else { return nil } + let walletId = wallet.walletId + guard let cjBalance = coinJoinAccountBalance(manager: manager, walletId: walletId), + let network = try? PaymentNetworkResolver.current() + else { return nil } + // Pool type 0 = External (see `AccountAddressPoolSnapshot.pool_type`). + guard let external = manager.accountAddressPools(for: walletId, balance: cjBalance) + .first(where: { $0.poolType == 0 }) + else { return nil } + let fundedScripts = Set(manager.accountUtxos(for: walletId, balance: cjBalance).map(\.scriptPubkey)) + let candidates = external.addresses + .filter { !$0.isUsed && !$0.address.isEmpty } + .sorted { $0.addressIndex < $1.addressIndex } + for candidate in candidates { + guard let script = ScriptAddressCodec.scriptPubKey(forAddress: candidate.address, network: network), + !fundedScripts.contains(script) + else { continue } + logger.info("💸 TXSEND :: coinjoin consolidation address index=\(candidate.addressIndex, privacy: .public) of \(external.addresses.count, privacy: .public) watched (gap \(external.gapLimit, privacy: .public))") + return candidate.address + } + return nil + } + + /// Poll the CoinJoin UTXO state until `isDone` holds or `timeout` elapses. + /// Returns the last snapshot and whether `isDone` held for it; nil only + /// when the host lost its wallet. Sleeps off the main actor between polls + /// and stops early when the calling task is cancelled. + static func waitForCoinJoinUtxoState( + timeout: TimeInterval, + pollInterval: TimeInterval = 1, + until isDone: @escaping (CoinJoinUtxoState) -> Bool + ) async -> (state: CoinJoinUtxoState, satisfied: Bool)? { + let deadline = Date().addingTimeInterval(timeout) + while true { + guard let state = await MainActor.run(body: { coinJoinUtxoState() }) else { return nil } + if isDone(state) { return (state, true) } + if Date() >= deadline || Task.isCancelled { return (state, false) } + try? await Task.sleep(nanoseconds: UInt64(pollInterval * 1_000_000_000)) + } + } + // MARK: - Selected-input send (CrowdNode signal txs) /// Build, sign, and broadcast a transaction funded ONLY from UTXOs sitting @@ -622,18 +742,17 @@ final class SwiftDashSDKTransactionSender: NSObject { // MARK: - Helpers - /// Partition `utxos` into balanced chunks each ≤ `maxInputsPerSweep`, - /// preserving order — app-side chunking (no upstream key-wallet counterpart): - /// `ceil(n / 500)` near-equal chunks, so no chunk is a lone sub-fee input. + /// Partition `utxos` into balanced chunks each ≤ `maxPerChunk` + /// (`maxInputsPerSweep` in production), preserving order — app-side + /// chunking (no upstream key-wallet counterpart): `ceil(n / 500)` + /// near-equal chunks, so no chunk is a lone sub-fee input. /// Examples: 500 → [500]; 501 → [251, 250]; 1000 → [500, 500]. - private static func balancedChunks( - _ utxos: [PlatformWalletManager.AccountUtxo] - ) -> [[PlatformWalletManager.AccountUtxo]] { + static func balancedChunks(_ utxos: [T], maxPerChunk: Int) -> [[T]] { let n = utxos.count - guard n > 0 else { return [] } - let numChunks = (n + maxInputsPerSweep - 1) / maxInputsPerSweep // ceil(n / 500) - let chunkSize = (n + numChunks - 1) / numChunks // ceil(n / numChunks) - var chunks: [[PlatformWalletManager.AccountUtxo]] = [] + guard n > 0, maxPerChunk > 0 else { return [] } + let numChunks = (n + maxPerChunk - 1) / maxPerChunk // ceil(n / max) + let chunkSize = (n + numChunks - 1) / numChunks // ceil(n / numChunks) + var chunks: [[T]] = [] var start = 0 while start < n { let end = min(start + chunkSize, n) diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift index e767d5cdb5..0494c560dc 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift @@ -101,3 +101,71 @@ enum CoinJoinMoveDestinationPolicy { return shieldedAvailable ? .destinationChoice : .transparentConfirmation } } + +// MARK: - CoinJoin → Shielded input planning + +/// Decides how a "move mixed coins to Shielded" attempt gets from the CoinJoin +/// account's current UTXO set to a single CoinJoin-drain asset lock. +/// +/// The drain spends every final CoinJoin UTXO as an input of ONE asset lock, +/// and an asset lock may carry at most `maxAssetLockInputs` inputs: Dash Core +/// v24 refuses more as non-standard (`assetlocktx-too-many-inputs`, +/// `MAX_STANDARD_ASSET_LOCK_INPUTS`) and peers drop it silently, and Platform +/// consensus applies the same cap (`max_asset_lock_transaction_inputs`). A +/// heavier account is therefore first consolidated — swept to one fresh +/// address of its own CoinJoin account in ≤500-input regular transactions — +/// and drained once those outputs are final. The coins never leave the +/// CoinJoin account until the drain, so an interrupted attempt leaves them on +/// one CoinJoin address, and the next attempt drains them directly. +/// +/// Pure: the inputs come from `SwiftDashSDKTransactionSender.coinJoinUtxoState()` +/// so `CoinJoinShieldPlannerTests` can pin every branch without a wallet. +enum CoinJoinShieldPlanner { + + /// Most inputs a single asset lock may carry (Dash Core v24 policy and + /// Platform consensus agree on 100). + static let maxAssetLockInputs = 100 + + /// What the next step towards the drain is. + enum Step: Equatable { + /// The account holds no spendable UTXO — there is nothing to shield. + case nothingToMove + /// More UTXOs than one asset lock may spend: consolidate first. + case consolidate + /// Few enough UTXOs, but `pending` of them are not final yet. The + /// drain builder spends only final inputs (confirmed or + /// InstantSend-locked), so draining now would leave them behind. + case awaitFinality(pending: Int) + /// Every UTXO is final and one asset lock can spend them all. + case drain + } + + /// The next step for an account with `utxoCount` spendable UTXOs of which + /// `finalCount` are final. + static func nextStep(utxoCount: Int, finalCount: Int) -> Step { + guard utxoCount > 0 else { return .nothingToMove } + if utxoCount > maxAssetLockInputs { return .consolidate } + let pending = utxoCount - min(finalCount, utxoCount) + return pending > 0 ? .awaitFinality(pending: pending) : .drain + } + + /// The finality the drain builder applies (`is_confirmed || + /// is_instantlocked`), recovered from what the SDK exposes per UTXO: a + /// mined UTXO carries its block height, and an InstantSend-locked one has + /// its txid in the wallet's IS-lock set. Both txid forms are wire order. + static func isFinal(height: UInt32, txid: Data, instantLockedTxids: Set) -> Bool { + height > 0 || instantLockedTxids.contains(txid) + } + + /// Whether every consolidation transaction in `consolidationTxids` (wire + /// order) has produced a final output back in the CoinJoin account. + /// `utxos` is the account's current (txid, isFinal) snapshot. An empty + /// txid list is trivially settled. + static func consolidationSettled( + consolidationTxids: [Data], + utxos: [(txid: Data, isFinal: Bool)] + ) -> Bool { + let finalTxids = Set(utxos.lazy.filter { $0.isFinal }.map { $0.txid }) + return consolidationTxids.allSatisfy { finalTxids.contains($0) } + } +} diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift index f272cdb9b4..d8d42fb10d 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift @@ -164,16 +164,30 @@ struct CoinJoinMoveFundsSheet: View { private var shieldInFlightBody: some View { VStack(alignment: .leading, spacing: 16) { - // Same steps as the internal transfer's Core → Shielded route — - // the drain is one asset lock, driven by the same coordinator. - ShieldedTransferStepList( - currentPhase: viewModel.coordinator.phase, - steps: [ - .init(label: NSLocalizedString("Authorizing", comment: ""), phase: .signing), - .init(label: NSLocalizedString("Locking funds", comment: ""), phase: .locking), - .init(label: NSLocalizedString("Generating proof", comment: ""), phase: .proving), - .init(label: NSLocalizedString("Broadcasting", comment: ""), phase: .broadcasting), - ]) + if viewModel.preparation != nil { + // More mixed coins than one asset lock can spend: they are + // consolidated first, which adds a step ahead of the lock. + ShieldedTransferStepList( + labels: [ + NSLocalizedString("Authorizing", comment: ""), + NSLocalizedString("Preparing your coins", comment: "CoinJoin"), + NSLocalizedString("Locking funds", comment: ""), + NSLocalizedString("Generating proof", comment: ""), + NSLocalizedString("Broadcasting", comment: ""), + ], + currentIndex: viewModel.preparedChecklistIndex) + } else { + // Same steps as the internal transfer's Core → Shielded route — + // the drain is one asset lock, driven by the same coordinator. + ShieldedTransferStepList( + currentPhase: viewModel.coordinator.phase, + steps: [ + .init(label: NSLocalizedString("Authorizing", comment: ""), phase: .signing), + .init(label: NSLocalizedString("Locking funds", comment: ""), phase: .locking), + .init(label: NSLocalizedString("Generating proof", comment: ""), phase: .proving), + .init(label: NSLocalizedString("Broadcasting", comment: ""), phase: .broadcasting), + ]) + } Text(NSLocalizedString( "Building the privacy proof can take up to a minute. Keep the app open.", diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index ad1cecf9c4..3f3bcb3bf5 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -11,6 +11,10 @@ // (`ShieldedTransferCoordinator.performAssetLock(funding: .coinJoinDrain)`): // every mixed-coin UTXO funds the Type 18 lock directly and the shielded // pool receives `lock_value - pool_fee` — no transparent intermediate hop. +// An asset lock may spend at most 100 inputs, so an account holding more +// is first consolidated onto one fresh address of its own CoinJoin +// account (`CoinJoinShieldPlanner`), and the drain runs once those +// outputs are final. // // Failure posture of the shielded flow: a committed asset lock is resumed on // its exact outpoint via `resumeAssetLock` (mirroring the internal transfer @@ -18,7 +22,10 @@ // picked up by the home tx list's `ShieldedRecoverySheet` on the next // launch. A pre-broadcast failure moves nothing — the coins stay in the // CoinJoin account and the popup / Settings / Tools surfaces keep offering -// the move. +// the move. The consolidation never leaves the CoinJoin account either: if +// the app dies, or the drain fails, after a consolidation broadcast, the +// coins sit on one CoinJoin address and the next attempt sees few enough +// UTXOs to drain them directly. // import Combine @@ -52,6 +59,45 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { @Published private(set) var stage: Stage = .choice + /// Progress of the steps that run before the coordinator's asset lock + /// when the CoinJoin account cannot be drained as it stands (more than + /// `CoinJoinShieldPlanner.maxAssetLockInputs` UTXOs, or some not final + /// yet). Nil on the direct path, whose checklist is unchanged. + enum Preparation: Equatable { + case authorizing + case preparingCoins + /// Preparation finished; the coordinator's phase drives the rest. + case done + } + + @Published private(set) var preparation: Preparation? + + /// Active row of the prepared path's five-step checklist (Authorizing, + /// Preparing your coins, Locking funds, Generating proof, Broadcasting); + /// nil renders every row pending. + var preparedChecklistIndex: Int? { + Self.preparedChecklistIndex(preparation: preparation, phase: coordinator.phase) + } + + nonisolated static func preparedChecklistIndex( + preparation: Preparation?, phase: ShieldedTransferCoordinator.Phase + ) -> Int? { + switch preparation { + case nil: return nil + case .authorizing?: return 0 + case .preparingCoins?: return 1 + case .done?: + switch phase { + // `.signing` is the coordinator's preauthorized pass-through. + case .idle, .signing, .locking: return 2 + case .proving: return 3 + case .broadcasting: return 4 + case .success: return 5 + case .failed, .submittedUnconfirmed: return nil + } + } + } + /// CoinJoin balance snapshot at presentation time — the sweep zeroes the /// live balance mid-flow, but the sheet keeps showing what's being moved. let amountDuffs: UInt64 @@ -99,20 +145,199 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// Destination 2: one CoinJoin-drain asset lock — every mixed-coin UTXO /// funds the Type 18 lock directly (no transparent hop) and the shielded - /// pool receives the drained value minus the pool fee. The coordinator - /// runs its own PIN/biometric gate, so this is the flow's single prompt. + /// pool receives the drained value minus the pool fee. + /// + /// When the account holds more UTXOs than one asset lock may spend, they + /// are first consolidated onto one fresh CoinJoin address (see + /// `prepareCoinJoinInputs`). Either way the user is asked once: on the + /// direct path the coordinator runs its own PIN/biometric gate; on the + /// prepared path this model runs the same gate up front and the drain + /// runs `preauthorized`. func moveToShielded() async { guard !isInFlight else { return } stage = .shielding + preparation = nil // A prior failed attempt leaves the coordinator terminal; reset so // `beginTransfer()` doesn't silently bail. if coordinator.phase != .idle { coordinator.reset() } - await coordinator.performAssetLock(funding: .coinJoinDrain) + + let initial = SwiftDashSDKTransactionSender.coinJoinUtxoState() + let step = initial.map { + CoinJoinShieldPlanner.nextStep(utxoCount: $0.count, finalCount: $0.finalCount) + } + Self.log("move to Shielded — CoinJoin UTXOs n=\(initial?.count ?? -1) final=\(initial?.finalCount ?? -1) total=\(initial?.totalDuffs ?? 0) duffs, plan=\(step.map { String(describing: $0) } ?? "unknown")") + + switch step { + case .consolidate?, .awaitFinality?: + await prepareThenDrain() + case .drain?, .nothingToMove?, nil: + // Unchanged direct path. An empty account or an unbound host is + // reported by the coordinator / SDK preflight exactly as before. + await coordinator.performAssetLock(funding: .coinJoinDrain) + finishFromCoordinatorPhase() + } + } + + // MARK: Preparation (more than 100 mixed coins, or coins not yet final) + + /// How long to wait for a consolidation's outputs (or any not-yet-final + /// CoinJoin UTXO) to become final. InstantSend normally locks within + /// seconds; past this the attempt stops with a retryable message rather + /// than hold the sheet open. + static let finalityTimeout: TimeInterval = 180 + + /// Authorize once, bring the CoinJoin account into a drainable shape, then + /// run the coordinator's drain without a second prompt. + private func prepareThenDrain() async { + preparation = .authorizing + do { + try await DWIdentityAuthorizer().authorize() + } catch DWIdentityAuthorizer.AuthError.cancelled { + Self.log("move to Shielded — authorization cancelled") + preparation = nil + stage = .choice + return + } catch { + Self.log("move to Shielded — authorization failed") + preparation = nil + stage = .failed( + message: ShieldedTransferCoordinator.CoordinatorError.authFailed.errorDescription + ?? Self.genericFailureMessage, + destination: .shielded) + return + } + + preparation = .preparingCoins + if let message = await prepareCoinJoinInputs() { + preparation = nil + SwiftDashSDKWalletState.shared.refreshCoinJoinBalance() + stage = .failed(message: message, destination: .shielded) + return + } + + preparation = .done + await DWIdentityAuthorizer.preauthorized { [self] in + await coordinator.performAssetLock(funding: .coinJoinDrain) + } finishFromCoordinatorPhase() } + /// Consolidate (when over the cap) and wait for finality. Returns nil when + /// the account is ready to drain, or the message to show otherwise. + /// + /// One consolidation per attempt: if it is partial and the account is + /// still over the cap afterwards, the attempt stops with a retryable + /// message, and the next attempt consolidates what is left together with + /// the outputs already made. + private func prepareCoinJoinInputs() async -> String? { + // Same execution-boundary check the coordinator makes for the drain: + // the sweep is whole-account too, and a scan that restarted while the + // prompt was open could still be discovering UTXOs. + guard SyncingActivityMonitor.shared.state == .syncDone else { + Self.log("move to Shielded — preparation refused, chain not synced") + return ShieldedTransferCoordinator.CoordinatorError.coinJoinDrainRequiresSync.errorDescription + } + guard let state = SwiftDashSDKTransactionSender.coinJoinUtxoState() else { + return Self.genericFailureMessage + } + + var consolidationTxids: [Data] = [] + var consolidationPartial = false + if CoinJoinShieldPlanner.nextStep(utxoCount: state.count, finalCount: state.finalCount) == .consolidate { + do { + try WalletSendService.ensureOnline() + } catch { + return error.localizedDescription + } + guard let address = SwiftDashSDKTransactionSender.unusedCoinJoinAddress() else { + Self.log("move to Shielded — no unused CoinJoin address for the consolidation") + return Self.genericFailureMessage + } + let chunks = SwiftDashSDKTransactionSender.balancedChunks( + Array(repeating: 0, count: state.count), + maxPerChunk: SwiftDashSDKTransactionSender.maxInputsPerSweep + ).map(\.count) + Self.log("move to Shielded — consolidating n=\(state.count) CoinJoin UTXOs into \(chunks.count) tx(s) \(chunks) to \(address)") + do { + // Off the main actor so the checklist renders first; the + // sender hops back to main for the SDK calls themselves. + let outcome = try await Task.detached(priority: .userInitiated) { + try SwiftDashSDKTransactionSender.sweepCoinJoin(to: address) + }.value + consolidationTxids = outcome.txids + consolidationPartial = outcome.isPartial + Self.log("move to Shielded — consolidation broadcast \(outcome.txids.count) tx(s), \(outcome.failedChunkCount) failed: \(outcome.txids.map(Self.displayHex).joined(separator: ","))\(outcome.firstFailure.map { " first failure: \(String(describing: $0))" } ?? "")") + } catch { + Self.log("move to Shielded — consolidation failed, nothing broadcast: \(String(describing: error))") + return Self.genericFailureMessage + } + guard !consolidationTxids.isEmpty else { + Self.log("move to Shielded — consolidation produced no transaction") + return Self.genericFailureMessage + } + } + + // Wait until the consolidation outputs are back in the account and + // final, and — on the direct-but-not-final path — until every CoinJoin + // UTXO is final: the drain builder spends final inputs only. + let txids = consolidationTxids + let waited = await SwiftDashSDKTransactionSender.waitForCoinJoinUtxoState( + timeout: Self.finalityTimeout + ) { state in + if !txids.isEmpty { + return CoinJoinShieldPlanner.consolidationSettled( + consolidationTxids: txids, utxos: state.txidFinality) + } + return state.finalCount == state.count + } + guard let waited else { return Self.genericFailureMessage } + let after = waited.state + Self.log("move to Shielded — finality wait \(waited.satisfied ? "settled" : "timed out") after \(Int(Self.finalityTimeout))s cap: n=\(after.count) final=\(after.finalCount)") + + if !waited.satisfied { + if !txids.isEmpty || after.finalCount == 0 { + // The consolidated coins are safe on their CoinJoin address; + // a later attempt drains them once they are final. + return NSLocalizedString( + "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes.", + comment: "CoinJoin") + } + // Direct path, some coins still unconfirmed: drain what is final, + // exactly as before this preparation existed. The rest stays in + // the CoinJoin account for a later move. + } + + switch CoinJoinShieldPlanner.nextStep(utxoCount: after.count, finalCount: after.finalCount) { + case .consolidate: + Self.log("move to Shielded — still n=\(after.count) UTXOs after consolidation (partial=\(consolidationPartial))") + return consolidationPartial + ? NSLocalizedString( + "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance.", + comment: "CoinJoin") + : Self.genericFailureMessage + case .nothingToMove: + return Self.genericFailureMessage + case .drain, .awaitFinality: + return nil + } + } + + private static var genericFailureMessage: String { + NSLocalizedString("Couldn't move your CoinJoin funds. Please try again.", comment: "CoinJoin") + } + + /// Exported-log line (DWLogger reaches "Share logs"; os.Logger does not). + private static func log(_ message: String) { + DWLogger.log("🛡️ COINJOIN-SHIELD :: \(message)", className: "CoinJoinMoveFundsViewModel") + } + + /// Display-order (explorer) hex of a wire-order txid. + private static func displayHex(_ txidWire: Data) -> String { + txidWire.reversed().map { String(format: "%02x", $0) }.joined() + } + /// "Try again" from a failed shielded attempt. Mirrors /// `InternalTransferConfirmSheet.tryAgain`: a committed asset lock is /// RESUMED on its exact outpoint (building a second lock would strand the @@ -128,6 +353,9 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { finishFromCoordinatorPhase() return } + // No committed lock to resume: plan afresh. A consolidation that + // already landed shows up as a few UTXOs on one CoinJoin address, so + // this drains them directly (waiting for finality first if needed). coordinator.reset() await moveToShielded() } @@ -157,10 +385,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { default: // The coordinator's single-flight gate refused the call (phase // wasn't idle). Surface a retryable failure rather than hang. - stage = .failed( - message: NSLocalizedString( - "Couldn't move your CoinJoin funds. Please try again.", comment: "CoinJoin"), - destination: .shielded) + stage = .failed(message: Self.genericFailureMessage, destination: .shielded) } } } diff --git a/DashWallet/en.lproj/Localizable.strings b/DashWallet/en.lproj/Localizable.strings index e8e703e0bf..5409aaf5c4 100644 --- a/DashWallet/en.lproj/Localizable.strings +++ b/DashWallet/en.lproj/Localizable.strings @@ -6346,6 +6346,15 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; + +/* CoinJoin */ +"Preparing your coins" = "Preparing your coins"; + +/* CoinJoin */ +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; + +/* CoinJoin */ +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Still calculating the withdrawable amount. Tap Max again in a moment." = "Still calculating the withdrawable amount. Tap Max again in a moment."; From 50533c7b117b02b7a6fe334c9a48db4b24cdf57d Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Sat, 17 Oct 2026 00:26:25 +0300 Subject: [PATCH 02/11] test(coinjoin): pin the CoinJoin to Shielded input planning Covers the >100 consolidation decision, the finality wait, the consolidation-settled check, chunk planning and the prepared checklist. Co-Authored-By: Claude Opus 5.5 --- .../CoinJoinMoveDestinationPolicyTests.swift | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift index cc3a90a5ef..26e76214fe 100644 --- a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift +++ b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift @@ -109,3 +109,119 @@ final class CoinJoinMoveDestinationPolicyTests: XCTestCase { XCTAssertNil(CoinJoinMoveDestinationPolicy.menuRoute(isChainSynced: false, shieldedAvailable: true)) } } + +/// Pins the CoinJoin → Shielded input planning (ticket 32500): an asset lock +/// may spend at most 100 inputs, so a heavier CoinJoin account is consolidated +/// onto one of its own addresses first, and the drain waits for final inputs. +final class CoinJoinShieldPlannerTests: XCTestCase { + + // MARK: nextStep + + func testEmptyAccountHasNothingToMove() { + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 0, finalCount: 0), .nothingToMove) + } + + func testAtTheCapDrainsDirectly() { + XCTAssertEqual(CoinJoinShieldPlanner.maxAssetLockInputs, 100) + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 100, finalCount: 100), .drain) + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 1, finalCount: 1), .drain) + } + + /// The ticket's wallet: 104 mixed coins, one over-cap drain refused by + /// Core as `assetlocktx-too-many-inputs`. + func testOverTheCapConsolidates() { + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 101, finalCount: 101), .consolidate) + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 104, finalCount: 104), .consolidate) + // Finality does not matter above the cap — the sweep is a regular tx. + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 2_000, finalCount: 0), .consolidate) + } + + /// After a consolidation the output is not final until InstantSend locks + /// it; draining then would lock nothing (or only the final remainder). + func testUnderTheCapWithPendingCoinsWaits() { + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 1, finalCount: 0), .awaitFinality(pending: 1)) + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 3, finalCount: 1), .awaitFinality(pending: 2)) + } + + func testFinalCountAboveCountIsClamped() { + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 2, finalCount: 5), .drain) + } + + // MARK: isFinal + + func testMinedUtxoIsFinal() { + XCTAssertTrue(CoinJoinShieldPlanner.isFinal(height: 2_556_386, txid: Data([1]), instantLockedTxids: [])) + } + + func testInstantLockedUtxoIsFinal() { + XCTAssertTrue(CoinJoinShieldPlanner.isFinal(height: 0, txid: Data([1]), instantLockedTxids: [Data([1])])) + } + + func testMempoolUtxoIsNotFinal() { + XCTAssertFalse(CoinJoinShieldPlanner.isFinal(height: 0, txid: Data([1]), instantLockedTxids: [Data([2])])) + } + + // MARK: consolidationSettled + + func testConsolidationSettledNeedsAFinalOutputPerTransaction() { + let a = Data([0xaa]), b = Data([0xbb]), other = Data([0xcc]) + XCTAssertFalse(CoinJoinShieldPlanner.consolidationSettled( + consolidationTxids: [a, b], + utxos: [(a, true), (other, true)])) + XCTAssertFalse(CoinJoinShieldPlanner.consolidationSettled( + consolidationTxids: [a, b], + utxos: [(a, true), (b, false)])) + XCTAssertTrue(CoinJoinShieldPlanner.consolidationSettled( + consolidationTxids: [a, b], + utxos: [(a, true), (b, true), (other, false)])) + } + + func testNoConsolidationIsTriviallySettled() { + XCTAssertTrue(CoinJoinShieldPlanner.consolidationSettled(consolidationTxids: [], utxos: [])) + } + + // MARK: Chunk planning (the consolidation reuses the sweep's chunking) + + private func chunkSizes(_ n: Int) -> [Int] { + SwiftDashSDKTransactionSender.balancedChunks( + Array(0.. Date: Sat, 17 Oct 2026 00:34:36 +0300 Subject: [PATCH 03/11] fix(coinjoin): consolidate above 50 mixed coins, not above 100 Core's 100-input asset-lock cap is the hard limit, but the transition that shields the lock is the tighter one: a ShieldFromAssetLock with an InstantSend proof embeds the whole asset-lock transaction and exceeds Platform's 20 480-byte transition limit from about 65 inputs (dashpay/platform#4460: 83 inputs gave a 23 KB transition). Without the ChainLock fallback (dashpay/platform#5460), which develop's SDK does not have, a direct drain of 65-100 coins is accepted by Core and then stuck as an asset lock. Add CoinJoinShieldPlanner.consolidationThreshold = 50 and consolidate when n > 50; keep maxAssetLockInputs = 100 as the documented hard limit. Planner tests pin the 50/51 boundary and the 65-100 range. Co-Authored-By: Claude Opus 5.5 --- .../CoinJoinMoveDestinationPolicy.swift | 26 +++++++++++--- .../CoinJoinMoveFundsSheet.swift | 2 +- .../CoinJoinMoveFundsViewModel.swift | 21 ++++++----- .../CoinJoinMoveDestinationPolicyTests.swift | 35 ++++++++++++++----- 4 files changed, 61 insertions(+), 23 deletions(-) diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift index 0494c560dc..314a71b083 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift @@ -111,8 +111,15 @@ enum CoinJoinMoveDestinationPolicy { /// and an asset lock may carry at most `maxAssetLockInputs` inputs: Dash Core /// v24 refuses more as non-standard (`assetlocktx-too-many-inputs`, /// `MAX_STANDARD_ASSET_LOCK_INPUTS`) and peers drop it silently, and Platform -/// consensus applies the same cap (`max_asset_lock_transaction_inputs`). A -/// heavier account is therefore first consolidated — swept to one fresh +/// consensus applies the same cap (`max_asset_lock_transaction_inputs`). +/// That is the hard limit, but not the binding one: the drain is shielded by +/// a ShieldFromAssetLock transition whose InstantSend proof embeds the whole +/// asset-lock transaction, and Platform caps a transition at 20 480 bytes. +/// That cap is exceeded from about 65 inputs (dashpay/platform#4460: 83 inputs +/// gave a 23 KB transition), so a 65–100-input drain is accepted by Core and +/// then stuck as an asset lock Platform cannot consume until the ChainLock +/// fallback (dashpay/platform#5460) ships in the SDK. An account above +/// `consolidationThreshold` is therefore first consolidated — swept to one fresh /// address of its own CoinJoin account in ≤500-input regular transactions — /// and drained once those outputs are final. The coins never leave the /// CoinJoin account until the drain, so an interrupted attempt leaves them on @@ -123,14 +130,23 @@ enum CoinJoinMoveDestinationPolicy { enum CoinJoinShieldPlanner { /// Most inputs a single asset lock may carry (Dash Core v24 policy and - /// Platform consensus agree on 100). + /// Platform consensus agree on 100). The hard limit — never drain above it. static let maxAssetLockInputs = 100 + /// Most UTXOs drained directly; above this the account is consolidated + /// first. Tighter than `maxAssetLockInputs` because the ShieldFromAssetLock + /// transition carrying an InstantSend proof outgrows Platform's 20 480-byte + /// transition limit at about 65 inputs (see the type doc); 50 leaves + /// headroom for input size variance. Revisit once the ChainLock-proof + /// fallback (dashpay/platform#5460) is in the SDK the app builds against. + static let consolidationThreshold = 50 + /// What the next step towards the drain is. enum Step: Equatable { /// The account holds no spendable UTXO — there is nothing to shield. case nothingToMove - /// More UTXOs than one asset lock may spend: consolidate first. + /// More UTXOs than one drain may safely spend + /// (`consolidationThreshold`): consolidate first. case consolidate /// Few enough UTXOs, but `pending` of them are not final yet. The /// drain builder spends only final inputs (confirmed or @@ -144,7 +160,7 @@ enum CoinJoinShieldPlanner { /// `finalCount` are final. static func nextStep(utxoCount: Int, finalCount: Int) -> Step { guard utxoCount > 0 else { return .nothingToMove } - if utxoCount > maxAssetLockInputs { return .consolidate } + if utxoCount > consolidationThreshold { return .consolidate } let pending = utxoCount - min(finalCount, utxoCount) return pending > 0 ? .awaitFinality(pending: pending) : .drain } diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift index d8d42fb10d..5a0e6c73d2 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift @@ -165,7 +165,7 @@ struct CoinJoinMoveFundsSheet: View { private var shieldInFlightBody: some View { VStack(alignment: .leading, spacing: 16) { if viewModel.preparation != nil { - // More mixed coins than one asset lock can spend: they are + // More mixed coins than one drain can safely spend: they are // consolidated first, which adds a step ahead of the lock. ShieldedTransferStepList( labels: [ diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index 3f3bcb3bf5..88dd698226 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -11,10 +11,12 @@ // (`ShieldedTransferCoordinator.performAssetLock(funding: .coinJoinDrain)`): // every mixed-coin UTXO funds the Type 18 lock directly and the shielded // pool receives `lock_value - pool_fee` — no transparent intermediate hop. -// An asset lock may spend at most 100 inputs, so an account holding more -// is first consolidated onto one fresh address of its own CoinJoin -// account (`CoinJoinShieldPlanner`), and the drain runs once those -// outputs are final. +// An asset lock may spend at most 100 inputs (Core / Platform), and its +// shield transition with an InstantSend proof outgrows Platform's size +// limit from about 65, so an account holding more than 50 is first +// consolidated onto one fresh address of its own CoinJoin account +// (`CoinJoinShieldPlanner.consolidationThreshold`), and the drain runs +// once those outputs are final. // // Failure posture of the shielded flow: a committed asset lock is resumed on // its exact outpoint via `resumeAssetLock` (mirroring the internal transfer @@ -61,7 +63,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// Progress of the steps that run before the coordinator's asset lock /// when the CoinJoin account cannot be drained as it stands (more than - /// `CoinJoinShieldPlanner.maxAssetLockInputs` UTXOs, or some not final + /// `CoinJoinShieldPlanner.consolidationThreshold` UTXOs, or some not final /// yet). Nil on the direct path, whose checklist is unchanged. enum Preparation: Equatable { case authorizing @@ -147,7 +149,8 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// funds the Type 18 lock directly (no transparent hop) and the shielded /// pool receives the drained value minus the pool fee. /// - /// When the account holds more UTXOs than one asset lock may spend, they + /// When the account holds more UTXOs than one drain may safely spend + /// (`CoinJoinShieldPlanner.consolidationThreshold`), they /// are first consolidated onto one fresh CoinJoin address (see /// `prepareCoinJoinInputs`). Either way the user is asked once: on the /// direct path the coordinator runs its own PIN/biometric gate; on the @@ -180,7 +183,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { } } - // MARK: Preparation (more than 100 mixed coins, or coins not yet final) + // MARK: Preparation (more than 50 mixed coins, or coins not yet final) /// How long to wait for a consolidation's outputs (or any not-yet-final /// CoinJoin UTXO) to become final. InstantSend normally locks within @@ -224,11 +227,11 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { finishFromCoordinatorPhase() } - /// Consolidate (when over the cap) and wait for finality. Returns nil when + /// Consolidate (when over the threshold) and wait for finality. Returns nil when /// the account is ready to drain, or the message to show otherwise. /// /// One consolidation per attempt: if it is partial and the account is - /// still over the cap afterwards, the attempt stops with a retryable + /// still over the threshold afterwards, the attempt stops with a retryable /// message, and the next attempt consolidates what is left together with /// the outputs already made. private func prepareCoinJoinInputs() async -> String? { diff --git a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift index 26e76214fe..7a706768f9 100644 --- a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift +++ b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift @@ -111,8 +111,10 @@ final class CoinJoinMoveDestinationPolicyTests: XCTestCase { } /// Pins the CoinJoin → Shielded input planning (ticket 32500): an asset lock -/// may spend at most 100 inputs, so a heavier CoinJoin account is consolidated -/// onto one of its own addresses first, and the drain waits for final inputs. +/// may spend at most 100 inputs, and its shield transition with an InstantSend +/// proof outgrows Platform's 20 480-byte limit from about 65, so an account +/// above 50 is consolidated onto one of its own addresses first, and the drain +/// waits for final inputs. final class CoinJoinShieldPlannerTests: XCTestCase { // MARK: nextStep @@ -121,12 +123,29 @@ final class CoinJoinShieldPlannerTests: XCTestCase { XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 0, finalCount: 0), .nothingToMove) } - func testAtTheCapDrainsDirectly() { + func testThresholdIsBelowBothLimits() { XCTAssertEqual(CoinJoinShieldPlanner.maxAssetLockInputs, 100) - XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 100, finalCount: 100), .drain) + XCTAssertEqual(CoinJoinShieldPlanner.consolidationThreshold, 50) + // Below ~65 inputs, where an IS-proof transition passes 20 480 bytes. + XCTAssertLessThan(CoinJoinShieldPlanner.consolidationThreshold, 65) + } + + func testAtTheThresholdDrainsDirectly() { + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 50, finalCount: 50), .drain) XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 1, finalCount: 1), .drain) } + func testJustOverTheThresholdConsolidates() { + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 51, finalCount: 51), .consolidate) + } + + /// 65–100 coins: Core would accept the asset lock, but its shield + /// transition with an InstantSend proof is too large for Platform. + func testCoreAcceptableButTransitionTooLargeConsolidates() { + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 65, finalCount: 65), .consolidate) + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 100, finalCount: 100), .consolidate) + } + /// The ticket's wallet: 104 mixed coins, one over-cap drain refused by /// Core as `assetlocktx-too-many-inputs`. func testOverTheCapConsolidates() { @@ -204,10 +223,10 @@ final class CoinJoinShieldPlannerTests: XCTestCase { XCTAssertTrue(chunks.allSatisfy { $0.count <= 500 }) } - /// A consolidation produces one output per chunk; even the largest - /// accounts land far under the asset-lock cap after one pass. - func testOneConsolidationPassFitsUnderTheAssetLockCap() { - XCTAssertLessThanOrEqual(chunkSizes(50_000).count, CoinJoinShieldPlanner.maxAssetLockInputs) + /// A consolidation produces one output per chunk; even very large + /// accounts land at or under the direct-drain threshold after one pass. + func testOneConsolidationPassFitsUnderTheThreshold() { + XCTAssertLessThanOrEqual(chunkSizes(25_000).count, CoinJoinShieldPlanner.consolidationThreshold) } // MARK: Checklist From 4b4fb0a8ba4293c4e1f67a6e626b9e8848d50354 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Sat, 17 Oct 2026 01:30:42 +0300 Subject: [PATCH 04/11] fix(coinjoin): log the real finality wait time, not the cap Co-Authored-By: Claude Opus 5.5 --- .../CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index 88dd698226..32b67f82ea 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -286,6 +286,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // final, and — on the direct-but-not-final path — until every CoinJoin // UTXO is final: the drain builder spends final inputs only. let txids = consolidationTxids + let waitStart = Date() let waited = await SwiftDashSDKTransactionSender.waitForCoinJoinUtxoState( timeout: Self.finalityTimeout ) { state in @@ -297,7 +298,10 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { } guard let waited else { return Self.genericFailureMessage } let after = waited.state - Self.log("move to Shielded — finality wait \(waited.satisfied ? "settled" : "timed out") after \(Int(Self.finalityTimeout))s cap: n=\(after.count) final=\(after.finalCount)") + let waitedSeconds = Int(Date().timeIntervalSince(waitStart).rounded()) + Self.log( + "move to Shielded — finality wait \(waited.satisfied ? "settled" : "timed out") after \(waitedSeconds)s " + + "(cap \(Int(Self.finalityTimeout))s): n=\(after.count) final=\(after.finalCount)") if !waited.satisfied { if !txids.isEmpty || after.finalCount == 0 { From 61e570221c7e51dc5631a716aa299aade7beceb7 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Mon, 19 Oct 2026 22:03:13 +0300 Subject: [PATCH 05/11] fix(coinjoin): plan the Shielded move after the PIN, stop on an uncertain consolidation - Authorize once, up front, on both paths and plan from the CoinJoin UTXO set read after the prompt; coins that arrive while it is open are planned for. The drain always runs preauthorized. - A partial consolidation, or one whose broadcast outcome is unknown, stops before the drain instead of draining over inputs that may already be spent. - The sweep skips isLocked rows like the planner does, and reports an unconfirmed broadcast ahead of a rejection when nothing was accepted. Co-Authored-By: Claude Opus 5.5 --- .../SwiftDashSDKTransactionSender.swift | 20 ++- .../CoinJoinMoveFundsViewModel.swift | 147 +++++++++++------- 2 files changed, 103 insertions(+), 64 deletions(-) diff --git a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift index 95369d0b65..aad19c6916 100644 --- a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift +++ b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift @@ -268,8 +268,11 @@ final class SwiftDashSDKTransactionSender: NSObject { } // Snapshot the account's spendable UTXOs (after the recovery scan has - // materialized deep `/0/` + `/1/` addresses). + // materialized deep `/0/` + `/1/` addresses). `isLocked` rows are + // left out, matching `coinJoinUtxoState()`: coin selection never + // spends them. let utxos = manager.accountUtxos(for: walletId, balance: cjBalance) + .filter { !$0.isLocked } guard !utxos.isEmpty else { return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil) } @@ -286,6 +289,10 @@ final class SwiftDashSDKTransactionSender: NSObject { var txids: [Data] = [] var failedChunkCount = 0 var firstError: Error? + // An unconfirmed broadcast may have reached peers: when nothing was + // accepted it is the error reported, ahead of a rejection, so a + // caller can tell it apart from "nothing moved". + var firstUnknown: Error? for (index, chunk) in Self.balancedChunks(utxos, maxPerChunk: Self.maxInputsPerSweep).enumerated() { do { let builder = try CoreTransactionBuilder(network: network) @@ -316,11 +323,14 @@ final class SwiftDashSDKTransactionSender: NSObject { } catch { failedChunkCount += 1 firstError = firstError ?? error + if case SendError.transactionStatusUnknown = error { + firstUnknown = firstUnknown ?? error + } Self.logger.error( "💸 TXSEND :: coinjoin sweep chunk \(index + 1, privacy: .public) failed to broadcast, continuing: \(String(describing: error), privacy: .public)") } } - if txids.isEmpty, let error = firstError { throw error } + if txids.isEmpty, let error = firstUnknown ?? firstError { throw error } return CoinJoinSweepOutcome( txids: txids, failedChunkCount: failedChunkCount, firstFailure: firstError) } @@ -385,9 +395,9 @@ final class SwiftDashSDKTransactionSender: NSObject { /// Nil when the host has no wallet or manager bound; an account that does /// not exist reads as empty. /// - /// Reserved (`isLocked`) rows are left out: neither the drain nor the sweep - /// can spend them, so counting them would ask for a consolidation that has - /// nothing to consolidate. + /// `isLocked` rows are left out: coin selection never spends them, so + /// counting them would ask for a consolidation that has nothing to + /// consolidate. @MainActor static func coinJoinUtxoState() -> CoinJoinUtxoState? { let host = SwiftDashSDKHost.shared diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index 32b67f82ea..b3efd3b0d1 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -152,10 +152,10 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// When the account holds more UTXOs than one drain may safely spend /// (`CoinJoinShieldPlanner.consolidationThreshold`), they /// are first consolidated onto one fresh CoinJoin address (see - /// `prepareCoinJoinInputs`). Either way the user is asked once: on the - /// direct path the coordinator runs its own PIN/biometric gate; on the - /// prepared path this model runs the same gate up front and the drain - /// runs `preauthorized`. + /// `prepareCoinJoinInputs`). Either way the user is asked once, up front; + /// the plan is made from the UTXO set read after the prompt, so coins that + /// arrive while it is open are planned for, and the drain runs + /// `preauthorized`. func moveToShielded() async { guard !isInFlight else { return } stage = .shielding @@ -166,35 +166,13 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { coordinator.reset() } - let initial = SwiftDashSDKTransactionSender.coinJoinUtxoState() - let step = initial.map { - CoinJoinShieldPlanner.nextStep(utxoCount: $0.count, finalCount: $0.finalCount) + // Read before the prompt only to choose the checklist. + let initial = Self.plan() + Self.log("move to Shielded — before authorization: \(initial.description)") + if initial.needsPreparation { + preparation = .authorizing } - Self.log("move to Shielded — CoinJoin UTXOs n=\(initial?.count ?? -1) final=\(initial?.finalCount ?? -1) total=\(initial?.totalDuffs ?? 0) duffs, plan=\(step.map { String(describing: $0) } ?? "unknown")") - - switch step { - case .consolidate?, .awaitFinality?: - await prepareThenDrain() - case .drain?, .nothingToMove?, nil: - // Unchanged direct path. An empty account or an unbound host is - // reported by the coordinator / SDK preflight exactly as before. - await coordinator.performAssetLock(funding: .coinJoinDrain) - finishFromCoordinatorPhase() - } - } - - // MARK: Preparation (more than 50 mixed coins, or coins not yet final) - /// How long to wait for a consolidation's outputs (or any not-yet-final - /// CoinJoin UTXO) to become final. InstantSend normally locks within - /// seconds; past this the attempt stops with a retryable message rather - /// than hold the sheet open. - static let finalityTimeout: TimeInterval = 180 - - /// Authorize once, bring the CoinJoin account into a drainable shape, then - /// run the coordinator's drain without a second prompt. - private func prepareThenDrain() async { - preparation = .authorizing do { try await DWIdentityAuthorizer().authorize() } catch DWIdentityAuthorizer.AuthError.cancelled { @@ -212,29 +190,70 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { return } - preparation = .preparingCoins - if let message = await prepareCoinJoinInputs() { - preparation = nil - SwiftDashSDKWalletState.shared.refreshCoinJoinBalance() - stage = .failed(message: message, destination: .shielded) - return + let current = Self.plan() + Self.log("move to Shielded — after authorization: \(current.description)") + if current.needsPreparation, let state = current.state { + preparation = .preparingCoins + if let message = await prepareCoinJoinInputs(state) { + preparation = nil + SwiftDashSDKWalletState.shared.refreshCoinJoinBalance() + stage = .failed(message: message, destination: .shielded) + return + } + } + if preparation != nil { + preparation = .done } - preparation = .done + // An empty account or an unbound host is reported by the coordinator / + // SDK preflight exactly as before. await DWIdentityAuthorizer.preauthorized { [self] in await coordinator.performAssetLock(funding: .coinJoinDrain) } finishFromCoordinatorPhase() } + /// The CoinJoin account's UTXO snapshot and the planner's verdict on it. + private struct Plan { + let state: SwiftDashSDKTransactionSender.CoinJoinUtxoState? + let step: CoinJoinShieldPlanner.Step? + + var needsPreparation: Bool { + switch step { + case .consolidate?, .awaitFinality?: return true + case .drain?, .nothingToMove?, nil: return false + } + } + + var description: String { + "CoinJoin UTXOs n=\(state?.count ?? -1) final=\(state?.finalCount ?? -1) total=\(state?.totalDuffs ?? 0) duffs, plan=\(step.map { String(describing: $0) } ?? "unknown")" + } + } + + private static func plan() -> Plan { + let state = SwiftDashSDKTransactionSender.coinJoinUtxoState() + return Plan( + state: state, + step: state.map { CoinJoinShieldPlanner.nextStep(utxoCount: $0.count, finalCount: $0.finalCount) }) + } + + // MARK: Preparation (more than 50 mixed coins, or coins not yet final) + + /// How long to wait for a consolidation's outputs (or any not-yet-final + /// CoinJoin UTXO) to become final. InstantSend normally locks within + /// seconds; past this the attempt stops with a retryable message rather + /// than hold the sheet open. + static let finalityTimeout: TimeInterval = 180 + /// Consolidate (when over the threshold) and wait for finality. Returns nil when /// the account is ready to drain, or the message to show otherwise. /// - /// One consolidation per attempt: if it is partial and the account is - /// still over the threshold afterwards, the attempt stops with a retryable - /// message, and the next attempt consolidates what is left together with - /// the outputs already made. - private func prepareCoinJoinInputs() async -> String? { + /// One consolidation per attempt: a partial one stops the attempt with a + /// retryable message, and the next attempt consolidates what is left + /// together with the outputs already made. + /// + /// - Parameter state: the UTXO set read after authorization. + private func prepareCoinJoinInputs(_ state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) async -> String? { // Same execution-boundary check the coordinator makes for the drain: // the sweep is whole-account too, and a scan that restarted while the // prompt was open could still be discovering UTXOs. @@ -242,12 +261,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { Self.log("move to Shielded — preparation refused, chain not synced") return ShieldedTransferCoordinator.CoordinatorError.coinJoinDrainRequiresSync.errorDescription } - guard let state = SwiftDashSDKTransactionSender.coinJoinUtxoState() else { - return Self.genericFailureMessage - } - var consolidationTxids: [Data] = [] - var consolidationPartial = false if CoinJoinShieldPlanner.nextStep(utxoCount: state.count, finalCount: state.finalCount) == .consolidate { do { try WalletSendService.ensureOnline() @@ -270,10 +284,25 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { try SwiftDashSDKTransactionSender.sweepCoinJoin(to: address) }.value consolidationTxids = outcome.txids - consolidationPartial = outcome.isPartial Self.log("move to Shielded — consolidation broadcast \(outcome.txids.count) tx(s), \(outcome.failedChunkCount) failed: \(outcome.txids.map(Self.displayHex).joined(separator: ","))\(outcome.firstFailure.map { " first failure: \(String(describing: $0))" } ?? "")") + // A chunk that failed may still have reached peers (an + // unconfirmed broadcast), and the wallet may not show its + // inputs as spent yet; a drain now could spend them a second + // time. Stop here; the next attempt plans from the UTXO set + // as the wallet reads it then. + if outcome.isPartial { + Self.log("move to Shielded — partial consolidation, stopping before the drain") + return NSLocalizedString( + "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance.", + comment: "CoinJoin") + } + } catch SwiftDashSDKTransactionSender.SendError.transactionStatusUnknown(let txid, let reason) { + // The broadcast may have reached peers; a retry right away could + // spend the same coins again before the wallet sees it. + Self.log("move to Shielded — consolidation outcome unknown for \(txid): \(reason)") + return Self.preparingMessage } catch { - Self.log("move to Shielded — consolidation failed, nothing broadcast: \(String(describing: error))") + Self.log("move to Shielded — consolidation failed, nothing accepted: \(String(describing: error))") return Self.genericFailureMessage } guard !consolidationTxids.isEmpty else { @@ -307,9 +336,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { if !txids.isEmpty || after.finalCount == 0 { // The consolidated coins are safe on their CoinJoin address; // a later attempt drains them once they are final. - return NSLocalizedString( - "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes.", - comment: "CoinJoin") + return Self.preparingMessage } // Direct path, some coins still unconfirmed: drain what is final, // exactly as before this preparation existed. The rest stays in @@ -318,12 +345,8 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { switch CoinJoinShieldPlanner.nextStep(utxoCount: after.count, finalCount: after.finalCount) { case .consolidate: - Self.log("move to Shielded — still n=\(after.count) UTXOs after consolidation (partial=\(consolidationPartial))") - return consolidationPartial - ? NSLocalizedString( - "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance.", - comment: "CoinJoin") - : Self.genericFailureMessage + Self.log("move to Shielded — still n=\(after.count) UTXOs after consolidation") + return Self.genericFailureMessage case .nothingToMove: return Self.genericFailureMessage case .drain, .awaitFinality: @@ -331,6 +354,12 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { } } + private static var preparingMessage: String { + NSLocalizedString( + "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes.", + comment: "CoinJoin") + } + private static var genericFailureMessage: String { NSLocalizedString("Couldn't move your CoinJoin funds. Please try again.", comment: "CoinJoin") } From 08fbd74590a7732205fc75d318084ea71ca6fb3c Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Tue, 20 Oct 2026 00:54:31 +0300 Subject: [PATCH 06/11] fix(coinjoin): pin the move to its wallet, fail closed on unreadable UTXOs - Pin both legs of the CoinJoin move sheet to the wallet and network active when it opened (CoinJoinWalletBinding): the plan, the consolidation address and sweep, the finality wait, the drain, the resume and the Dash Wallet sweep (amount and destination) all re-check it, after the PIN too. - A cancelled task never reaches the consolidation or the drain; the coordinator checks before building any asset lock. - The SDK account readers return [] on failure: a read that can't be told apart from one (no accounts at all, or no UTXOs behind a non-zero CoinJoin balance) stops the move instead of falling through to the whole-account drain. The finality wait retries such reads and never returns an older snapshot. - Exported logs carry counts and error codes only, no consolidation address, txid or error text. - A committed lock whose resume stopped before the proof is kept for the next try instead of being followed by a second drain. Co-Authored-By: Claude Opus 5.5 --- .../SwiftDashSDKTransactionSender.swift | 130 +++++++++---- .../Transactions/WalletSendService.swift | 29 ++- .../CoinJoinMoveDestinationPolicy.swift | 19 +- .../CoinJoinMoveFundsViewModel.swift | 172 ++++++++++++++---- .../ShieldedTransferCoordinator.swift | 49 ++++- .../CoinJoinMoveDestinationPolicyTests.swift | 22 +++ 6 files changed, 346 insertions(+), 75 deletions(-) diff --git a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift index aad19c6916..e15cd5a949 100644 --- a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift +++ b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift @@ -244,11 +244,17 @@ final class SwiftDashSDKTransactionSender: NSObject { /// longer supported, so we move the user's mixed coins into their normal /// spendable balance. /// - /// - Parameter address: Destination Dash address (the user's own BIP44 - /// receive address, resolved via `SwiftDashSDKReceiveAddressReader`). + /// - Parameters: + /// - address: Destination Dash address (the user's own BIP44 receive + /// address, resolved via `SwiftDashSDKReceiveAddressReader`, or a fresh + /// CoinJoin address for the Shielded consolidation). + /// - binding: When set, the sweep refuses to run unless this is still the + /// active wallet and network. /// - Returns: A `CoinJoinSweepOutcome` carrying the broadcast chunks' txids /// and any chunk failure. Throws only when nothing broadcast at all. - static func sweepCoinJoin(to address: String) throws -> CoinJoinSweepOutcome { + static func sweepCoinJoin( + to address: String, expecting binding: CoinJoinWalletBinding? = nil + ) throws -> CoinJoinSweepOutcome { logger.info("💸 TXSEND :: sweeping CoinJoin account → spendable balance") let sweep = { @MainActor () throws -> CoinJoinSweepOutcome in @@ -257,20 +263,23 @@ final class SwiftDashSDKTransactionSender: NSObject { let network = host.runningNetwork else { throw SendError.walletNotReady("PlatformWalletManager wallet is not available") } + if let binding, binding != CoinJoinWalletBinding.current() { + throw SendError.walletNotReady("the active wallet changed") + } let core = try wallet.coreWallet() let walletId = wallet.walletId // CoinJoin account-0 balance descriptor (mirrors // SwiftDashSDKCoinJoinBalanceReader: typeTag 1, index 0). Used only to // address the account for UTXO enumeration. - guard let cjBalance = Self.coinJoinAccountBalance(manager: manager, walletId: walletId) else { + guard let cjBalance = Self.coinJoinAccountBalance(in: manager.accountBalances(for: walletId)) else { return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil) } // Snapshot the account's spendable UTXOs (after the recovery scan has // materialized deep `/0/` + `/1/` addresses). `isLocked` rows are - // left out, matching `coinJoinUtxoState()`: coin selection never - // spends them. + // left out, matching `coinJoinUtxoState(expecting:)`: coin + // selection never spends them. let utxos = manager.accountUtxos(for: walletId, balance: cjBalance) .filter { !$0.isLocked } guard !utxos.isEmpty else { @@ -357,18 +366,53 @@ final class SwiftDashSDKTransactionSender: NSObject { // MARK: - CoinJoin consolidation (CoinJoin → Shielded over the asset-lock input cap) /// The CoinJoin account-0 balance descriptor (typeTag 1, index 0 — mirrors - /// `SwiftDashSDKCoinJoinBalanceReader`), which addresses the account for - /// UTXO and address-pool enumeration. Nil when the wallet has no CoinJoin - /// account. - @MainActor + /// `SwiftDashSDKCoinJoinBalanceReader`) among a wallet's `accountBalances`, + /// which addresses the account for UTXO and address-pool enumeration. Nil + /// when the wallet has no CoinJoin account. private static func coinJoinAccountBalance( - manager: PlatformWalletManager, walletId: Data + in balances: [PlatformWalletManager.AccountBalance] ) -> PlatformWalletManager.AccountBalance? { - manager.accountBalances(for: walletId).first(where: { + balances.first(where: { $0.typeTag == Self.coinJoinTypeTag && $0.index == Self.coinJoinAccountIndex }) } + /// The CoinJoin account's descriptor and UTXO rows (locked ones included), + /// or nil when the read can't be told apart from a failed one (see + /// `CoinJoinShieldPlanner.utxoReadIsUsable`). An account that does not + /// exist reads as no descriptor and no rows. + @MainActor + private static func coinJoinUtxoRows( + manager: PlatformWalletManager, walletId: Data + ) -> (balance: PlatformWalletManager.AccountBalance?, utxos: [PlatformWalletManager.AccountUtxo])? { + let balances = manager.accountBalances(for: walletId) + let cjBalance = coinJoinAccountBalance(in: balances) + let utxos = cjBalance.map { manager.accountUtxos(for: walletId, balance: $0) } ?? [] + let balanceIsZero = cjBalance.map { + $0.confirmed == 0 && $0.unconfirmed == 0 && $0.immature == 0 && $0.locked == 0 + } + guard CoinJoinShieldPlanner.utxoReadIsUsable( + accountCount: balances.count, coinJoinBalanceIsZero: balanceIsZero, utxoCount: utxos.count) + else { return nil } + return (cjBalance, utxos) + } + + /// The wallet and network a CoinJoin → Shielded move was authorized for. + /// Each step of the move re-checks it, so a wallet or network switch while + /// it runs stops the move instead of carrying it over to another wallet. + struct CoinJoinWalletBinding: Equatable { + let walletId: Data + let network: Network + + /// The host's active wallet and network; nil when none is bound. + @MainActor + static func current() -> CoinJoinWalletBinding? { + let host = SwiftDashSDKHost.shared + guard let wallet = host.wallet, let network = host.runningNetwork else { return nil } + return CoinJoinWalletBinding(walletId: wallet.walletId, network: network) + } + } + /// The CoinJoin account's spendable UTXO set, as `CoinJoinShieldPlanner` /// reads it. struct CoinJoinUtxoState { @@ -383,6 +427,7 @@ final class SwiftDashSDKTransactionSender: NSObject { let isFinal: Bool } + let binding: CoinJoinWalletBinding let entries: [Entry] var count: Int { entries.count } @@ -392,22 +437,21 @@ final class SwiftDashSDKTransactionSender: NSObject { } /// Snapshot of the CoinJoin account's spendable UTXOs with their finality. - /// Nil when the host has no wallet or manager bound; an account that does - /// not exist reads as empty. + /// Nil when it can't be read: the host has no wallet or manager bound, the + /// active wallet is not `binding`, or the SDK read looks failed (see + /// `coinJoinUtxoRows`). An account that does not exist reads as empty. /// /// `isLocked` rows are left out: coin selection never spends them, so /// counting them would ask for a consolidation that has nothing to /// consolidate. @MainActor - static func coinJoinUtxoState() -> CoinJoinUtxoState? { + static func coinJoinUtxoState(expecting binding: CoinJoinWalletBinding) -> CoinJoinUtxoState? { let host = SwiftDashSDKHost.shared - guard let wallet = host.wallet, let manager = host.manager else { return nil } - let walletId = wallet.walletId - guard let cjBalance = coinJoinAccountBalance(manager: manager, walletId: walletId) else { - return CoinJoinUtxoState(entries: []) - } + guard let manager = host.manager, CoinJoinWalletBinding.current() == binding else { return nil } + let walletId = binding.walletId + guard let rows = coinJoinUtxoRows(manager: manager, walletId: walletId) else { return nil } let instantLocked = Set(manager.instantSendLockTxids(for: walletId)) - let entries = manager.accountUtxos(for: walletId, balance: cjBalance) + let entries = rows.utxos .filter { !$0.isLocked } .map { utxo in CoinJoinUtxoState.Entry( @@ -419,7 +463,7 @@ final class SwiftDashSDKTransactionSender: NSObject { txid: utxo.outpointTxid, instantLockedTxids: instantLocked)) } - return CoinJoinUtxoState(entries: entries) + return CoinJoinUtxoState(binding: binding, entries: entries) } /// A fresh receive address of this wallet's own CoinJoin account — the @@ -433,18 +477,20 @@ final class SwiftDashSDKTransactionSender: NSObject { /// paid here is detected and lands back in the CoinJoin account, and its /// use moves the pool's gap forward like any other receive. @MainActor - static func unusedCoinJoinAddress() -> String? { + static func unusedCoinJoinAddress(for binding: CoinJoinWalletBinding) -> String? { let host = SwiftDashSDKHost.shared - guard let wallet = host.wallet, let manager = host.manager else { return nil } - let walletId = wallet.walletId - guard let cjBalance = coinJoinAccountBalance(manager: manager, walletId: walletId), + guard let manager = host.manager, CoinJoinWalletBinding.current() == binding else { return nil } + let walletId = binding.walletId + // A failed UTXO read would leave funded addresses looking unused. + guard let rows = coinJoinUtxoRows(manager: manager, walletId: walletId), + let cjBalance = rows.balance, let network = try? PaymentNetworkResolver.current() else { return nil } // Pool type 0 = External (see `AccountAddressPoolSnapshot.pool_type`). guard let external = manager.accountAddressPools(for: walletId, balance: cjBalance) .first(where: { $0.poolType == 0 }) else { return nil } - let fundedScripts = Set(manager.accountUtxos(for: walletId, balance: cjBalance).map(\.scriptPubkey)) + let fundedScripts = Set(rows.utxos.map(\.scriptPubkey)) let candidates = external.addresses .filter { !$0.isUsed && !$0.address.isEmpty } .sorted { $0.addressIndex < $1.addressIndex } @@ -458,21 +504,33 @@ final class SwiftDashSDKTransactionSender: NSObject { return nil } - /// Poll the CoinJoin UTXO state until `isDone` holds or `timeout` elapses. - /// Returns the last snapshot and whether `isDone` held for it; nil only - /// when the host lost its wallet. Sleeps off the main actor between polls - /// and stops early when the calling task is cancelled. + /// Poll `binding`'s CoinJoin UTXO state until `isDone` holds or `timeout` + /// elapses. Returns the last snapshot and whether `isDone` held for it; + /// nil when the active wallet is no longer `binding`, or when the last + /// poll before the deadline could not read the state (a read that looks + /// failed is retried, never taken as the answer, and an older snapshot is + /// never returned in its place). Sleeps off the main actor between polls. + /// + /// - Throws: `CancellationError` when the calling task is cancelled, even + /// if the last snapshot satisfied `isDone`. static func waitForCoinJoinUtxoState( + binding: CoinJoinWalletBinding, timeout: TimeInterval, pollInterval: TimeInterval = 1, until isDone: @escaping (CoinJoinUtxoState) -> Bool - ) async -> (state: CoinJoinUtxoState, satisfied: Bool)? { + ) async throws -> (state: CoinJoinUtxoState, satisfied: Bool)? { let deadline = Date().addingTimeInterval(timeout) while true { - guard let state = await MainActor.run(body: { coinJoinUtxoState() }) else { return nil } - if isDone(state) { return (state, true) } - if Date() >= deadline || Task.isCancelled { return (state, false) } - try? await Task.sleep(nanoseconds: UInt64(pollInterval * 1_000_000_000)) + try Task.checkCancellation() + let read = await MainActor.run { () -> (bound: Bool, state: CoinJoinUtxoState?) in + if let state = coinJoinUtxoState(expecting: binding) { return (true, state) } + return (CoinJoinWalletBinding.current() == binding, nil) + } + try Task.checkCancellation() + guard read.bound else { return nil } + if let state = read.state, isDone(state) { return (state, true) } + if Date() >= deadline { return read.state.map { ($0, false) } } + try await Task.sleep(nanoseconds: UInt64(pollInterval * 1_000_000_000)) } } diff --git a/DashWallet/Sources/Models/Transactions/WalletSendService.swift b/DashWallet/Sources/Models/Transactions/WalletSendService.swift index 4bd290a219..48aa2e3a0a 100644 --- a/DashWallet/Sources/Models/Transactions/WalletSendService.swift +++ b/DashWallet/Sources/Models/Transactions/WalletSendService.swift @@ -424,9 +424,24 @@ final class WalletSendService: NSObject { /// /// - Returns: the CoinJoin balance (duffs) that was swept, for the success /// message; the on-chain amount delivered is this minus the network fee. + /// - Parameter binding: the wallet and network to sweep; the sweep refuses + /// to run unless it is still the active one. Nil pins the wallet active + /// on entry. @discardableResult - func sweepCoinJoin() async throws -> UInt64 { - let amount = await MainActor.run { SwiftDashSDKWalletState.shared.coinJoinBalanceDuffs } + func sweepCoinJoin( + expecting binding: SwiftDashSDKTransactionSender.CoinJoinWalletBinding? = nil + ) async throws -> UInt64 { + // The pin and the amount are read in one hop. The amount is the + // published CoinJoin balance, which can lag a wallet switch; the + // sweep itself spends only the pinned wallet's UTXOs. + let (pinned, amount) = try await MainActor.run { + () throws -> (SwiftDashSDKTransactionSender.CoinJoinWalletBinding, UInt64) in + guard let current = SwiftDashSDKTransactionSender.CoinJoinWalletBinding.current(), + binding == nil || binding == current else { + throw SwiftDashSDKTransactionSender.SendError.walletNotReady("the active wallet changed") + } + return (current, SwiftDashSDKWalletState.shared.coinJoinBalanceDuffs) + } guard amount > 0 else { throw Self.makeError( code: .coinJoinSweepUnavailable, @@ -437,15 +452,21 @@ final class WalletSendService: NSObject { Self.logger.info("💸 TXSEND :: preparing CoinJoin sweep — balance \(amount, privacy: .public) duffs (\(Double(amount) / 1e8, privacy: .public) DASH)") try await sendAuthorizer.authorizeSend(spendAmount: amount) - guard let destination = SwiftDashSDKReceiveAddressReader.receiveAddress() else { + guard let resolved = SwiftDashSDKReceiveAddressReader.receiveDestination() else { throw Self.makeError( code: .coinJoinSweepUnavailable, description: "Could not resolve a destination address for the CoinJoin sweep" ) } + // The address must be the pinned wallet's own; the sweep itself + // re-checks that wallet is still the active one. + if resolved.walletId != pinned.walletId { + throw SwiftDashSDKTransactionSender.SendError.walletNotReady("the active wallet changed") + } + let destination = resolved.address Self.logger.info("💸 TXSEND :: CoinJoin sweep destination resolved \(destination, privacy: .public)") - let outcome = try SwiftDashSDKTransactionSender.sweepCoinJoin(to: destination) + let outcome = try SwiftDashSDKTransactionSender.sweepCoinJoin(to: destination, expecting: pinned) let txids = outcome.txids guard !txids.isEmpty else { // A reported-success sweep that produced no transaction is treated diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift index 314a71b083..ba6f828594 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift @@ -125,7 +125,7 @@ enum CoinJoinMoveDestinationPolicy { /// CoinJoin account until the drain, so an interrupted attempt leaves them on /// one CoinJoin address, and the next attempt drains them directly. /// -/// Pure: the inputs come from `SwiftDashSDKTransactionSender.coinJoinUtxoState()` +/// Pure: the inputs come from `SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting:)` /// so `CoinJoinShieldPlannerTests` can pin every branch without a wallet. enum CoinJoinShieldPlanner { @@ -173,6 +173,23 @@ enum CoinJoinShieldPlanner { height > 0 || instantLockedTxids.contains(txid) } + /// Whether a CoinJoin UTXO read can be planned from. The SDK's account + /// readers return `[]` both for "none" and for a failed read, so a failure + /// is told apart here: every wallet has at least its BIP44 account, and a + /// CoinJoin account whose balance is not zero has UTXOs. A cached balance + /// that outlived its coins reads as a failure too, which stops the move + /// rather than drain on a guess. + /// + /// - Parameters: + /// - accountCount: rows `accountBalances` returned. + /// - coinJoinBalanceIsZero: nil when the wallet has no CoinJoin account. + /// - utxoCount: rows `accountUtxos` returned for it, locked ones included. + static func utxoReadIsUsable(accountCount: Int, coinJoinBalanceIsZero: Bool?, utxoCount: Int) -> Bool { + guard accountCount > 0 else { return false } + guard let coinJoinBalanceIsZero else { return true } + return utxoCount > 0 || coinJoinBalanceIsZero + } + /// Whether every consolidation transaction in `consolidationTxids` (wire /// order) has produced a final output back in the CoinJoin account. /// `utxos` is the account's current (txid, isFinal) snapshot. An empty diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index b3efd3b0d1..9f2831049a 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -106,6 +106,22 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { let coordinator = ShieldedTransferCoordinator() + /// The wallet and network the sheet was opened for (its `amountDuffs` + /// is that wallet's CoinJoin balance). Every Shielded attempt and retry + /// is pinned to it: a switch while the sheet is up stops the move. + private let binding = SwiftDashSDKTransactionSender.CoinJoinWalletBinding.current() + + /// Whether this attempt broadcast (or may have broadcast) a + /// consolidation, so the coins can sit mid-preparation when it stops. + private var consolidationSent = false + + /// The committed asset lock a retry must resume, kept here because + /// `coordinator.reset()` clears the coordinator's copy: a resume refused + /// or cancelled before it reaches the proof must not lose it. Any other + /// outcome clears it, so a lock that can't be resumed is not retried + /// forever. + private var unresumedLock: (txidWire: Data, vout: UInt32)? + private var cancellables = Set() init(amountDuffs: UInt64) { @@ -134,7 +150,10 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { guard !isInFlight else { return } stage = .movingToWallet do { - _ = try await WalletSendService.shared.sweepCoinJoin() + guard let binding else { + throw SwiftDashSDKTransactionSender.SendError.walletNotReady("no wallet when the sheet opened") + } + _ = try await WalletSendService.shared.sweepCoinJoin(expecting: binding) stage = .success(.wallet) } catch { if let message = WalletSendService.coinJoinSweepUserMessage(for: error) { @@ -155,20 +174,34 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// `prepareCoinJoinInputs`). Either way the user is asked once, up front; /// the plan is made from the UTXO set read after the prompt, so coins that /// arrive while it is open are planned for, and the drain runs - /// `preauthorized`. + /// `preauthorized`. The move is pinned to `binding`: a wallet or network + /// switch since the sheet opened stops it. func moveToShielded() async { guard !isInFlight else { return } + // A committed lock is resumed, never followed by a second drain. + if unresumedLock != nil { + preparation = nil + await retryShielded() + return + } stage = .shielding preparation = nil + consolidationSent = false // A prior failed attempt leaves the coordinator terminal; reset so // `beginTransfer()` doesn't silently bail. if coordinator.phase != .idle { coordinator.reset() } - // Read before the prompt only to choose the checklist. - let initial = Self.plan() + // Read before the prompt only to choose the checklist, and to stop + // without asking for the PIN when the move can't run anyway. + let initial = Self.plan(expecting: binding) Self.log("move to Shielded — before authorization: \(initial.description)") + guard initial.state != nil else { + Self.log("move to Shielded — CoinJoin UTXOs could not be read, or the active wallet changed; stopping") + stage = .failed(message: Self.genericFailureMessage, destination: .shielded) + return + } if initial.needsPreparation { preparation = .authorizing } @@ -190,9 +223,18 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { return } - let current = Self.plan() + let current = Self.plan(expecting: binding) Self.log("move to Shielded — after authorization: \(current.description)") - if current.needsPreparation, let state = current.state { + // An unreadable account must not fall through to the drain: the SDK + // drain enumerates the account itself and could spend more inputs + // than one asset lock may carry. + guard let state = current.state else { + Self.log("move to Shielded — CoinJoin UTXOs could not be read, or the active wallet changed; stopping") + preparation = nil + stage = .failed(message: Self.genericFailureMessage, destination: .shielded) + return + } + if current.needsPreparation { preparation = .preparingCoins if let message = await prepareCoinJoinInputs(state) { preparation = nil @@ -205,10 +247,31 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { preparation = .done } - // An empty account or an unbound host is reported by the coordinator / - // SDK preflight exactly as before. + guard !Task.isCancelled else { + Self.log("move to Shielded — cancelled before the drain") + let message = consolidationSent ? Self.preparingMessage : Self.genericFailureMessage + preparation = nil + stage = .failed(message: message, destination: .shielded) + return + } + // An empty account is reported by the coordinator / SDK preflight + // exactly as before. await DWIdentityAuthorizer.preauthorized { [self] in - await coordinator.performAssetLock(funding: .coinJoinDrain) + await coordinator.performAssetLock(funding: .coinJoinDrain, expecting: state.binding) + } + // The coordinator's own cancel check (before any lock is built) after + // a consolidation: the coins may sit mid-preparation, so say so + // instead of returning to the choice. Any other failure is reported + // as usual. + if Task.isCancelled, consolidationSent, + case .failed(let message) = coordinator.phase, + message == ShieldedTransferCoordinator.CoordinatorError.authCancelled.errorDescription { + Self.log("move to Shielded — cancelled before the drain") + coordinator.reset() + preparation = nil + SwiftDashSDKWalletState.shared.refreshCoinJoinBalance() + stage = .failed(message: Self.preparingMessage, destination: .shielded) + return } finishFromCoordinatorPhase() } @@ -230,8 +293,11 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { } } - private static func plan() -> Plan { - let state = SwiftDashSDKTransactionSender.coinJoinUtxoState() + /// - Parameter binding: nil state unless it is the active wallet and + /// network (also when it is nil: no wallet was bound). + private static func plan(expecting binding: SwiftDashSDKTransactionSender.CoinJoinWalletBinding?) -> Plan { + guard let binding else { return Plan(state: nil, step: nil) } + let state = SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: binding) return Plan( state: state, step: state.map { CoinJoinShieldPlanner.nextStep(utxoCount: $0.count, finalCount: $0.finalCount) }) @@ -246,7 +312,9 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { static let finalityTimeout: TimeInterval = 180 /// Consolidate (when over the threshold) and wait for finality. Returns nil when - /// the account is ready to drain, or the message to show otherwise. + /// the account is ready to drain, or the message to show otherwise. Every + /// step is pinned to `state.binding`, and a cancelled task never returns + /// nil, so it never reaches the drain. /// /// One consolidation per attempt: a partial one stops the attempt with a /// retryable message, and the next attempt consolidates what is left @@ -268,7 +336,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { } catch { return error.localizedDescription } - guard let address = SwiftDashSDKTransactionSender.unusedCoinJoinAddress() else { + guard let address = SwiftDashSDKTransactionSender.unusedCoinJoinAddress(for: state.binding) else { Self.log("move to Shielded — no unused CoinJoin address for the consolidation") return Self.genericFailureMessage } @@ -276,15 +344,22 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { Array(repeating: 0, count: state.count), maxPerChunk: SwiftDashSDKTransactionSender.maxInputsPerSweep ).map(\.count) - Self.log("move to Shielded — consolidating n=\(state.count) CoinJoin UTXOs into \(chunks.count) tx(s) \(chunks) to \(address)") + Self.log("move to Shielded — consolidating n=\(state.count) CoinJoin UTXOs into \(chunks.count) tx(s) \(chunks)") + guard !Task.isCancelled else { + Self.log("move to Shielded — cancelled before the consolidation") + return Self.genericFailureMessage + } do { // Off the main actor so the checklist renders first; the // sender hops back to main for the SDK calls themselves. + let binding = state.binding let outcome = try await Task.detached(priority: .userInitiated) { - try SwiftDashSDKTransactionSender.sweepCoinJoin(to: address) + try SwiftDashSDKTransactionSender.sweepCoinJoin(to: address, expecting: binding) }.value consolidationTxids = outcome.txids - Self.log("move to Shielded — consolidation broadcast \(outcome.txids.count) tx(s), \(outcome.failedChunkCount) failed: \(outcome.txids.map(Self.displayHex).joined(separator: ","))\(outcome.firstFailure.map { " first failure: \(String(describing: $0))" } ?? "")") + consolidationSent = !outcome.txids.isEmpty + // Counts only: a txid leads to the consolidation address. + Self.log("move to Shielded — consolidation broadcast \(outcome.txids.count) tx(s), \(outcome.failedChunkCount) failed\(outcome.firstFailure.map { " first failure: \(Self.summary(of: $0))" } ?? "")") // A chunk that failed may still have reached peers (an // unconfirmed broadcast), and the wallet may not show its // inputs as spent yet; a drain now could spend them a second @@ -296,13 +371,14 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance.", comment: "CoinJoin") } - } catch SwiftDashSDKTransactionSender.SendError.transactionStatusUnknown(let txid, let reason) { + } catch SwiftDashSDKTransactionSender.SendError.transactionStatusUnknown { // The broadcast may have reached peers; a retry right away could // spend the same coins again before the wallet sees it. - Self.log("move to Shielded — consolidation outcome unknown for \(txid): \(reason)") + consolidationSent = true + Self.log("move to Shielded — consolidation outcome unknown") return Self.preparingMessage } catch { - Self.log("move to Shielded — consolidation failed, nothing accepted: \(String(describing: error))") + Self.log("move to Shielded — consolidation failed, nothing accepted: \(Self.summary(of: error))") return Self.genericFailureMessage } guard !consolidationTxids.isEmpty else { @@ -316,16 +392,26 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // UTXO is final: the drain builder spends final inputs only. let txids = consolidationTxids let waitStart = Date() - let waited = await SwiftDashSDKTransactionSender.waitForCoinJoinUtxoState( - timeout: Self.finalityTimeout - ) { state in - if !txids.isEmpty { - return CoinJoinShieldPlanner.consolidationSettled( - consolidationTxids: txids, utxos: state.txidFinality) + let waitedResult: (state: SwiftDashSDKTransactionSender.CoinJoinUtxoState, satisfied: Bool)? + do { + waitedResult = try await SwiftDashSDKTransactionSender.waitForCoinJoinUtxoState( + binding: state.binding, + timeout: Self.finalityTimeout + ) { state in + if !txids.isEmpty { + return CoinJoinShieldPlanner.consolidationSettled( + consolidationTxids: txids, utxos: state.txidFinality) + } + return state.finalCount == state.count } - return state.finalCount == state.count + } catch { + Self.log("move to Shielded — cancelled while waiting for finality") + return txids.isEmpty ? Self.genericFailureMessage : Self.preparingMessage + } + guard let waited = waitedResult else { + Self.log("move to Shielded — the active wallet changed, or CoinJoin UTXOs could not be read") + return txids.isEmpty ? Self.genericFailureMessage : Self.preparingMessage } - guard let waited else { return Self.genericFailureMessage } let after = waited.state let waitedSeconds = Int(Date().timeIntervalSince(waitStart).rounded()) Self.log( @@ -350,6 +436,10 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { case .nothingToMove: return Self.genericFailureMessage case .drain, .awaitFinality: + guard !Task.isCancelled else { + Self.log("move to Shielded — cancelled before the drain") + return txids.isEmpty ? Self.genericFailureMessage : Self.preparingMessage + } return nil } } @@ -369,9 +459,13 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { DWLogger.log("🛡️ COINJOIN-SHIELD :: \(message)", className: "CoinJoinMoveFundsViewModel") } - /// Display-order (explorer) hex of a wire-order txid. - private static func displayHex(_ txidWire: Data) -> String { - txidWire.reversed().map { String(format: "%02x", $0) }.joined() + /// An error's type and code for the exported log. Not its description: + /// send and builder errors quote txids, outpoints and addresses, which + /// lead to the consolidation address (the sender's os.Logger keeps the + /// detail, outside the export). + private static func summary(of error: Error) -> String { + let nsError = error as NSError + return "\(type(of: error)) \(nsError.domain) #\(nsError.code)" } /// "Try again" from a failed shielded attempt. Mirrors @@ -381,11 +475,25 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// left the CoinJoin account untouched. func retryShielded() async { guard !isInFlight else { return } - if let op = coordinator.lastAssetLockOutPoint { + if let op = coordinator.lastAssetLockOutPoint ?? unresumedLock { + unresumedLock = op + guard let binding, binding == SwiftDashSDKTransactionSender.CoinJoinWalletBinding.current() else { + Self.log("move to Shielded — resume refused, the active wallet changed") + stage = .failed(message: Self.genericFailureMessage, destination: .shielded) + return + } stage = .shielding coordinator.reset() // Resume re-authorizes on its own (fresh user action). - await coordinator.resumeAssetLock(outPointTxidWire: op.txidWire, outPointVout: op.vout) + await coordinator.resumeAssetLock( + outPointTxidWire: op.txidWire, outPointVout: op.vout, expecting: binding) + if case .failed(let message) = coordinator.phase, + message == ShieldedTransferCoordinator.CoordinatorError.authCancelled.errorDescription + || message == ShieldedTransferCoordinator.CoordinatorError.noWallet.errorDescription { + // Stopped before the proof: the lock is still there to resume. + } else { + unresumedLock = nil + } finishFromCoordinatorPhase() return } diff --git a/DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedTransferCoordinator.swift b/DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedTransferCoordinator.swift index 0fcbf5cf4a..c6c247ab55 100644 --- a/DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedTransferCoordinator.swift +++ b/DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedTransferCoordinator.swift @@ -525,7 +525,14 @@ final class ShieldedTransferCoordinator: ObservableObject { /// Funding-parameterized form of `performAssetLock(recipientAmountDuffs:)` /// — same stages, polling, and resume semantics for both funding sources /// (a stuck lock resumes by outpoint regardless of what funded it). - func performAssetLock(funding: AssetLockFundingSource, recipientRaw43 recipientOverride: Data? = nil) async { + /// - Parameter binding: When set, the transfer fails unless this is still + /// the active wallet and network (the CoinJoin move pins the wallet it + /// was authorized for). + func performAssetLock( + funding: AssetLockFundingSource, + recipientRaw43 recipientOverride: Data? = nil, + expecting binding: SwiftDashSDKTransactionSender.CoinJoinWalletBinding? = nil + ) async { guard beginTransfer() else { return } lastAssetLockOutPoint = nil Self.logger.info("🛡️ SHIELD-TX :: asset-lock route funding=\(String(describing: funding), privacy: .public) external=\(recipientOverride != nil)") @@ -569,6 +576,22 @@ final class ShieldedTransferCoordinator: ObservableObject { return } + // After the prompt, so a switch while it was open is caught too; the + // sync gate below then reads the pinned wallet's state. + guard isStillBound(binding, env: env) else { + Self.logger.error("🛡️ SHIELD-TX :: asset lock refused — the active wallet changed") + handleFailure(CoordinatorError.noWallet) + return + } + + // A cancelled task stops here, before anything is built or broadcast. + // Reported as a cancel: the caller went away, nothing failed. + if Task.isCancelled { + Self.logger.error("🛡️ SHIELD-TX :: asset lock refused — task cancelled") + handleFailure(CoordinatorError.authCancelled) + return + } + // Re-check at the execution boundary, not only where the surface was // offered. The drain is whole-account and its value is computed // SDK-side, so a scan that restarted while the sheet or the PIN prompt @@ -643,7 +666,13 @@ final class ShieldedTransferCoordinator: ObservableObject { /// /// Used by both confirm sheets' "Try again" (in-session) and the /// home-screen recovery sheet (after relaunch). - func resumeAssetLock(outPointTxidWire: Data, outPointVout: UInt32, recipientRaw43 recipientOverride: Data? = nil) async { + /// - Parameter binding: as for `performAssetLock(funding:recipientRaw43:expecting:)`. + func resumeAssetLock( + outPointTxidWire: Data, + outPointVout: UInt32, + recipientRaw43 recipientOverride: Data? = nil, + expecting binding: SwiftDashSDKTransactionSender.CoinJoinWalletBinding? = nil + ) async { guard beginTransfer() else { return } Self.logger.info("🛡️ SHIELD-TX :: resume asset-lock vout=\(outPointVout) external=\(recipientOverride != nil)") @@ -662,6 +691,12 @@ final class ShieldedTransferCoordinator: ObservableObject { return } + guard isStillBound(binding, env: env) else { + Self.logger.error("🛡️ SHIELD-TX :: resume refused — the active wallet changed") + handleFailure(CoordinatorError.noWallet) + return + } + // The lock is already broadcast/locked — only the Orchard proof + the // shield ST remain, so jump straight to .proving (no .locking stage and // no asset-lock polling: there's no new lock to track). @@ -1427,6 +1462,16 @@ final class ShieldedTransferCoordinator: ObservableObject { shieldedRecipient: recipient) } + /// Whether a pinned transfer may still run: `binding` (when set) is both + /// the environment resolved for it and the host's active wallet now. + private func isStillBound( + _ binding: SwiftDashSDKTransactionSender.CoinJoinWalletBinding?, env: Environment + ) -> Bool { + guard let binding else { return true } + return binding == SwiftDashSDKTransactionSender.CoinJoinWalletBinding(walletId: env.walletId, network: env.network) + && binding == SwiftDashSDKTransactionSender.CoinJoinWalletBinding.current() + } + /// Synchronous single-flight gate. Returns `false` when a transfer is /// already in progress (or finished and not yet `reset()`), so a fast /// double-tap on Confirm can't queue a second transfer. Because the diff --git a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift index 7a706768f9..208d107098 100644 --- a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift +++ b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift @@ -117,6 +117,28 @@ final class CoinJoinMoveDestinationPolicyTests: XCTestCase { /// waits for final inputs. final class CoinJoinShieldPlannerTests: XCTestCase { + // MARK: utxoReadIsUsable + + func testNoAccountsAtAllIsAFailedRead() { + XCTAssertFalse(CoinJoinShieldPlanner.utxoReadIsUsable(accountCount: 0, coinJoinBalanceIsZero: nil, utxoCount: 0)) + } + + func testWalletWithoutACoinJoinAccountReadsAsEmpty() { + XCTAssertTrue(CoinJoinShieldPlanner.utxoReadIsUsable(accountCount: 3, coinJoinBalanceIsZero: nil, utxoCount: 0)) + } + + func testNoUtxosBehindANonZeroBalanceIsAFailedRead() { + XCTAssertFalse(CoinJoinShieldPlanner.utxoReadIsUsable(accountCount: 3, coinJoinBalanceIsZero: false, utxoCount: 0)) + } + + func testEmptyAccountWithZeroBalanceIsUsable() { + XCTAssertTrue(CoinJoinShieldPlanner.utxoReadIsUsable(accountCount: 3, coinJoinBalanceIsZero: true, utxoCount: 0)) + } + + func testUtxosBehindABalanceAreUsable() { + XCTAssertTrue(CoinJoinShieldPlanner.utxoReadIsUsable(accountCount: 3, coinJoinBalanceIsZero: false, utxoCount: 104)) + } + // MARK: nextStep func testEmptyAccountHasNothingToMove() { From 250ca9b4bc7e613b6cc8f664d477337f1feb0122 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Tue, 20 Oct 2026 13:07:23 +0300 Subject: [PATCH 07/11] fix(coinjoin): don't replan over an unknown consolidation, keep the lock to resume - A consolidation chunk whose broadcast ended unknown may have reached peers. The sweep now reports every such chunk's wire-order txid (CoinJoinSweepOutcome.unknownTxids, or CoinJoinSweepUnknownError when nothing was accepted), and the move sheet does not plan again until each one's output is in the CoinJoin account. dash-spv applies a broadcast transaction to the wallet before it waits for peers, so its inputs are already spent locally; the gate makes the retry wait for that evidence instead of relying on it. The UTXO set is the evidence, not the transaction history, which drops chainlocked records. - The Dash Wallet sweep records unknown-outcome txids in CoinJoinWithdrawalStore too and re-tallies the CoinJoin balance. - A committed asset lock stays the one every retry resumes until a resume ends in success or a submitted shield: a failed resume does not prove the lock consumed. Co-Authored-By: Claude Opus 5.5 --- .../SwiftDashSDKTransactionSender.swift | 37 +++++++++++--- .../Transactions/WalletSendService.swift | 33 +++++++++---- .../CoinJoinMoveFundsViewModel.swift | 48 ++++++++++++++----- 3 files changed, 90 insertions(+), 28 deletions(-) diff --git a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift index e15cd5a949..2fa605dd97 100644 --- a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift +++ b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift @@ -223,12 +223,26 @@ final class SwiftDashSDKTransactionSender: NSObject { let failedChunkCount: Int /// The first failed chunk's error; nil when every chunk broadcast. let firstFailure: Error? + /// Wire-order txids of the chunks whose broadcast ended + /// `transactionStatusUnknown`: they may have reached peers. + let unknownTxids: [Data] /// Some chunks broadcast and some did not: coins remain in the CoinJoin /// account, and a re-run sweeps the remainder. var isPartial: Bool { !txids.isEmpty && failedChunkCount > 0 } } + /// Thrown by `sweepCoinJoin` when no chunk was accepted and at least one + /// ended `transactionStatusUnknown`; carries every such chunk's txid. + struct CoinJoinSweepUnknownError: LocalizedError { + /// Wire-order txids of the chunks whose outcome is unknown. + let unknownTxids: [Data] + /// The first unknown chunk's error. + let underlying: Error + + var errorDescription: String? { underlying.localizedDescription } + } + /// Sweep the entire CoinJoin-account balance to `address` (the user's own /// BIP44 receive address), fully emptying the CoinJoin account across one or /// more transactions. @@ -273,7 +287,7 @@ final class SwiftDashSDKTransactionSender: NSObject { // SwiftDashSDKCoinJoinBalanceReader: typeTag 1, index 0). Used only to // address the account for UTXO enumeration. guard let cjBalance = Self.coinJoinAccountBalance(in: manager.accountBalances(for: walletId)) else { - return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil) + return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil, unknownTxids: []) } // Snapshot the account's spendable UTXOs (after the recovery scan has @@ -283,7 +297,7 @@ final class SwiftDashSDKTransactionSender: NSObject { let utxos = manager.accountUtxos(for: walletId, balance: cjBalance) .filter { !$0.isLocked } guard !utxos.isEmpty else { - return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil) + return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil, unknownTxids: []) } // Drain each balanced ≤500-input chunk to `address`. `useOnlyAddedInputs` @@ -302,7 +316,9 @@ final class SwiftDashSDKTransactionSender: NSObject { // accepted it is the error reported, ahead of a rejection, so a // caller can tell it apart from "nothing moved". var firstUnknown: Error? + var unknownTxids: [Data] = [] for (index, chunk) in Self.balancedChunks(utxos, maxPerChunk: Self.maxInputsPerSweep).enumerated() { + var chunkTxid: Data? do { let builder = try CoreTransactionBuilder(network: network) try builder.addInputs( @@ -323,25 +339,32 @@ final class SwiftDashSDKTransactionSender: NSObject { accountIndex: Self.coinJoinAccountIndex) // Serialize BEFORE broadcast — broadcasting consumes the handle. let txData = try tx.serializedData() - let outcome = try core.broadcastTransactionWithOutcome(tx) - _ = try Self.requireAccepted(outcome) // Wire (internal) byte order to match `Transaction.txHashData` / // `CoinJoinWithdrawalStore`: `computeTxHash` yields display order, // so reverse it back to wire order. - txids.append(Data(Self.computeTxHash(from: txData).reversed())) + let txid = Data(Self.computeTxHash(from: txData).reversed()) + chunkTxid = txid + let outcome = try core.broadcastTransactionWithOutcome(tx) + _ = try Self.requireAccepted(outcome) + txids.append(txid) } catch { failedChunkCount += 1 firstError = firstError ?? error if case SendError.transactionStatusUnknown = error { firstUnknown = firstUnknown ?? error + if let chunkTxid { unknownTxids.append(chunkTxid) } } Self.logger.error( "💸 TXSEND :: coinjoin sweep chunk \(index + 1, privacy: .public) failed to broadcast, continuing: \(String(describing: error), privacy: .public)") } } - if txids.isEmpty, let error = firstUnknown ?? firstError { throw error } + if txids.isEmpty, let firstUnknown { + throw CoinJoinSweepUnknownError(unknownTxids: unknownTxids, underlying: firstUnknown) + } + if txids.isEmpty, let firstError { throw firstError } return CoinJoinSweepOutcome( - txids: txids, failedChunkCount: failedChunkCount, firstFailure: firstError) + txids: txids, failedChunkCount: failedChunkCount, firstFailure: firstError, + unknownTxids: unknownTxids) } let outcome: CoinJoinSweepOutcome diff --git a/DashWallet/Sources/Models/Transactions/WalletSendService.swift b/DashWallet/Sources/Models/Transactions/WalletSendService.swift index 48aa2e3a0a..401e2c4c99 100644 --- a/DashWallet/Sources/Models/Transactions/WalletSendService.swift +++ b/DashWallet/Sources/Models/Transactions/WalletSendService.swift @@ -466,7 +466,16 @@ final class WalletSendService: NSObject { let destination = resolved.address Self.logger.info("💸 TXSEND :: CoinJoin sweep destination resolved \(destination, privacy: .public)") - let outcome = try SwiftDashSDKTransactionSender.sweepCoinJoin(to: destination, expecting: pinned) + let outcome: SwiftDashSDKTransactionSender.CoinJoinSweepOutcome + do { + outcome = try SwiftDashSDKTransactionSender.sweepCoinJoin(to: destination, expecting: pinned) + } catch let error as SwiftDashSDKTransactionSender.CoinJoinSweepUnknownError { + // These may still land: tag them like accepted ones. + Self.recordSweepTxids(error.unknownTxids) + // The wallet applied them locally; re-tally so the balance shows it. + await MainActor.run { SwiftDashSDKWalletState.shared.refreshCoinJoinBalance() } + throw error + } let txids = outcome.txids guard !txids.isEmpty else { // A reported-success sweep that produced no transaction is treated @@ -482,14 +491,9 @@ final class WalletSendService: NSObject { // single "CoinJoin Withdrawals" cell. A large UTXO set is swept across // multiple transactions (chunks); the sender returns wire-order txids // (matching PersistentTransaction.txid / Transaction.txHashData), so - // record each directly. - for txid in txids { - CoinJoinWithdrawalStore.shared.record(txid: txid) - } - let recordedHexes: [String] = txids.map { (txid: Data) in - txid.reversed().map { String(format: "%02x", $0) }.joined() - } - Self.logger.info("💸 TXSEND :: recorded \(txids.count, privacy: .public) sweep txid(s) in CoinJoinWithdrawalStore: \(recordedHexes.joined(separator: ","), privacy: .public)") + // record each directly — the unknown-outcome chunks too, which may + // still land. + Self.recordSweepTxids(txids + outcome.unknownTxids) await MainActor.run { SwiftDashSDKWalletState.shared.refreshCoinJoinBalance() @@ -644,6 +648,17 @@ final class WalletSendService: NSObject { } } + /// Tag sweep txids (wire order) so the home screen groups them into the + /// single "CoinJoin Withdrawals" cell — the unknown-outcome chunks too, + /// which may still land. + private static func recordSweepTxids(_ txids: [Data]) { + for txid in txids { + CoinJoinWithdrawalStore.shared.record(txid: txid) + } + let hexes = txids.map { Data($0.reversed()).map { String(format: "%02x", $0) }.joined() } + logger.info("💸 TXSEND :: recorded \(txids.count, privacy: .public) sweep txid(s) in CoinJoinWithdrawalStore: \(hexes.joined(separator: ","), privacy: .public)") + } + /// User-facing message for a CoinJoin sweep failure, or nil if the user /// simply cancelled authentication (callers stay silent). Centralizes the /// cancel predicate + copy so every sweep entry point behaves identically. diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index 9f2831049a..7b7181a661 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -116,12 +116,20 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { private var consolidationSent = false /// The committed asset lock a retry must resume, kept here because - /// `coordinator.reset()` clears the coordinator's copy: a resume refused - /// or cancelled before it reaches the proof must not lose it. Any other - /// outcome clears it, so a lock that can't be resumed is not retried - /// forever. + /// `coordinator.reset()` clears the coordinator's copy. A failed resume + /// does not prove the lock consumed, so only `.success` or + /// `.submittedUnconfirmed` (the shield was submitted) clears it; until + /// then every retry resumes it, never a fresh drain. private var unresumedLock: (txidWire: Data, vout: UInt32)? + /// Wire-order txids of this sheet's consolidations whose broadcast outcome + /// was unknown (they may have reached peers). No new attempt plans until + /// each one's output is in the CoinJoin account — evidence the wallet + /// applied it and so shows its inputs as spent. The output stays until a + /// drain spends it, unlike the transaction record, which the SDK drops + /// once it is chainlocked. + private var unobservedConsolidationTxids: [Data] = [] + private var cancellables = Set() init(amountDuffs: UInt64) { @@ -187,6 +195,20 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { stage = .shielding preparation = nil consolidationSent = false + if !unobservedConsolidationTxids.isEmpty { + guard let state = binding.flatMap({ SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: $0) }) else { + Self.log("move to Shielded — the active wallet changed, or its CoinJoin UTXOs can't be read; stopping") + stage = .failed(message: Self.genericFailureMessage, destination: .shielded) + return + } + // Any output counts, final or not: it shows the wallet applied it. + guard Set(state.entries.map(\.txid)).isSuperset(of: unobservedConsolidationTxids) else { + Self.log("move to Shielded — an earlier consolidation is not in the wallet yet, not replanning") + stage = .failed(message: Self.preparingMessage, destination: .shielded) + return + } + unobservedConsolidationTxids = [] + } // A prior failed attempt leaves the coordinator terminal; reset so // `beginTransfer()` doesn't silently bail. if coordinator.phase != .idle { @@ -357,6 +379,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { try SwiftDashSDKTransactionSender.sweepCoinJoin(to: address, expecting: binding) }.value consolidationTxids = outcome.txids + unobservedConsolidationTxids = outcome.unknownTxids consolidationSent = !outcome.txids.isEmpty // Counts only: a txid leads to the consolidation address. Self.log("move to Shielded — consolidation broadcast \(outcome.txids.count) tx(s), \(outcome.failedChunkCount) failed\(outcome.firstFailure.map { " first failure: \(Self.summary(of: $0))" } ?? "")") @@ -371,10 +394,12 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance.", comment: "CoinJoin") } - } catch SwiftDashSDKTransactionSender.SendError.transactionStatusUnknown { - // The broadcast may have reached peers; a retry right away could - // spend the same coins again before the wallet sees it. + } catch let error as SwiftDashSDKTransactionSender.CoinJoinSweepUnknownError { + // The broadcasts may have reached peers. The wallet applies a + // transaction before waiting for them, which spends its inputs + // locally; the next attempt waits until their outputs show. consolidationSent = true + unobservedConsolidationTxids = error.unknownTxids Self.log("move to Shielded — consolidation outcome unknown") return Self.preparingMessage } catch { @@ -487,12 +512,11 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // Resume re-authorizes on its own (fresh user action). await coordinator.resumeAssetLock( outPointTxidWire: op.txidWire, outPointVout: op.vout, expecting: binding) - if case .failed(let message) = coordinator.phase, - message == ShieldedTransferCoordinator.CoordinatorError.authCancelled.errorDescription - || message == ShieldedTransferCoordinator.CoordinatorError.noWallet.errorDescription { - // Stopped before the proof: the lock is still there to resume. - } else { + switch coordinator.phase { + case .success, .submittedUnconfirmed: unresumedLock = nil + default: + break } finishFromCoordinatorPhase() return From 4c1f9b2e219aa1e10e9b3b9f3332f400611f9981 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Tue, 20 Oct 2026 17:28:18 +0300 Subject: [PATCH 08/11] fix(coinjoin): report an unknown CoinJoin sweep as broadcast-unknown, not "try again" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A sweep whose chunks all ended with no acceptance signal was rethrown as CoinJoinSweepUnknownError and shown with the generic "Please try again". One classifier (WalletSendService.coinJoinSweepFailure) now decides from the chunk counts: - every failed chunk unknown: .broadcastUnknown with its own copy ("don't move them again"); the move-funds sheet offers only Close. The wallet applies a transaction before it waits for peers, so those coins already read as spent and a re-run has nothing to sweep; - a chunk plainly failed next to an accepted or unknown one: partial, retryable — only the failed chunks' coins are left to sweep. The four sweep callers log a txid-free line (error type/code plus the classifier diagnostic or the SDK's reason) instead of the raw error. This PR's new strings also go into every locale catalog in English, as the Transifex convention requires. Co-Authored-By: Claude Opus 5.5 --- .../SwiftDashSDKTransactionSender.swift | 33 +++-- .../Transactions/WalletSendService.swift | 127 ++++++++++++++++-- .../CoinJoinMoveFundsSheet.swift | 59 +++++--- .../CoinJoinMoveFundsViewModel.swift | 23 ++-- .../Sources/UI/Home/Views/HomeViewModel.swift | 2 +- .../Menu/Settings/SettingsMenuViewModel.swift | 2 +- .../UI/Menu/Tools/ToolsMenuViewModel.swift | 2 +- DashWallet/ar.lproj/Localizable.strings | 4 + DashWallet/bg.lproj/Localizable.strings | 4 + DashWallet/ca.lproj/Localizable.strings | 4 + DashWallet/cs.lproj/Localizable.strings | 4 + DashWallet/da.lproj/Localizable.strings | 4 + DashWallet/de.lproj/Localizable.strings | 4 + DashWallet/el.lproj/Localizable.strings | 4 + DashWallet/en.lproj/Localizable.strings | 3 + DashWallet/eo.lproj/Localizable.strings | 4 + DashWallet/es.lproj/Localizable.strings | 4 + DashWallet/et.lproj/Localizable.strings | 4 + DashWallet/fa.lproj/Localizable.strings | 4 + DashWallet/fi.lproj/Localizable.strings | 4 + DashWallet/fil.lproj/Localizable.strings | 4 + DashWallet/fr.lproj/Localizable.strings | 4 + DashWallet/hr.lproj/Localizable.strings | 4 + DashWallet/hu.lproj/Localizable.strings | 4 + DashWallet/id.lproj/Localizable.strings | 4 + DashWallet/it.lproj/Localizable.strings | 4 + DashWallet/ja.lproj/Localizable.strings | 4 + DashWallet/ko.lproj/Localizable.strings | 4 + DashWallet/mk.lproj/Localizable.strings | 4 + DashWallet/ms.lproj/Localizable.strings | 4 + DashWallet/nb.lproj/Localizable.strings | 4 + DashWallet/nl.lproj/Localizable.strings | 4 + DashWallet/pl.lproj/Localizable.strings | 4 + DashWallet/pt.lproj/Localizable.strings | 4 + DashWallet/ro.lproj/Localizable.strings | 4 + DashWallet/ru.lproj/Localizable.strings | 4 + DashWallet/sk.lproj/Localizable.strings | 4 + DashWallet/sl.lproj/Localizable.strings | 4 + DashWallet/sl_SI.lproj/Localizable.strings | 4 + DashWallet/sq.lproj/Localizable.strings | 4 + DashWallet/sr.lproj/Localizable.strings | 4 + DashWallet/sv.lproj/Localizable.strings | 4 + DashWallet/th.lproj/Localizable.strings | 4 + DashWallet/tr.lproj/Localizable.strings | 4 + DashWallet/uk.lproj/Localizable.strings | 4 + DashWallet/vi.lproj/Localizable.strings | 4 + DashWallet/zh-Hans.lproj/Localizable.strings | 4 + .../zh-Hant-TW.lproj/Localizable.strings | 4 + DashWallet/zh.lproj/Localizable.strings | 4 + DashWallet/zh_TW.lproj/Localizable.strings | 4 + .../CoinJoinMoveDestinationPolicyTests.swift | 56 ++++++++ 51 files changed, 414 insertions(+), 61 deletions(-) diff --git a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift index 2fa605dd97..6065b725b0 100644 --- a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift +++ b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift @@ -219,16 +219,19 @@ final class SwiftDashSDKTransactionSender: NSObject { /// ready to record in `CoinJoinWithdrawalStore` (matches /// `Transaction.txHashData`). let txids: [Data] - /// How many chunks did not broadcast. + /// How many chunks were not accepted, including the unknown ones. let failedChunkCount: Int - /// The first failed chunk's error; nil when every chunk broadcast. + /// The first failed chunk's error, preferring one that was not unknown + /// (it says why coins are left); nil when every chunk broadcast. let firstFailure: Error? /// Wire-order txids of the chunks whose broadcast ended /// `transactionStatusUnknown`: they may have reached peers. let unknownTxids: [Data] - /// Some chunks broadcast and some did not: coins remain in the CoinJoin - /// account, and a re-run sweeps the remainder. + /// Some chunks broadcast and some did not. A rejected chunk's coins + /// remain in the CoinJoin account; an unknown chunk's were applied to + /// the wallet before the broadcast waited for peers (see + /// `WalletSendService.coinJoinSweepFailure`). var isPartial: Bool { !txids.isEmpty && failedChunkCount > 0 } } @@ -239,6 +242,10 @@ final class SwiftDashSDKTransactionSender: NSObject { let unknownTxids: [Data] /// The first unknown chunk's error. let underlying: Error + /// Every chunk that was not accepted, unknown or not. + let failedChunkCount: Int + /// The first failed chunk's error that was not unknown, if any. + let otherFailure: Error? var errorDescription: String? { underlying.localizedDescription } } @@ -307,11 +314,12 @@ final class SwiftDashSDKTransactionSender: NSObject { // no change (the addOutput amount is ignored); `finalizeAtomic` resolves // dual-chain `/0/`+`/1/` signing. // Partial-failure tolerant: keep the txs that broadcast, log the rest, and - // throw only if nothing broadcast at all (a re-run sweeps the remainder). - // A mixed outcome is reported through `CoinJoinSweepOutcome`, not swallowed. + // throw only if none was accepted (`CoinJoinSweepUnknownError` when one + // may still land). A mixed outcome is reported through + // `CoinJoinSweepOutcome`, not swallowed. var txids: [Data] = [] var failedChunkCount = 0 - var firstError: Error? + var firstOther: Error? // An unconfirmed broadcast may have reached peers: when nothing was // accepted it is the error reported, ahead of a rejection, so a // caller can tell it apart from "nothing moved". @@ -349,21 +357,24 @@ final class SwiftDashSDKTransactionSender: NSObject { txids.append(txid) } catch { failedChunkCount += 1 - firstError = firstError ?? error if case SendError.transactionStatusUnknown = error { firstUnknown = firstUnknown ?? error if let chunkTxid { unknownTxids.append(chunkTxid) } + } else { + firstOther = firstOther ?? error } Self.logger.error( "💸 TXSEND :: coinjoin sweep chunk \(index + 1, privacy: .public) failed to broadcast, continuing: \(String(describing: error), privacy: .public)") } } if txids.isEmpty, let firstUnknown { - throw CoinJoinSweepUnknownError(unknownTxids: unknownTxids, underlying: firstUnknown) + throw CoinJoinSweepUnknownError( + unknownTxids: unknownTxids, underlying: firstUnknown, + failedChunkCount: failedChunkCount, otherFailure: firstOther) } - if txids.isEmpty, let firstError { throw firstError } + if txids.isEmpty, let firstOther { throw firstOther } return CoinJoinSweepOutcome( - txids: txids, failedChunkCount: failedChunkCount, firstFailure: firstError, + txids: txids, failedChunkCount: failedChunkCount, firstFailure: firstOther ?? firstUnknown, unknownTxids: unknownTxids) } diff --git a/DashWallet/Sources/Models/Transactions/WalletSendService.swift b/DashWallet/Sources/Models/Transactions/WalletSendService.swift index 401e2c4c99..751650d6a3 100644 --- a/DashWallet/Sources/Models/Transactions/WalletSendService.swift +++ b/DashWallet/Sources/Models/Transactions/WalletSendService.swift @@ -419,8 +419,10 @@ final class WalletSendService: NSObject { /// A heavy mixer's account is swept across several independent chunk /// transactions, so the sweep can end up partly done. In that case the /// accepted chunks are recorded and the balance re-tallied exactly as on a - /// full sweep, and only then does this throw `.coinJoinSweepPartial` — the - /// caller must not show "moved" over coins that are still in the account. + /// full sweep, and only then does this throw the error + /// `coinJoinSweepFailure` picks (`.coinJoinSweepPartial` or + /// `.broadcastUnknown`) — the caller must not show "moved" over coins that + /// are still in the account or not yet confirmed. /// /// - Returns: the CoinJoin balance (duffs) that was swept, for the success /// message; the on-chain amount delivered is this minus the network fee. @@ -474,7 +476,12 @@ final class WalletSendService: NSObject { Self.recordSweepTxids(error.unknownTxids) // The wallet applied them locally; re-tally so the balance shows it. await MainActor.run { SwiftDashSDKWalletState.shared.refreshCoinJoinBalance() } - throw error + let counts = "\(error.failedChunkCount) failed (\(error.unknownTxids.count) unknown)" + Self.logger.error("💸 TXSEND :: CoinJoin sweep incomplete — nothing accepted, \(counts, privacy: .public)") + throw Self.coinJoinSweepFailure( + acceptedCount: 0, failedChunkCount: error.failedChunkCount, + unknownChunkCount: error.unknownTxids.count, + reason: Self.sweepChunkFailureReason(error.otherFailure ?? error.underlying)) ?? error } let txids = outcome.txids guard !txids.isEmpty else { @@ -509,16 +516,16 @@ final class WalletSendService: NSObject { // Everything above ran for the accepted chunks — the txids are in the // withdrawal store and the balance is re-tallied — so it is safe to fail - // here. Reported as a failure because the coins the failed chunks hold - // are still in the CoinJoin account: a re-run sweeps the remainder, and - // a success screen would tell the user there is nothing left to move. - if outcome.isPartial { - Self.logger.error( - "💸 TXSEND :: CoinJoin sweep partial — \(txids.count, privacy: .public) chunk(s) broadcast, \(outcome.failedChunkCount, privacy: .public) failed: \(String(describing: outcome.firstFailure), privacy: .public)") - throw Self.makeError( - code: .coinJoinSweepPartial, - description: "CoinJoin sweep moved \(txids.count) of \(txids.count + outcome.failedChunkCount) transactions" - ) + // here. Reported as a failure because a success screen would say every + // coin moved: a rejected chunk's coins are still in the account, and an + // unknown chunk's are not confirmed yet. + if let failure = Self.coinJoinSweepFailure( + acceptedCount: txids.count, failedChunkCount: outcome.failedChunkCount, + unknownChunkCount: outcome.unknownTxids.count, + reason: outcome.firstFailure.map(Self.sweepChunkFailureReason)) { + let diagnostic = failure.userInfo[Self.diagnosticKey] as? String ?? "-" + Self.logger.error("💸 TXSEND :: CoinJoin sweep incomplete (code \(failure.code, privacy: .public)) — \(diagnostic, privacy: .public)") + throw failure } return amount } @@ -659,16 +666,100 @@ final class WalletSendService: NSObject { logger.info("💸 TXSEND :: recorded \(txids.count, privacy: .public) sweep txid(s) in CoinJoinWithdrawalStore: \(hexes.joined(separator: ","), privacy: .public)") } + /// An error's type and code for the exported log. Not its description: + /// send and builder errors quote txids, outpoints and addresses, which + /// lead to the wallet's own addresses (the sender's os.Logger keeps the + /// detail, outside the export). + static func logSummary(of error: Error) -> String { + let nsError = error as NSError + return "\(type(of: error)) \(nsError.domain) #\(nsError.code)" + } + + /// A failed sweep for the exported log: `logSummary(of:)` plus what it + /// says without a txid — the diagnostic `coinJoinSweepFailure` attached, + /// a send error's reason, or this service's own description. + static func coinJoinSweepLogLine(for error: Error) -> String { + let nsError = error as NSError + let detail: String? + if let diagnostic = nsError.userInfo[diagnosticKey] as? String { + detail = diagnostic + } else if error is SwiftDashSDKTransactionSender.SendError { + detail = sweepChunkFailureReason(error) + } else if nsError.domain == errorDomain { + detail = nsError.localizedDescription + } else { + detail = nil + } + return logSummary(of: error) + (detail.map { " (\($0))" } ?? "") + } + + /// A chunk's broadcast error for the diagnostic: the SDK's reason for a + /// rejected or unknown outcome, without the txid it also carries, or for + /// a wallet that is not ready; anything else (a builder error may quote + /// an outpoint) as `logSummary(of:)`. + static func sweepChunkFailureReason(_ error: Error) -> String { + switch error { + case SwiftDashSDKTransactionSender.SendError.transactionStatusUnknown(_, let reason): + return "unknown: \(reason)" + case SwiftDashSDKTransactionSender.SendError.transactionRejected(_, let reason): + return "rejected: \(reason)" + case SwiftDashSDKTransactionSender.SendError.walletNotReady(let reason): + return "wallet not ready: \(reason)" + default: + return logSummary(of: error) + } + } + + /// The error a sweep with failed chunks surfaces; nil when none failed, + /// or when none was accepted or unknown (the sender throws that case's + /// chunk error itself and never gets here). + /// + /// - Every failed chunk ended unknown: `.broadcastUnknown`, not offered + /// again. The wallet applies a transaction before it waits for peers, so + /// those coins already read as spent and a re-run has nothing to sweep. + /// - Otherwise, when a chunk was accepted or may still land: partial. The + /// other failed chunks' coins are still in the CoinJoin account, and a + /// re-run sweeps only them. An unknown chunk counts as moved here, as + /// the re-tallied balance and the withdrawal history already show it. + /// + /// The diagnostic carries the chunk counts and `reason` (one failed + /// chunk's error). + static func coinJoinSweepFailure( + acceptedCount: Int, failedChunkCount: Int, unknownChunkCount: Int, reason: String? = nil + ) -> NSError? { + guard failedChunkCount > 0 else { return nil } + let diagnostic = "CoinJoin sweep: \(acceptedCount) accepted, \(unknownChunkCount) unknown, " + + "\(failedChunkCount - unknownChunkCount) failed otherwise" + (reason.map { "; \($0)" } ?? "") + if unknownChunkCount == failedChunkCount { + return makeError( + code: .broadcastUnknown, + description: BroadcastOutcomeCopy.coinJoinSweepUnknown, + diagnostic: diagnostic) + } + guard acceptedCount > 0 || unknownChunkCount > 0 else { return nil } + return makeError(code: .coinJoinSweepPartial, description: "CoinJoin sweep incomplete", diagnostic: diagnostic) + } + + /// Whether a failed CoinJoin sweep may be offered again right away: not + /// when its transactions may all still land. + static func isCoinJoinSweepRetryable(_ error: Error) -> Bool { + !isBroadcastUnknownError(error as NSError) + } + /// User-facing message for a CoinJoin sweep failure, or nil if the user /// simply cancelled authentication (callers stay silent). Centralizes the /// cancel predicate + copy so every sweep entry point behaves identically. /// /// A partial sweep gets its own copy: "try again" is still the right /// action, but telling the user nothing moved would contradict the - /// transactions already in their history. + /// transactions already in their history. An unknown outcome keeps its + /// own "don't send it again" copy. static func coinJoinSweepUserMessage(for error: Error) -> String? { let nsError = error as NSError guard !isAuthenticationCancelledError(nsError) else { return nil } + if isBroadcastUnknownError(nsError) { + return nsError.localizedDescription + } if nsError.domain == errorDomain, nsError.code == ErrorCode.coinJoinSweepPartial.rawValue { return NSLocalizedString( "Some of your CoinJoin funds were moved. Please try again to move the rest.", @@ -908,6 +999,14 @@ private extension WalletSendService { "We couldn't confirm the transaction reached the network. Don't send it again — the wallet keeps trying while it's open, and your balance will update as soon as it goes through.", comment: "Send dispatched but no network acceptance signal arrived") } + + /// `unknown` for a CoinJoin sweep, whose chunks were not all + /// confirmed. Same "while it's open" qualifier, for the same reason. + static var coinJoinSweepUnknown: String { + NSLocalizedString( + "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through.", + comment: "CoinJoin sweep dispatched but no network acceptance signal arrived for some of it") + } } static func makeError( diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift index 5a0e6c73d2..edcfd5dbdd 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift @@ -243,7 +243,19 @@ struct CoinJoinMoveFundsSheet: View { } } - private func failedBody(message: String, destination: CoinJoinMoveFundsViewModel.Destination) -> some View { + private func retry(_ destination: CoinJoinMoveFundsViewModel.Destination) { + Task { + switch destination { + case .wallet: + await viewModel.moveToWallet() + case .shielded: + await viewModel.retryShielded() + } + } + } + + /// A nil `destination` offers no retry, only Close. + private func failedBody(message: String, destination: CoinJoinMoveFundsViewModel.Destination?) -> some View { VStack(spacing: 0) { Image(systemName: "exclamationmark.triangle.fill") .resizable() @@ -261,24 +273,25 @@ struct CoinJoinMoveFundsSheet: View { Spacer(minLength: 12) - ButtonsGroup( - orientation: .horizontal, - size: .large, - positiveButtonText: NSLocalizedString("Try again", comment: ""), - positiveButtonAction: { - Task { - switch destination { - case .wallet: - await viewModel.moveToWallet() - case .shielded: - await viewModel.retryShielded() - } - } - }, - negativeButtonText: NSLocalizedString("Close", comment: ""), - negativeButtonAction: onDismiss) - .padding(.horizontal, 16) - .padding(.bottom, 16) + if let destination { + ButtonsGroup( + orientation: .horizontal, + size: .large, + positiveButtonText: NSLocalizedString("Try again", comment: ""), + positiveButtonAction: { retry(destination) }, + negativeButtonText: NSLocalizedString("Close", comment: ""), + negativeButtonAction: onDismiss) + .padding(.horizontal, 16) + .padding(.bottom, 16) + } else { + DashButton( + text: NSLocalizedString("Close", comment: ""), + style: .filled, + stretch: true, + action: onDismiss) + .padding(.horizontal, 16) + .padding(.bottom, 16) + } } } } @@ -323,6 +336,14 @@ extension CoinJoinMoveFundsSheet { previewViewModel: .preview(amountDuffs: 99_000_000, stage: .submittedUnconfirmed)) } +#Preview("Failed — wallet, no retry") { + CoinJoinMoveFundsSheet( + previewViewModel: .preview( + amountDuffs: 99_000_000, + stage: .failed(message: "We couldn't confirm all of your CoinJoin funds reached the network.", + destination: nil))) +} + #Preview("Failed — shielded") { CoinJoinMoveFundsSheet( previewViewModel: .preview( diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index 7b7181a661..45df2738ff 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -55,8 +55,9 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { case submittedUnconfirmed /// `destination` picks the retry path: a failed wallet sweep retries /// the sweep, a failed shielded flow retries (or resumes) the drain - /// asset lock. - case failed(message: String, destination: Destination) + /// asset lock. Nil offers no retry: a wallet sweep whose outcome is + /// unknown may still land. + case failed(message: String, destination: Destination?) } @Published private(set) var stage: Stage = .choice @@ -165,7 +166,9 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { stage = .success(.wallet) } catch { if let message = WalletSendService.coinJoinSweepUserMessage(for: error) { - stage = .failed(message: message, destination: .wallet) + Self.log("move to wallet — sweep failed: \(WalletSendService.coinJoinSweepLogLine(for: error))") + let retryable = WalletSendService.isCoinJoinSweepRetryable(error) + stage = .failed(message: message, destination: retryable ? .wallet : nil) } else { stage = .choice } @@ -382,7 +385,8 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { unobservedConsolidationTxids = outcome.unknownTxids consolidationSent = !outcome.txids.isEmpty // Counts only: a txid leads to the consolidation address. - Self.log("move to Shielded — consolidation broadcast \(outcome.txids.count) tx(s), \(outcome.failedChunkCount) failed\(outcome.firstFailure.map { " first failure: \(Self.summary(of: $0))" } ?? "")") + let failure = outcome.firstFailure.map { ", one: \(WalletSendService.logSummary(of: $0))" } ?? "" + Self.log("move to Shielded — consolidation broadcast \(outcome.txids.count) tx(s), \(outcome.failedChunkCount) failed\(failure)") // A chunk that failed may still have reached peers (an // unconfirmed broadcast), and the wallet may not show its // inputs as spent yet; a drain now could spend them a second @@ -403,7 +407,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { Self.log("move to Shielded — consolidation outcome unknown") return Self.preparingMessage } catch { - Self.log("move to Shielded — consolidation failed, nothing accepted: \(Self.summary(of: error))") + Self.log("move to Shielded — consolidation failed, nothing accepted: \(WalletSendService.logSummary(of: error))") return Self.genericFailureMessage } guard !consolidationTxids.isEmpty else { @@ -484,15 +488,6 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { DWLogger.log("🛡️ COINJOIN-SHIELD :: \(message)", className: "CoinJoinMoveFundsViewModel") } - /// An error's type and code for the exported log. Not its description: - /// send and builder errors quote txids, outpoints and addresses, which - /// lead to the consolidation address (the sender's os.Logger keeps the - /// detail, outside the export). - private static func summary(of error: Error) -> String { - let nsError = error as NSError - return "\(type(of: error)) \(nsError.domain) #\(nsError.code)" - } - /// "Try again" from a failed shielded attempt. Mirrors /// `InternalTransferConfirmSheet.tryAgain`: a committed asset lock is /// RESUMED on its exact outpoint (building a second lock would strand the diff --git a/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift b/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift index 75d52e1b4e..120a364341 100644 --- a/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift @@ -1394,7 +1394,7 @@ extension HomeViewModel { _ = try await WalletSendService.shared.sweepCoinJoin() return nil } catch { - DWLogger.log("HomeViewModel: sweep (home popup) failed: \(error)") + DWLogger.log("HomeViewModel: sweep (home popup) failed: \(WalletSendService.coinJoinSweepLogLine(for: error))") // nil when the user cancelled auth; a message on real failures. return WalletSendService.coinJoinSweepUserMessage(for: error) } diff --git a/DashWallet/Sources/UI/Menu/Settings/SettingsMenuViewModel.swift b/DashWallet/Sources/UI/Menu/Settings/SettingsMenuViewModel.swift index eaf24e9df6..aded2106db 100644 --- a/DashWallet/Sources/UI/Menu/Settings/SettingsMenuViewModel.swift +++ b/DashWallet/Sources/UI/Menu/Settings/SettingsMenuViewModel.swift @@ -344,7 +344,7 @@ class SettingsMenuViewModel: ObservableObject { do { _ = try await WalletSendService.shared.sweepCoinJoin() } catch { - DWLogger.log("SettingsMenuViewModel: sweep failed: \(error)") + DWLogger.log("SettingsMenuViewModel: sweep failed: \(WalletSendService.coinJoinSweepLogLine(for: error))") // Auth-cancel is an expected no-op (nil message); a real failure // surfaces an alert. The row stays visible so the user can retry. coinJoinSweepErrorMessage = WalletSendService.coinJoinSweepUserMessage(for: error) diff --git a/DashWallet/Sources/UI/Menu/Tools/ToolsMenuViewModel.swift b/DashWallet/Sources/UI/Menu/Tools/ToolsMenuViewModel.swift index 6e4d88ed89..409c0ddb02 100644 --- a/DashWallet/Sources/UI/Menu/Tools/ToolsMenuViewModel.swift +++ b/DashWallet/Sources/UI/Menu/Tools/ToolsMenuViewModel.swift @@ -215,7 +215,7 @@ class ToolsMenuViewModel: ObservableObject { do { _ = try await WalletSendService.shared.sweepCoinJoin() } catch { - DWLogger.log("ToolsMenuViewModel: sweep failed: \(error)") + DWLogger.log("ToolsMenuViewModel: sweep failed: \(WalletSendService.coinJoinSweepLogLine(for: error))") // Auth-cancel is an expected no-op (nil message); a real failure // surfaces an alert. The row stays visible so the user can retry. coinJoinSweepErrorMessage = WalletSendService.coinJoinSweepUserMessage(for: error) diff --git a/DashWallet/ar.lproj/Localizable.strings b/DashWallet/ar.lproj/Localizable.strings index b82e8ed6ea..88bc886e8d 100644 --- a/DashWallet/ar.lproj/Localizable.strings +++ b/DashWallet/ar.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/bg.lproj/Localizable.strings b/DashWallet/bg.lproj/Localizable.strings index 28b83333dc..54d343b8ca 100644 --- a/DashWallet/bg.lproj/Localizable.strings +++ b/DashWallet/bg.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ca.lproj/Localizable.strings b/DashWallet/ca.lproj/Localizable.strings index c7a191ead1..b5bd96c9aa 100644 --- a/DashWallet/ca.lproj/Localizable.strings +++ b/DashWallet/ca.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/cs.lproj/Localizable.strings b/DashWallet/cs.lproj/Localizable.strings index 1d7ad54ec1..1a5f1d7d19 100644 --- a/DashWallet/cs.lproj/Localizable.strings +++ b/DashWallet/cs.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/da.lproj/Localizable.strings b/DashWallet/da.lproj/Localizable.strings index 166a40e21c..0b864b38aa 100644 --- a/DashWallet/da.lproj/Localizable.strings +++ b/DashWallet/da.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/de.lproj/Localizable.strings b/DashWallet/de.lproj/Localizable.strings index 8035533975..c4ce711ef9 100644 --- a/DashWallet/de.lproj/Localizable.strings +++ b/DashWallet/de.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/el.lproj/Localizable.strings b/DashWallet/el.lproj/Localizable.strings index 0e4446dbcf..f62bd1202b 100644 --- a/DashWallet/el.lproj/Localizable.strings +++ b/DashWallet/el.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/en.lproj/Localizable.strings b/DashWallet/en.lproj/Localizable.strings index 5409aaf5c4..3064138dff 100644 --- a/DashWallet/en.lproj/Localizable.strings +++ b/DashWallet/en.lproj/Localizable.strings @@ -2998,6 +2998,9 @@ /* Send dispatched but no network acceptance signal arrived */ "We couldn't confirm the transaction reached the network. Don't send it again — the wallet keeps trying while it's open, and your balance will update as soon as it goes through." = "We couldn't confirm the transaction reached the network. Don't send it again — the wallet keeps trying while it's open, and your balance will update as soon as it goes through."; +/* CoinJoin sweep dispatched but no network acceptance signal arrived for some of it */ +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; + /* DashPay FAQ */ "What about Unstoppable Domains and similar name services?" = "What about Unstoppable Domains and similar name services?"; diff --git a/DashWallet/eo.lproj/Localizable.strings b/DashWallet/eo.lproj/Localizable.strings index 5425406452..7a22671c90 100644 --- a/DashWallet/eo.lproj/Localizable.strings +++ b/DashWallet/eo.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/es.lproj/Localizable.strings b/DashWallet/es.lproj/Localizable.strings index cef7238945..01f3fda1a2 100644 --- a/DashWallet/es.lproj/Localizable.strings +++ b/DashWallet/es.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/et.lproj/Localizable.strings b/DashWallet/et.lproj/Localizable.strings index 3a4d6b389e..5a718ea806 100644 --- a/DashWallet/et.lproj/Localizable.strings +++ b/DashWallet/et.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/fa.lproj/Localizable.strings b/DashWallet/fa.lproj/Localizable.strings index 0782045437..5757a165cf 100644 --- a/DashWallet/fa.lproj/Localizable.strings +++ b/DashWallet/fa.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/fi.lproj/Localizable.strings b/DashWallet/fi.lproj/Localizable.strings index 4bf36c5f35..4c3952a58c 100644 --- a/DashWallet/fi.lproj/Localizable.strings +++ b/DashWallet/fi.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/fil.lproj/Localizable.strings b/DashWallet/fil.lproj/Localizable.strings index 669ab3e5d1..6ba892d58f 100644 --- a/DashWallet/fil.lproj/Localizable.strings +++ b/DashWallet/fil.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/fr.lproj/Localizable.strings b/DashWallet/fr.lproj/Localizable.strings index 2fcab6e56a..45da6976ee 100644 --- a/DashWallet/fr.lproj/Localizable.strings +++ b/DashWallet/fr.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/hr.lproj/Localizable.strings b/DashWallet/hr.lproj/Localizable.strings index 7ce1301f75..19f0da5d26 100644 --- a/DashWallet/hr.lproj/Localizable.strings +++ b/DashWallet/hr.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/hu.lproj/Localizable.strings b/DashWallet/hu.lproj/Localizable.strings index c9900a8e3c..059b0497ce 100644 --- a/DashWallet/hu.lproj/Localizable.strings +++ b/DashWallet/hu.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/id.lproj/Localizable.strings b/DashWallet/id.lproj/Localizable.strings index f68a0d53d3..ca17599ff3 100644 --- a/DashWallet/id.lproj/Localizable.strings +++ b/DashWallet/id.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/it.lproj/Localizable.strings b/DashWallet/it.lproj/Localizable.strings index a52d068c36..61719836f6 100644 --- a/DashWallet/it.lproj/Localizable.strings +++ b/DashWallet/it.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ja.lproj/Localizable.strings b/DashWallet/ja.lproj/Localizable.strings index 5e19e2a35d..92eac9e1c2 100644 --- a/DashWallet/ja.lproj/Localizable.strings +++ b/DashWallet/ja.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ko.lproj/Localizable.strings b/DashWallet/ko.lproj/Localizable.strings index 5d975233d3..84ca3a1974 100644 --- a/DashWallet/ko.lproj/Localizable.strings +++ b/DashWallet/ko.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/mk.lproj/Localizable.strings b/DashWallet/mk.lproj/Localizable.strings index 8fc7ea433b..d418af2b75 100644 --- a/DashWallet/mk.lproj/Localizable.strings +++ b/DashWallet/mk.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ms.lproj/Localizable.strings b/DashWallet/ms.lproj/Localizable.strings index faad538c93..1f0ea8a0d2 100644 --- a/DashWallet/ms.lproj/Localizable.strings +++ b/DashWallet/ms.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/nb.lproj/Localizable.strings b/DashWallet/nb.lproj/Localizable.strings index 7baa3e98b2..eb3d395bd9 100644 --- a/DashWallet/nb.lproj/Localizable.strings +++ b/DashWallet/nb.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/nl.lproj/Localizable.strings b/DashWallet/nl.lproj/Localizable.strings index 8ed13989d3..9a805545aa 100644 --- a/DashWallet/nl.lproj/Localizable.strings +++ b/DashWallet/nl.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/pl.lproj/Localizable.strings b/DashWallet/pl.lproj/Localizable.strings index 386b899599..99c252bad8 100644 --- a/DashWallet/pl.lproj/Localizable.strings +++ b/DashWallet/pl.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/pt.lproj/Localizable.strings b/DashWallet/pt.lproj/Localizable.strings index f081c80b0f..8f0b974159 100644 --- a/DashWallet/pt.lproj/Localizable.strings +++ b/DashWallet/pt.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ro.lproj/Localizable.strings b/DashWallet/ro.lproj/Localizable.strings index 445d9ddc26..9b44159cfa 100644 --- a/DashWallet/ro.lproj/Localizable.strings +++ b/DashWallet/ro.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ru.lproj/Localizable.strings b/DashWallet/ru.lproj/Localizable.strings index 4b22a4795d..5edd83c826 100644 --- a/DashWallet/ru.lproj/Localizable.strings +++ b/DashWallet/ru.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sk.lproj/Localizable.strings b/DashWallet/sk.lproj/Localizable.strings index aa8a35ef63..d319fea9aa 100644 --- a/DashWallet/sk.lproj/Localizable.strings +++ b/DashWallet/sk.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sl.lproj/Localizable.strings b/DashWallet/sl.lproj/Localizable.strings index 92f1d4dce6..1dc2deb47d 100644 --- a/DashWallet/sl.lproj/Localizable.strings +++ b/DashWallet/sl.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sl_SI.lproj/Localizable.strings b/DashWallet/sl_SI.lproj/Localizable.strings index d911c368e7..7309643b61 100644 --- a/DashWallet/sl_SI.lproj/Localizable.strings +++ b/DashWallet/sl_SI.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sq.lproj/Localizable.strings b/DashWallet/sq.lproj/Localizable.strings index a1e26c89c9..694972dc80 100644 --- a/DashWallet/sq.lproj/Localizable.strings +++ b/DashWallet/sq.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sr.lproj/Localizable.strings b/DashWallet/sr.lproj/Localizable.strings index 288cf5fd4f..87025c258a 100644 --- a/DashWallet/sr.lproj/Localizable.strings +++ b/DashWallet/sr.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sv.lproj/Localizable.strings b/DashWallet/sv.lproj/Localizable.strings index 27d1cc5fca..0af9df5d3c 100644 --- a/DashWallet/sv.lproj/Localizable.strings +++ b/DashWallet/sv.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/th.lproj/Localizable.strings b/DashWallet/th.lproj/Localizable.strings index 6a19be163e..e88d59ebe6 100644 --- a/DashWallet/th.lproj/Localizable.strings +++ b/DashWallet/th.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/tr.lproj/Localizable.strings b/DashWallet/tr.lproj/Localizable.strings index e29fdff26e..4688256697 100644 --- a/DashWallet/tr.lproj/Localizable.strings +++ b/DashWallet/tr.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/uk.lproj/Localizable.strings b/DashWallet/uk.lproj/Localizable.strings index 38a71c7964..9bb7a1db3e 100644 --- a/DashWallet/uk.lproj/Localizable.strings +++ b/DashWallet/uk.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/vi.lproj/Localizable.strings b/DashWallet/vi.lproj/Localizable.strings index 05aa3962f1..ffbd24e372 100644 --- a/DashWallet/vi.lproj/Localizable.strings +++ b/DashWallet/vi.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/zh-Hans.lproj/Localizable.strings b/DashWallet/zh-Hans.lproj/Localizable.strings index 751d23ee54..62b70ebfc0 100644 --- a/DashWallet/zh-Hans.lproj/Localizable.strings +++ b/DashWallet/zh-Hans.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/zh-Hant-TW.lproj/Localizable.strings b/DashWallet/zh-Hant-TW.lproj/Localizable.strings index 1894e4a6f0..12c4da9282 100644 --- a/DashWallet/zh-Hant-TW.lproj/Localizable.strings +++ b/DashWallet/zh-Hant-TW.lproj/Localizable.strings @@ -6541,6 +6541,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/zh.lproj/Localizable.strings b/DashWallet/zh.lproj/Localizable.strings index 5dd93f3b7d..c7b587cde6 100644 --- a/DashWallet/zh.lproj/Localizable.strings +++ b/DashWallet/zh.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/zh_TW.lproj/Localizable.strings b/DashWallet/zh_TW.lproj/Localizable.strings index 9a290aa69d..183c3efa98 100644 --- a/DashWallet/zh_TW.lproj/Localizable.strings +++ b/DashWallet/zh_TW.lproj/Localizable.strings @@ -6539,6 +6539,10 @@ "Sign in to %@ again?" = "Sign in to %@ again?"; "Sole Requester" = "Sole Requester"; "Some of your CoinJoin funds were moved. Please try again to move the rest." = "Some of your CoinJoin funds were moved. Please try again to move the rest."; +"Preparing your coins" = "Preparing your coins"; +"Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; +"We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; +"Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift index 208d107098..0c1f8f8887 100644 --- a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift +++ b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift @@ -266,3 +266,59 @@ final class CoinJoinShieldPlannerTests: XCTestCase { XCTAssertNil(VM.preparedChecklistIndex(preparation: .done, phase: .failed("x"))) } } + +/// How a CoinJoin sweep with failed chunks is reported. +final class CoinJoinSweepFailureTests: XCTestCase { + + private func failure(accepted: Int, failed: Int, unknown: Int) -> NSError? { + WalletSendService.coinJoinSweepFailure( + acceptedCount: accepted, failedChunkCount: failed, unknownChunkCount: unknown) + } + + private func isPartial(_ error: NSError?) -> Bool { + guard let error else { return false } + return WalletSendService.isCoinJoinSweepRetryable(error) + && WalletSendService.coinJoinSweepUserMessage(for: error) + == WalletSendService.coinJoinSweepUserMessage(for: failure(accepted: 1, failed: 1, unknown: 0)!) + } + + func testNoFailedChunkIsNoFailure() { + XCTAssertNil(failure(accepted: 3, failed: 0, unknown: 0)) + } + + /// Everything that failed may still land: not offered again. + func testEveryFailureUnknownIsBroadcastUnknown() throws { + for error in [failure(accepted: 0, failed: 2, unknown: 2), failure(accepted: 1, failed: 1, unknown: 1)] { + let error = try XCTUnwrap(error) + XCTAssertTrue(WalletSendService.isBroadcastUnknownError(error)) + XCTAssertFalse(WalletSendService.isCoinJoinSweepRetryable(error)) + XCTAssertEqual(WalletSendService.coinJoinSweepUserMessage(for: error), error.localizedDescription) + } + } + + /// A plainly rejected chunk left coins to sweep again. + func testRejectedNextToMovedIsPartial() throws { + XCTAssertTrue(isPartial(failure(accepted: 1, failed: 2, unknown: 1))) + XCTAssertTrue(isPartial(failure(accepted: 0, failed: 2, unknown: 1))) + XCTAssertFalse(WalletSendService.isBroadcastUnknownError(try XCTUnwrap(failure(accepted: 0, failed: 2, unknown: 1)))) + } + + /// The diagnostic keeps the SDK's reason and drops the txid. + func testDiagnosticCarriesTheReasonWithoutTheTxid() throws { + let txid = String(repeating: "ab", count: 32) + let reason = WalletSendService.sweepChunkFailureReason( + SwiftDashSDKTransactionSender.SendError.transactionStatusUnknown(txid: txid, reason: "no peer echo")) + XCTAssertEqual(reason, "unknown: no peer echo") + let error = try XCTUnwrap(WalletSendService.coinJoinSweepFailure( + acceptedCount: 0, failedChunkCount: 1, unknownChunkCount: 1, reason: reason)) + let diagnostic = try XCTUnwrap(error.userInfo[WalletSendService.diagnosticKey] as? String) + XCTAssertTrue(diagnostic.contains("unknown: no peer echo")) + XCTAssertFalse(diagnostic.contains(txid)) + XCTAssertFalse(error.localizedDescription.contains("no peer echo")) + } + + /// Nothing left the wallet: the chunk's own error is reported. + func testNothingMovedIsLeftToTheCaller() { + XCTAssertNil(failure(accepted: 0, failed: 2, unknown: 0)) + } +} From f0e3b27334b117a59d55ab37593c8354acdf29b9 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Tue, 20 Oct 2026 19:53:28 +0300 Subject: [PATCH 09/11] fix(coinjoin): consolidate only final CoinJoin UTXOs before the Shielded drain The consolidation swept every unlocked CoinJoin UTXO, including unconfirmed ones without an InstantSend lock. One that never confirms (a conflicted or double-spent payment) would leave every coin swept with it behind a transaction that cannot confirm, already spent in the wallet. - The sweep takes an optional outpoint set and spends only those rows; the Shielded consolidation passes the final outpoints of the snapshot it planned from (and never sweeps fewer than two). - CoinJoinShieldPlanner consolidates while fewer than 50 UTXOs are pending (one round per attempt), and reports `.blockedByPending` otherwise: the sheet waits once for them, then stops with "Not all of your mixed coins are confirmed yet". - After a consolidation the wait also gives pending coins their finality window, lets the sync monitor settle, and plans the drain from a fresh read. - The waits share one helper; the sync/online checks share one refusal path. - New string added to all locales in English (Transifex). Co-Authored-By: Claude Opus 5.5 --- .../SwiftDashSDKTransactionSender.swift | 40 ++- .../CoinJoinMoveDestinationPolicy.swift | 43 ++- .../CoinJoinMoveFundsViewModel.swift | 261 +++++++++++++----- DashWallet/ar.lproj/Localizable.strings | 2 + DashWallet/bg.lproj/Localizable.strings | 2 + DashWallet/ca.lproj/Localizable.strings | 2 + DashWallet/cs.lproj/Localizable.strings | 2 + DashWallet/da.lproj/Localizable.strings | 2 + DashWallet/de.lproj/Localizable.strings | 2 + DashWallet/el.lproj/Localizable.strings | 2 + DashWallet/en.lproj/Localizable.strings | 3 + DashWallet/eo.lproj/Localizable.strings | 2 + DashWallet/es.lproj/Localizable.strings | 2 + DashWallet/et.lproj/Localizable.strings | 2 + DashWallet/fa.lproj/Localizable.strings | 2 + DashWallet/fi.lproj/Localizable.strings | 2 + DashWallet/fil.lproj/Localizable.strings | 2 + DashWallet/fr.lproj/Localizable.strings | 2 + DashWallet/hr.lproj/Localizable.strings | 2 + DashWallet/hu.lproj/Localizable.strings | 2 + DashWallet/id.lproj/Localizable.strings | 2 + DashWallet/it.lproj/Localizable.strings | 2 + DashWallet/ja.lproj/Localizable.strings | 2 + DashWallet/ko.lproj/Localizable.strings | 2 + DashWallet/mk.lproj/Localizable.strings | 2 + DashWallet/ms.lproj/Localizable.strings | 2 + DashWallet/nb.lproj/Localizable.strings | 2 + DashWallet/nl.lproj/Localizable.strings | 2 + DashWallet/pl.lproj/Localizable.strings | 2 + DashWallet/pt.lproj/Localizable.strings | 2 + DashWallet/ro.lproj/Localizable.strings | 2 + DashWallet/ru.lproj/Localizable.strings | 2 + DashWallet/sk.lproj/Localizable.strings | 2 + DashWallet/sl.lproj/Localizable.strings | 2 + DashWallet/sl_SI.lproj/Localizable.strings | 2 + DashWallet/sq.lproj/Localizable.strings | 2 + DashWallet/sr.lproj/Localizable.strings | 2 + DashWallet/sv.lproj/Localizable.strings | 2 + DashWallet/th.lproj/Localizable.strings | 2 + DashWallet/tr.lproj/Localizable.strings | 2 + DashWallet/uk.lproj/Localizable.strings | 2 + DashWallet/vi.lproj/Localizable.strings | 2 + DashWallet/zh-Hans.lproj/Localizable.strings | 2 + .../zh-Hant-TW.lproj/Localizable.strings | 2 + DashWallet/zh.lproj/Localizable.strings | 2 + DashWallet/zh_TW.lproj/Localizable.strings | 2 + .../CoinJoinMoveDestinationPolicyTests.swift | 47 +++- 47 files changed, 392 insertions(+), 86 deletions(-) diff --git a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift index 6065b725b0..daab33c33f 100644 --- a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift +++ b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift @@ -271,10 +271,17 @@ final class SwiftDashSDKTransactionSender: NSObject { /// CoinJoin address for the Shielded consolidation). /// - binding: When set, the sweep refuses to run unless this is still the /// active wallet and network. + /// - outpoints: When set, only these UTXOs are spent (the ones still + /// unspent), and fewer than two of them are not swept: one input + /// would only pay a fee. The Shielded consolidation passes the final + /// ones it planned from: an unconfirmed input that never locks would + /// leave every coin swept with it behind a transaction that cannot + /// confirm. /// - Returns: A `CoinJoinSweepOutcome` carrying the broadcast chunks' txids /// and any chunk failure. Throws only when nothing broadcast at all. static func sweepCoinJoin( - to address: String, expecting binding: CoinJoinWalletBinding? = nil + to address: String, expecting binding: CoinJoinWalletBinding? = nil, + outpoints: Set? = nil ) throws -> CoinJoinSweepOutcome { logger.info("💸 TXSEND :: sweeping CoinJoin account → spendable balance") @@ -301,8 +308,15 @@ final class SwiftDashSDKTransactionSender: NSObject { // materialized deep `/0/` + `/1/` addresses). `isLocked` rows are // left out, matching `coinJoinUtxoState(expecting:)`: coin // selection never spends them. - let utxos = manager.accountUtxos(for: walletId, balance: cjBalance) - .filter { !$0.isLocked } + let utxos = Self.sweepInputs( + manager.accountUtxos(for: walletId, balance: cjBalance).filter { !$0.isLocked }, + restrictedTo: outpoints + ) { CoinJoinOutpoint(txid: $0.outpointTxid, vout: $0.outpointVout) } + if let outpoints, utxos.count < 2 { + Self.logger.info( + "💸 TXSEND :: coinjoin sweep — \(utxos.count, privacy: .public) of \(outpoints.count, privacy: .public) planned UTXO(s) still spendable, not sweeping") + return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil, unknownTxids: []) + } guard !utxos.isEmpty else { return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil, unknownTxids: []) } @@ -447,6 +461,21 @@ final class SwiftDashSDKTransactionSender: NSObject { } } + /// A CoinJoin UTXO's outpoint; the txid is in wire order. + struct CoinJoinOutpoint: Hashable { + let txid: Data + let vout: UInt32 + } + + /// The `rows` a sweep spends: those whose outpoint is in `outpoints`, or + /// all of them when it is nil. + static func sweepInputs( + _ rows: [Row], restrictedTo outpoints: Set?, outpoint: (Row) -> CoinJoinOutpoint + ) -> [Row] { + guard let outpoints else { return rows } + return rows.filter { outpoints.contains(outpoint($0)) } + } + /// The CoinJoin account's spendable UTXO set, as `CoinJoinShieldPlanner` /// reads it. struct CoinJoinUtxoState { @@ -459,6 +488,8 @@ final class SwiftDashSDKTransactionSender: NSObject { /// Confirmed or InstantSend-locked — what the drain builder /// accepts as an input (see `CoinJoinShieldPlanner.isFinal`). let isFinal: Bool + + var outpoint: CoinJoinOutpoint { CoinJoinOutpoint(txid: txid, vout: vout) } } let binding: CoinJoinWalletBinding @@ -468,6 +499,9 @@ final class SwiftDashSDKTransactionSender: NSObject { var finalCount: Int { entries.reduce(0) { $0 + ($1.isFinal ? 1 : 0) } } var totalDuffs: UInt64 { entries.reduce(0) { $0 + $1.valueDuffs } } var txidFinality: [(txid: Data, isFinal: Bool)] { entries.map { ($0.txid, $0.isFinal) } } + var finalOutpoints: Set { + Set(entries.lazy.filter(\.isFinal).map(\.outpoint)) + } } /// Snapshot of the CoinJoin account's spendable UTXOs with their finality. diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift index ba6f828594..7591ba9dbe 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveDestinationPolicy.swift @@ -119,11 +119,14 @@ enum CoinJoinMoveDestinationPolicy { /// gave a 23 KB transition), so a 65–100-input drain is accepted by Core and /// then stuck as an asset lock Platform cannot consume until the ChainLock /// fallback (dashpay/platform#5460) ships in the SDK. An account above -/// `consolidationThreshold` is therefore first consolidated — swept to one fresh -/// address of its own CoinJoin account in ≤500-input regular transactions — -/// and drained once those outputs are final. The coins never leave the -/// CoinJoin account until the drain, so an interrupted attempt leaves them on -/// one CoinJoin address, and the next attempt drains them directly. +/// `consolidationThreshold` is therefore first consolidated — its final UTXOs +/// swept to one fresh address of its own CoinJoin account in ≤500-input +/// regular transactions, one round per attempt — and drained once few enough +/// UTXOs are left and final; with 50 or more not final, nothing is +/// consolidated until fewer are (`Step.blockedByPending`). The +/// coins never leave the CoinJoin account until the drain, so an interrupted +/// attempt leaves them in it, on fewer UTXOs, for the next attempt to plan +/// from. /// /// Pure: the inputs come from `SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting:)` /// so `CoinJoinShieldPlannerTests` can pin every branch without a wallet. @@ -146,22 +149,45 @@ enum CoinJoinShieldPlanner { /// The account holds no spendable UTXO — there is nothing to shield. case nothingToMove /// More UTXOs than one drain may safely spend - /// (`consolidationThreshold`): consolidate first. + /// (`consolidationThreshold`): consolidate the final ones first. case consolidate /// Few enough UTXOs, but `pending` of them are not final yet. The /// drain builder spends only final inputs (confirmed or /// InstantSend-locked), so draining now would leave them behind. case awaitFinality(pending: Int) + /// More UTXOs than one drain may safely spend, and so many of them + /// (`pending`) are not final that consolidating the final ones could + /// never get the account under the threshold. + case blockedByPending(pending: Int) /// Every UTXO is final and one asset lock can spend them all. case drain + + var isBlockedByPending: Bool { + if case .blockedByPending = self { return true } + return false + } } /// The next step for an account with `utxoCount` spendable UTXOs of which /// `finalCount` are final. + /// + /// The consolidation spends final UTXOs only — an unconfirmed input that + /// never locks would leave every coin swept with it behind a transaction + /// that cannot confirm. An attempt runs one round, which turns the final + /// UTXOs into one output per ≤500 of them, and the next attempt plans + /// from those outputs, so it can take more than one round. Every round + /// leaves fewer final UTXOs, and the account gets under the threshold + /// once the pending UTXOs plus one output fit — reachable only while + /// fewer than `consolidationThreshold` are pending, so a round is planned + /// only then. The threshold counts pending + /// UTXOs as well: one that locks before the drain is built becomes one of + /// its inputs. static func nextStep(utxoCount: Int, finalCount: Int) -> Step { guard utxoCount > 0 else { return .nothingToMove } - if utxoCount > consolidationThreshold { return .consolidate } let pending = utxoCount - min(finalCount, utxoCount) + if utxoCount > consolidationThreshold { + return pending < consolidationThreshold ? .consolidate : .blockedByPending(pending: pending) + } return pending > 0 ? .awaitFinality(pending: pending) : .drain } @@ -198,6 +224,9 @@ enum CoinJoinShieldPlanner { consolidationTxids: [Data], utxos: [(txid: Data, isFinal: Bool)] ) -> Bool { + // Polled every second: skip building the set when there is nothing + // to look up. + guard !consolidationTxids.isEmpty else { return true } let finalTxids = Set(utxos.lazy.filter { $0.isFinal }.map { $0.txid }) return consolidationTxids.allSatisfy { finalTxids.contains($0) } } diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index 45df2738ff..5dba50b890 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -13,10 +13,11 @@ // pool receives `lock_value - pool_fee` — no transparent intermediate hop. // An asset lock may spend at most 100 inputs (Core / Platform), and its // shield transition with an InstantSend proof outgrows Platform's size -// limit from about 65, so an account holding more than 50 is first -// consolidated onto one fresh address of its own CoinJoin account -// (`CoinJoinShieldPlanner.consolidationThreshold`), and the drain runs -// once those outputs are final. +// limit from about 65, so an account holding more than 50 first has its +// final UTXOs consolidated onto one fresh address of its own CoinJoin +// account (`CoinJoinShieldPlanner`), one round per attempt, and the drain +// runs once few enough UTXOs are left and final. Over 50 with 50 or more +// not final yet stops the move until fewer than 50 are pending. // // Failure posture of the shielded flow: a committed asset lock is resumed on // its exact outpoint via `resumeAssetLock` (mirroring the internal transfer @@ -26,8 +27,8 @@ // CoinJoin account and the popup / Settings / Tools surfaces keep offering // the move. The consolidation never leaves the CoinJoin account either: if // the app dies, or the drain fails, after a consolidation broadcast, the -// coins sit on one CoinJoin address and the next attempt sees few enough -// UTXOs to drain them directly. +// coins sit on fewer CoinJoin UTXOs and the next attempt plans from them — +// a drain once few enough are left, another round otherwise. // import Combine @@ -180,9 +181,9 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// pool receives the drained value minus the pool fee. /// /// When the account holds more UTXOs than one drain may safely spend - /// (`CoinJoinShieldPlanner.consolidationThreshold`), they - /// are first consolidated onto one fresh CoinJoin address (see - /// `prepareCoinJoinInputs`). Either way the user is asked once, up front; + /// (`CoinJoinShieldPlanner.consolidationThreshold`), the final ones are + /// first consolidated onto one fresh CoinJoin address, which can take + /// more than one attempt (see `prepareCoinJoinInputs`). Either way the user is asked once, up front; /// the plan is made from the UTXO set read after the prompt, so coins that /// arrive while it is open are planned for, and the drain runs /// `preauthorized`. The move is pinned to `binding`: a wallet or network @@ -308,7 +309,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { var needsPreparation: Bool { switch step { - case .consolidate?, .awaitFinality?: return true + case .consolidate?, .awaitFinality?, .blockedByPending?: return true case .drain?, .nothingToMove?, nil: return false } } @@ -325,15 +326,17 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { let state = SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: binding) return Plan( state: state, - step: state.map { CoinJoinShieldPlanner.nextStep(utxoCount: $0.count, finalCount: $0.finalCount) }) + step: state.map(Self.step(for:))) } // MARK: Preparation (more than 50 mixed coins, or coins not yet final) - /// How long to wait for a consolidation's outputs (or any not-yet-final - /// CoinJoin UTXO) to become final. InstantSend normally locks within - /// seconds; past this the attempt stops with a retryable message rather - /// than hold the sheet open. + /// How long each finality wait lasts — for a consolidation's outputs, or + /// for not-yet-final CoinJoin UTXOs. InstantSend normally locks within + /// seconds; past this the attempt stops with a retryable message, or + /// drains what is final, rather than hold the sheet open. An attempt + /// waits at most twice: until the pending UTXOs no longer block a + /// consolidation, and after it. static let finalityTimeout: TimeInterval = 180 /// Consolidate (when over the threshold) and wait for finality. Returns nil when @@ -343,33 +346,47 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// /// One consolidation per attempt: a partial one stops the attempt with a /// retryable message, and the next attempt consolidates what is left - /// together with the outputs already made. + /// together with the outputs already made. The consolidation spends final + /// UTXOs only; pending ones get the finality window alongside its + /// outputs, or before it when there are too many to consolidate around. /// - /// - Parameter state: the UTXO set read after authorization. - private func prepareCoinJoinInputs(_ state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) async -> String? { - // Same execution-boundary check the coordinator makes for the drain: - // the sweep is whole-account too, and a scan that restarted while the - // prompt was open could still be discovering UTXOs. - guard SyncingActivityMonitor.shared.state == .syncDone else { - Self.log("move to Shielded — preparation refused, chain not synced") - return ShieldedTransferCoordinator.CoordinatorError.coinJoinDrainRequiresSync.errorDescription + /// - Parameter initial: the UTXO set read after authorization. + private func prepareCoinJoinInputs(_ initial: SwiftDashSDKTransactionSender.CoinJoinUtxoState) async -> String? { + var state = initial + if let refusal = await Self.preparationRefusal(for: state) { return refusal } + // Too many pending to consolidate around; they normally lock within + // seconds. + if Self.step(for: state).isBlockedByPending { + guard let waited = await Self.waitForCoinJoinUtxos(state.binding, until: { !Self.step(for: $0).isBlockedByPending }) + else { return Self.genericFailureMessage } + state = waited.state + if !Self.step(for: state).isBlockedByPending { + // The wait can outlast the checks above: let sync settle, then + // plan from, and check, a read made after it. + if let refusal = await Self.syncRefusal(waitingUpTo: Self.syncSettleTimeout) { return refusal } + guard let fresh = SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: state.binding) else { + Self.log("move to Shielded — the active wallet changed, or CoinJoin UTXOs could not be read") + return Self.genericFailureMessage + } + state = fresh + if let refusal = Self.onlineRefusal(for: state) { return refusal } + } } var consolidationTxids: [Data] = [] - if CoinJoinShieldPlanner.nextStep(utxoCount: state.count, finalCount: state.finalCount) == .consolidate { - do { - try WalletSendService.ensureOnline() - } catch { - return error.localizedDescription - } + switch Self.step(for: state) { + case .blockedByPending(let pending): + Self.log("move to Shielded — n=\(state.count) with \(pending) not final, too many to consolidate around; stopping") + return Self.unconfirmedMessage + case .consolidate: guard let address = SwiftDashSDKTransactionSender.unusedCoinJoinAddress(for: state.binding) else { Self.log("move to Shielded — no unused CoinJoin address for the consolidation") return Self.genericFailureMessage } let chunks = SwiftDashSDKTransactionSender.balancedChunks( - Array(repeating: 0, count: state.count), + Array(repeating: 0, count: state.finalCount), maxPerChunk: SwiftDashSDKTransactionSender.maxInputsPerSweep ).map(\.count) - Self.log("move to Shielded — consolidating n=\(state.count) CoinJoin UTXOs into \(chunks.count) tx(s) \(chunks)") + Self.log("move to Shielded — consolidating \(state.finalCount) final of n=\(state.count) CoinJoin UTXOs into \(chunks.count) tx(s) \(chunks)") guard !Task.isCancelled else { Self.log("move to Shielded — cancelled before the consolidation") return Self.genericFailureMessage @@ -378,8 +395,10 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // Off the main actor so the checklist renders first; the // sender hops back to main for the SDK calls themselves. let binding = state.binding + let outpoints = state.finalOutpoints let outcome = try await Task.detached(priority: .userInitiated) { - try SwiftDashSDKTransactionSender.sweepCoinJoin(to: address, expecting: binding) + try SwiftDashSDKTransactionSender.sweepCoinJoin( + to: address, expecting: binding, outpoints: outpoints) }.value consolidationTxids = outcome.txids unobservedConsolidationTxids = outcome.unknownTxids @@ -394,9 +413,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // as the wallet reads it then. if outcome.isPartial { Self.log("move to Shielded — partial consolidation, stopping before the drain") - return NSLocalizedString( - "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance.", - comment: "CoinJoin") + return Self.partialPreparationMessage } } catch let error as SwiftDashSDKTransactionSender.CoinJoinSweepUnknownError { // The broadcasts may have reached peers. The wallet applies a @@ -414,54 +431,67 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { Self.log("move to Shielded — consolidation produced no transaction") return Self.genericFailureMessage } + case .awaitFinality, .drain, .nothingToMove: + break } - // Wait until the consolidation outputs are back in the account and - // final, and — on the direct-but-not-final path — until every CoinJoin - // UTXO is final: the drain builder spends final inputs only. + // Wait until every CoinJoin UTXO is final — the drain builder spends + // final inputs only — and, after a consolidation, at least until its + // outputs are back in the account and final. let txids = consolidationTxids - let waitStart = Date() - let waitedResult: (state: SwiftDashSDKTransactionSender.CoinJoinUtxoState, satisfied: Bool)? - do { - waitedResult = try await SwiftDashSDKTransactionSender.waitForCoinJoinUtxoState( - binding: state.binding, - timeout: Self.finalityTimeout - ) { state in - if !txids.isEmpty { - return CoinJoinShieldPlanner.consolidationSettled( - consolidationTxids: txids, utxos: state.txidFinality) - } - return state.finalCount == state.count - } - } catch { - Self.log("move to Shielded — cancelled while waiting for finality") + // An output not in the account yet is not counted as pending. + let settled = { (state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) in + CoinJoinShieldPlanner.consolidationSettled(consolidationTxids: txids, utxos: state.txidFinality) + } + let isDone = { (state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) in + // Over the threshold another round is due whatever the pending + // ones do. + settled(state) + && (state.count > CoinJoinShieldPlanner.consolidationThreshold || state.finalCount == state.count) + } + guard await Self.waitForCoinJoinUtxos(state.binding, until: isDone) != nil else { return txids.isEmpty ? Self.genericFailureMessage : Self.preparingMessage } - guard let waited = waitedResult else { + // The coordinator refuses the drain off .syncDone, and the block that + // ended the wait can briefly take the monitor out of it. Plan from a + // read made after that settles. + if let refusal = await Self.syncRefusal(waitingUpTo: Self.syncSettleTimeout) { + return txids.isEmpty ? refusal : Self.preparingMessage + } + guard let after = SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: state.binding) else { Self.log("move to Shielded — the active wallet changed, or CoinJoin UTXOs could not be read") return txids.isEmpty ? Self.genericFailureMessage : Self.preparingMessage } - let after = waited.state - let waitedSeconds = Int(Date().timeIntervalSince(waitStart).rounded()) - Self.log( - "move to Shielded — finality wait \(waited.satisfied ? "settled" : "timed out") after \(waitedSeconds)s " - + "(cap \(Int(Self.finalityTimeout))s): n=\(after.count) final=\(after.finalCount)") + let satisfied = isDone(after) - if !waited.satisfied { - if !txids.isEmpty || after.finalCount == 0 { + if !satisfied { + if !settled(after) { // The consolidated coins are safe on their CoinJoin address; // a later attempt drains them once they are final. return Self.preparingMessage } - // Direct path, some coins still unconfirmed: drain what is final, - // exactly as before this preparation existed. The rest stays in - // the CoinJoin account for a later move. + // A settled consolidation output is final, so only the direct + // path can have none. + if after.finalCount == 0 { + return Self.unconfirmedMessage + } + // Some coins still unconfirmed: drain what is final, exactly as + // before this preparation existed. The rest stays in the CoinJoin + // account for a later move. } - switch CoinJoinShieldPlanner.nextStep(utxoCount: after.count, finalCount: after.finalCount) { - case .consolidate: - Self.log("move to Shielded — still n=\(after.count) UTXOs after consolidation") - return Self.genericFailureMessage + let afterStep = Self.step(for: after) + switch afterStep { + case .consolidate, .blockedByPending: + // Another consolidation round is due (its outputs plus the pending + // UTXOs are still over the threshold), or coins arrived during the + // wait. A consolidated attempt resumes from its outputs next time. + Self.log("move to Shielded — n=\(after.count) final=\(after.finalCount) after the wait, over the threshold; stopping") + // The next round can run at once unless pending coins block it. + if txids.isEmpty { + return afterStep.isBlockedByPending ? Self.unconfirmedMessage : Self.genericFailureMessage + } + return afterStep.isBlockedByPending ? Self.preparingMessage : Self.partialPreparationMessage case .nothingToMove: return Self.genericFailureMessage case .drain, .awaitFinality: @@ -473,12 +503,100 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { } } + /// How long a wait that just ended gives the sync monitor to settle back + /// to `.syncDone`. + static let syncSettleTimeout: TimeInterval = 30 + + /// Nil once the sync monitor reads `.syncDone` (polled for up to + /// `timeout`), else the not-synced message, or the generic one when the + /// task is cancelled. + private static func syncRefusal(waitingUpTo timeout: TimeInterval) async -> String? { + let deadline = Date().addingTimeInterval(timeout) + while SyncingActivityMonitor.shared.state != .syncDone { + if Task.isCancelled { + log("move to Shielded — cancelled while waiting for sync") + return genericFailureMessage + } + guard Date() < deadline else { + log("move to Shielded — preparation refused, chain not synced") + return ShieldedTransferCoordinator.CoordinatorError.coinJoinDrainRequiresSync.errorDescription + ?? genericFailureMessage + } + try? await Task.sleep(nanoseconds: 1_000_000_000) + } + return nil + } + + nonisolated private static func step( + for state: SwiftDashSDKTransactionSender.CoinJoinUtxoState + ) -> CoinJoinShieldPlanner.Step { + CoinJoinShieldPlanner.nextStep(utxoCount: state.count, finalCount: state.finalCount) + } + + /// Why the preparation can't run now, or nil. The sync check is the one + /// the coordinator makes for the drain: a scan that restarted while the + /// prompt was open could still be discovering UTXOs, so the plan could + /// miss some. A consolidation also needs the network. + private static func preparationRefusal(for state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) async -> String? { + if let refusal = await syncRefusal(waitingUpTo: 0) { return refusal } + return onlineRefusal(for: state) + } + + private static func onlineRefusal(for state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) -> String? { + guard state.count > CoinJoinShieldPlanner.consolidationThreshold else { return nil } + do { + try WalletSendService.ensureOnline() + return nil + } catch { + return error.localizedDescription + } + } + + /// Polls the CoinJoin UTXO set until `isDone` holds or `finalityTimeout` + /// passes, and logs how it ended. Nil when cancelled, or when the active + /// wallet changed or its UTXOs could not be read. + private static func waitForCoinJoinUtxos( + _ binding: SwiftDashSDKTransactionSender.CoinJoinWalletBinding, + until isDone: @escaping (SwiftDashSDKTransactionSender.CoinJoinUtxoState) -> Bool + ) async -> (state: SwiftDashSDKTransactionSender.CoinJoinUtxoState, satisfied: Bool)? { + let waitStart = Date() + let result: (state: SwiftDashSDKTransactionSender.CoinJoinUtxoState, satisfied: Bool)? + do { + result = try await SwiftDashSDKTransactionSender.waitForCoinJoinUtxoState( + binding: binding, timeout: finalityTimeout, until: isDone) + } catch { + log("move to Shielded — cancelled while waiting for finality") + return nil + } + guard let result else { + Self.log("move to Shielded — the active wallet changed, or CoinJoin UTXOs could not be read") + return nil + } + let waitedSeconds = Int(Date().timeIntervalSince(waitStart).rounded()) + Self.log( + "move to Shielded — finality wait \(result.satisfied ? "settled" : "timed out") after \(waitedSeconds)s " + + "(cap \(Int(Self.finalityTimeout))s): n=\(result.state.count) final=\(result.state.finalCount)") + return result + } + + private static var partialPreparationMessage: String { + NSLocalizedString( + "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance.", + comment: "CoinJoin") + } + private static var preparingMessage: String { NSLocalizedString( "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes.", comment: "CoinJoin") } + private static var unconfirmedMessage: String { + NSLocalizedString( + "Not all of your mixed coins are confirmed yet. Please try again in a few minutes.", + comment: "CoinJoin") + } + private static var genericFailureMessage: String { NSLocalizedString("Couldn't move your CoinJoin funds. Please try again.", comment: "CoinJoin") } @@ -516,9 +634,8 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { finishFromCoordinatorPhase() return } - // No committed lock to resume: plan afresh. A consolidation that - // already landed shows up as a few UTXOs on one CoinJoin address, so - // this drains them directly (waiting for finality first if needed). + // No committed lock to resume: plan afresh from the UTXO set as it is + // now, a consolidation that already landed included. coordinator.reset() await moveToShielded() } diff --git a/DashWallet/ar.lproj/Localizable.strings b/DashWallet/ar.lproj/Localizable.strings index 88bc886e8d..7df34a2221 100644 --- a/DashWallet/ar.lproj/Localizable.strings +++ b/DashWallet/ar.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "لا توجد أسماء مستخدمين على هذه الهوية بعد. ابحث عن اسم لشرائه أو تسجيله في تبويب «البحث عن الأسماء»."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "الأموال غير كافية في هذا الرصيد: المطلوب %@ DASH، والمتاح %@ DASH."; diff --git a/DashWallet/bg.lproj/Localizable.strings b/DashWallet/bg.lproj/Localizable.strings index 54d343b8ca..820237b8ba 100644 --- a/DashWallet/bg.lproj/Localizable.strings +++ b/DashWallet/bg.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Тази самоличност още няма потребителски имена. Намерете име за купуване или регистриране в раздела „Търсене на имена“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Недостатъчно средства в този баланс: нужни са %@ DASH, налични са %@ DASH."; diff --git a/DashWallet/ca.lproj/Localizable.strings b/DashWallet/ca.lproj/Localizable.strings index b5bd96c9aa..51e5e75cfb 100644 --- a/DashWallet/ca.lproj/Localizable.strings +++ b/DashWallet/ca.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Aquesta identitat encara no té noms d'usuari. Cerca'n un per comprar o registrar a la pestanya «Cerca noms»."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Fons insuficients en aquest saldo: calen %@ DASH, n'hi ha %@ DASH disponibles."; diff --git a/DashWallet/cs.lproj/Localizable.strings b/DashWallet/cs.lproj/Localizable.strings index 1a5f1d7d19..d8ba228b87 100644 --- a/DashWallet/cs.lproj/Localizable.strings +++ b/DashWallet/cs.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Na této identitě zatím nejsou žádná uživatelská jména. Najděte si nějaké ke koupi nebo registraci na kartě „Najít jména“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Na tomto zůstatku není dost prostředků: potřeba %@ DASH, dostupné %@ DASH."; diff --git a/DashWallet/da.lproj/Localizable.strings b/DashWallet/da.lproj/Localizable.strings index 0b864b38aa..30c0269e9a 100644 --- a/DashWallet/da.lproj/Localizable.strings +++ b/DashWallet/da.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Der er endnu ingen brugernavne på denne identitet. Find et at købe eller registrere under fanen “Find navne”."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Utilstrækkelige midler på denne saldo: %@ DASH kræves, %@ DASH tilgængelig."; diff --git a/DashWallet/de.lproj/Localizable.strings b/DashWallet/de.lproj/Localizable.strings index c4ce711ef9..e49458d3c8 100644 --- a/DashWallet/de.lproj/Localizable.strings +++ b/DashWallet/de.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Auf dieser Identität sind noch keine Nutzernamen vorhanden. Finde unter „Namen finden“ einen zum Kaufen oder Registrieren."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Nicht genug Mittel in diesem Guthaben: %@ DASH benötigt, %@ DASH verfügbar."; diff --git a/DashWallet/el.lproj/Localizable.strings b/DashWallet/el.lproj/Localizable.strings index f62bd1202b..dc0dcd89c4 100644 --- a/DashWallet/el.lproj/Localizable.strings +++ b/DashWallet/el.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Δεν υπάρχουν ακόμη ονόματα χρήστη σε αυτή την ταυτότητα. Βρείτε ένα για αγορά ή καταχώρηση στην καρτέλα «Εύρεση ονομάτων»."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Ανεπαρκή κεφάλαια σε αυτό το υπόλοιπο: απαιτούνται %@ DASH, διαθέσιμα %@ DASH."; diff --git a/DashWallet/en.lproj/Localizable.strings b/DashWallet/en.lproj/Localizable.strings index 3064138dff..9fe87860da 100644 --- a/DashWallet/en.lproj/Localizable.strings +++ b/DashWallet/en.lproj/Localizable.strings @@ -1026,6 +1026,9 @@ /* Username marketplace: purchases feed row — price paid, date, then seller → buyer short ids */ "Sold for %1$@ DASH · %2$@ · %3$@ → %4$@" = "Sold for %1$@ DASH · %2$@ · %3$@ → %4$@"; +/* CoinJoin */ +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Username marketplace: browse row whose name is no longer listed */ "Not for sale now" = "Not for sale now"; diff --git a/DashWallet/eo.lproj/Localizable.strings b/DashWallet/eo.lproj/Localizable.strings index 7a22671c90..36ddf618d6 100644 --- a/DashWallet/eo.lproj/Localizable.strings +++ b/DashWallet/eo.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Ĉi tiu identeco ankoraŭ havas neniujn uzantnomojn. Trovu iun por aĉeti aŭ registri en la langeto „Trovi nomojn“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Nesufiĉaj rimedoj sur ĉi tiu saldo: necesas %@ DASH, disponeblas %@ DASH."; diff --git a/DashWallet/es.lproj/Localizable.strings b/DashWallet/es.lproj/Localizable.strings index 01f3fda1a2..2e3aa37094 100644 --- a/DashWallet/es.lproj/Localizable.strings +++ b/DashWallet/es.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Aún no hay nombres de usuario en esta identidad. Encuentra uno para comprar o registrar en la pestaña «Buscar nombres»."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Fondos insuficientes en este saldo: se necesitan %@ DASH, hay %@ DASH disponibles."; diff --git a/DashWallet/et.lproj/Localizable.strings b/DashWallet/et.lproj/Localizable.strings index 5a718ea806..27e3a07f50 100644 --- a/DashWallet/et.lproj/Localizable.strings +++ b/DashWallet/et.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Sellel identiteedil pole veel kasutajanimesid. Leia vahekaardilt „Otsi nimesid“ mõni ostmiseks või registreerimiseks."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Sellel jäägil pole piisavalt vahendeid: vaja on %@ DASH, saadaval on %@ DASH."; diff --git a/DashWallet/fa.lproj/Localizable.strings b/DashWallet/fa.lproj/Localizable.strings index 5757a165cf..12f46a5a56 100644 --- a/DashWallet/fa.lproj/Localizable.strings +++ b/DashWallet/fa.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "هنوز نام کاربری‌ای روی این هویت نیست. در زبانه «یافتن نام‌ها» نامی برای خرید یا ثبت پیدا کنید."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "موجودی این حساب کافی نیست: %@ DASH لازم است، %@ DASH در دسترس است."; diff --git a/DashWallet/fi.lproj/Localizable.strings b/DashWallet/fi.lproj/Localizable.strings index 4c3952a58c..ec79b77655 100644 --- a/DashWallet/fi.lproj/Localizable.strings +++ b/DashWallet/fi.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Tällä identiteetillä ei ole vielä käyttäjänimiä. Etsi ostettava tai rekisteröitävä nimi ”Etsi nimiä” -välilehdeltä."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Tällä saldolla ei ole tarpeeksi varoja: tarvitaan %@ DASH, käytettävissä %@ DASH."; diff --git a/DashWallet/fil.lproj/Localizable.strings b/DashWallet/fil.lproj/Localizable.strings index 6ba892d58f..b7775e2d89 100644 --- a/DashWallet/fil.lproj/Localizable.strings +++ b/DashWallet/fil.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Wala pang username sa pagkakakilanlang ito. Maghanap ng bibilhin o irerehistro sa tab na “Maghanap ng Pangalan”."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Kulang ang pondo sa balanseng ito: %@ DASH ang kailangan, %@ DASH ang available."; diff --git a/DashWallet/fr.lproj/Localizable.strings b/DashWallet/fr.lproj/Localizable.strings index 45da6976ee..f1544c908e 100644 --- a/DashWallet/fr.lproj/Localizable.strings +++ b/DashWallet/fr.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Aucun nom d'utilisateur sur cette identité pour l'instant. Trouvez-en un à acheter ou à enregistrer dans l'onglet « Trouver des noms »."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Fonds insuffisants sur ce solde : %@ DASH nécessaires, %@ DASH disponibles."; diff --git a/DashWallet/hr.lproj/Localizable.strings b/DashWallet/hr.lproj/Localizable.strings index 19f0da5d26..7379673bf8 100644 --- a/DashWallet/hr.lproj/Localizable.strings +++ b/DashWallet/hr.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Na ovom identitetu još nema korisničkih imena. Pronađite neko za kupnju ili registraciju na kartici „Pronađi imena“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Nema dovoljno sredstava na ovom stanju: potrebno %@ DASH, dostupno %@ DASH."; diff --git a/DashWallet/hu.lproj/Localizable.strings b/DashWallet/hu.lproj/Localizable.strings index 059b0497ce..3aa054ad4b 100644 --- a/DashWallet/hu.lproj/Localizable.strings +++ b/DashWallet/hu.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Ezen az identitáson még nincs felhasználónév. Keress egyet vásárlásra vagy regisztrálásra a „Nevek keresése” fülön."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Nincs elég fedezet ezen az egyenlegen: %@ DASH szükséges, %@ DASH áll rendelkezésre."; diff --git a/DashWallet/id.lproj/Localizable.strings b/DashWallet/id.lproj/Localizable.strings index ca17599ff3..d3d5c6e4b8 100644 --- a/DashWallet/id.lproj/Localizable.strings +++ b/DashWallet/id.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Belum ada nama pengguna pada identitas ini. Temukan satu untuk dibeli atau didaftarkan di tab “Cari Nama”."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Dana pada saldo ini tidak cukup: dibutuhkan %@ DASH, tersedia %@ DASH."; diff --git a/DashWallet/it.lproj/Localizable.strings b/DashWallet/it.lproj/Localizable.strings index 61719836f6..32e9247295 100644 --- a/DashWallet/it.lproj/Localizable.strings +++ b/DashWallet/it.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Ancora nessun nome utente su questa identità. Trovane uno da comprare o registrare nella scheda «Trova nomi»."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Fondi insufficienti su questo saldo: servono %@ DASH, disponibili %@ DASH."; diff --git a/DashWallet/ja.lproj/Localizable.strings b/DashWallet/ja.lproj/Localizable.strings index 92eac9e1c2..6ba0e3c2ec 100644 --- a/DashWallet/ja.lproj/Localizable.strings +++ b/DashWallet/ja.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "このアイデンティティにはまだユーザー名がありません。「名前を探す」タブで購入または登録する名前を見つけてください。"; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "この残高では資金が不足しています: %@ DASH 必要、%@ DASH 利用可能。"; diff --git a/DashWallet/ko.lproj/Localizable.strings b/DashWallet/ko.lproj/Localizable.strings index 84ca3a1974..33aa0e9176 100644 --- a/DashWallet/ko.lproj/Localizable.strings +++ b/DashWallet/ko.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "이 아이덴티티에는 아직 사용자 이름이 없습니다. ‘이름 찾기’ 탭에서 구매하거나 등록할 이름을 찾아보세요."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "이 잔액으로는 자금이 부족합니다: %@ DASH 필요, %@ DASH 사용 가능."; diff --git a/DashWallet/mk.lproj/Localizable.strings b/DashWallet/mk.lproj/Localizable.strings index d418af2b75..82302c73ce 100644 --- a/DashWallet/mk.lproj/Localizable.strings +++ b/DashWallet/mk.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "На овој идентитет сè уште нема кориснички имиња. Најдете некое за купување или регистрација во картичката „Најди имиња“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Нема доволно средства на ова салдо: потребни се %@ DASH, достапни се %@ DASH."; diff --git a/DashWallet/ms.lproj/Localizable.strings b/DashWallet/ms.lproj/Localizable.strings index 1f0ea8a0d2..e243a4f4bd 100644 --- a/DashWallet/ms.lproj/Localizable.strings +++ b/DashWallet/ms.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Belum ada nama pengguna pada identiti ini. Cari satu untuk dibeli atau didaftarkan dalam tab “Cari Nama”."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Dana tidak mencukupi dalam baki ini: %@ DASH diperlukan, %@ DASH tersedia."; diff --git a/DashWallet/nb.lproj/Localizable.strings b/DashWallet/nb.lproj/Localizable.strings index eb3d395bd9..93623c385d 100644 --- a/DashWallet/nb.lproj/Localizable.strings +++ b/DashWallet/nb.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Ingen brukernavn på denne identiteten ennå. Finn ett å kjøpe eller registrere under fanen «Finn navn»."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Ikke nok midler på denne saldoen: %@ DASH kreves, %@ DASH tilgjengelig."; diff --git a/DashWallet/nl.lproj/Localizable.strings b/DashWallet/nl.lproj/Localizable.strings index 9a805545aa..2bf7da9f20 100644 --- a/DashWallet/nl.lproj/Localizable.strings +++ b/DashWallet/nl.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Nog geen gebruikersnamen op deze identiteit. Zoek er een om te kopen of te registreren op het tabblad ‘Namen zoeken’."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Onvoldoende saldo hier: %@ DASH nodig, %@ DASH beschikbaar."; diff --git a/DashWallet/pl.lproj/Localizable.strings b/DashWallet/pl.lproj/Localizable.strings index 99c252bad8..cc713da9d1 100644 --- a/DashWallet/pl.lproj/Localizable.strings +++ b/DashWallet/pl.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Ta tożsamość nie ma jeszcze żadnych nazw użytkownika. Znajdź nazwę do kupienia lub zarejestrowania w zakładce „Znajdź nazwy”."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Za mało środków na tym saldzie: potrzeba %@ DASH, dostępne %@ DASH."; diff --git a/DashWallet/pt.lproj/Localizable.strings b/DashWallet/pt.lproj/Localizable.strings index 8f0b974159..43d29fdb2c 100644 --- a/DashWallet/pt.lproj/Localizable.strings +++ b/DashWallet/pt.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Ainda não há nomes de usuário nesta identidade. Encontre um para comprar ou registrar na aba “Encontrar nomes”."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Fundos insuficientes neste saldo: são necessários %@ DASH, há %@ DASH disponíveis."; diff --git a/DashWallet/ro.lproj/Localizable.strings b/DashWallet/ro.lproj/Localizable.strings index 9b44159cfa..c03414a496 100644 --- a/DashWallet/ro.lproj/Localizable.strings +++ b/DashWallet/ro.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Această identitate nu are încă nume de utilizator. Găsește unul de cumpărat sau de înregistrat în fila „Caută nume”."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Fonduri insuficiente în acest sold: sunt necesari %@ DASH, disponibili %@ DASH."; diff --git a/DashWallet/ru.lproj/Localizable.strings b/DashWallet/ru.lproj/Localizable.strings index 5edd83c826..caeee53b83 100644 --- a/DashWallet/ru.lproj/Localizable.strings +++ b/DashWallet/ru.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "На этом идентификаторе пока нет имён пользователя. Найдите имя для покупки или регистрации на вкладке «Найти имена»."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Недостаточно средств на этом балансе: нужно %@ DASH, доступно %@ DASH."; diff --git a/DashWallet/sk.lproj/Localizable.strings b/DashWallet/sk.lproj/Localizable.strings index d319fea9aa..226a91c85e 100644 --- a/DashWallet/sk.lproj/Localizable.strings +++ b/DashWallet/sk.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Na tejto identite zatiaľ nie sú žiadne používateľské mená. Nájdite si nejaké na kúpu alebo registráciu na karte „Nájsť mená“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Na tomto zostatku nie je dosť prostriedkov: potrebných %@ DASH, dostupných %@ DASH."; diff --git a/DashWallet/sl.lproj/Localizable.strings b/DashWallet/sl.lproj/Localizable.strings index 1dc2deb47d..142ad23d84 100644 --- a/DashWallet/sl.lproj/Localizable.strings +++ b/DashWallet/sl.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Na tej identiteti še ni uporabniških imen. Poiščite ime za nakup ali registracijo na zavihku „Poišči imena“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Na tem stanju ni dovolj sredstev: potrebnih %@ DASH, na voljo %@ DASH."; diff --git a/DashWallet/sl_SI.lproj/Localizable.strings b/DashWallet/sl_SI.lproj/Localizable.strings index 7309643b61..e4fe8fa1cc 100644 --- a/DashWallet/sl_SI.lproj/Localizable.strings +++ b/DashWallet/sl_SI.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Na tej identiteti še ni uporabniških imen. Poiščite ime za nakup ali registracijo na zavihku „Poišči imena“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Na tem stanju ni dovolj sredstev: potrebnih %@ DASH, na voljo %@ DASH."; diff --git a/DashWallet/sq.lproj/Localizable.strings b/DashWallet/sq.lproj/Localizable.strings index 694972dc80..08c33239ad 100644 --- a/DashWallet/sq.lproj/Localizable.strings +++ b/DashWallet/sq.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Ky identitet ende nuk ka emra përdoruesi. Gjej një për ta blerë ose regjistruar te skeda „Gjej emra“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Fonde të pamjaftueshme në këtë balancë: duhen %@ DASH, në dispozicion %@ DASH."; diff --git a/DashWallet/sr.lproj/Localizable.strings b/DashWallet/sr.lproj/Localizable.strings index 87025c258a..5f2ff87d05 100644 --- a/DashWallet/sr.lproj/Localizable.strings +++ b/DashWallet/sr.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Na ovom identitetu još nema korisničkih imena. Pronađite neko za kupovinu ili registraciju na kartici „Pronađi imena“."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Nema dovoljno sredstava na ovom stanju: potrebno %@ DASH, dostupno %@ DASH."; diff --git a/DashWallet/sv.lproj/Localizable.strings b/DashWallet/sv.lproj/Localizable.strings index 0af9df5d3c..8dffbe836c 100644 --- a/DashWallet/sv.lproj/Localizable.strings +++ b/DashWallet/sv.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Inga användarnamn på den här identiteten ännu. Hitta ett att köpa eller registrera under fliken ”Hitta namn”."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Otillräckliga medel på det här saldot: %@ DASH krävs, %@ DASH tillgängligt."; diff --git a/DashWallet/th.lproj/Localizable.strings b/DashWallet/th.lproj/Localizable.strings index e88d59ebe6..66ed8214a2 100644 --- a/DashWallet/th.lproj/Localizable.strings +++ b/DashWallet/th.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "ตัวตนนี้ยังไม่มีชื่อผู้ใช้ หาชื่อเพื่อซื้อหรือลงทะเบียนได้ในแท็บ “ค้นหาชื่อ”"; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "ยอดคงเหลือนี้ไม่พอ: ต้องใช้ %@ DASH มีอยู่ %@ DASH"; diff --git a/DashWallet/tr.lproj/Localizable.strings b/DashWallet/tr.lproj/Localizable.strings index 4688256697..4497087eb3 100644 --- a/DashWallet/tr.lproj/Localizable.strings +++ b/DashWallet/tr.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Bu kimlikte henüz kullanıcı adı yok. “Ad Bul” sekmesinden satın alacak veya kaydedecek bir ad bulun."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Bu bakiyede yeterli tutar yok: %@ DASH gerekli, %@ DASH mevcut."; diff --git a/DashWallet/uk.lproj/Localizable.strings b/DashWallet/uk.lproj/Localizable.strings index 9bb7a1db3e..1bce949314 100644 --- a/DashWallet/uk.lproj/Localizable.strings +++ b/DashWallet/uk.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "На цьому ідентифікаторі поки немає імен користувача. Знайдіть ім'я для купівлі чи реєстрації на вкладці «Знайти імена»."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Недостатньо коштів на цьому балансі: потрібно %@ DASH, доступно %@ DASH."; diff --git a/DashWallet/vi.lproj/Localizable.strings b/DashWallet/vi.lproj/Localizable.strings index ffbd24e372..92ffd04e76 100644 --- a/DashWallet/vi.lproj/Localizable.strings +++ b/DashWallet/vi.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "Danh tính này chưa có tên người dùng nào. Hãy tìm một tên để mua hoặc đăng ký trong tab “Tìm tên”."; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "Số dư này không đủ: cần %@ DASH, hiện có %@ DASH."; diff --git a/DashWallet/zh-Hans.lproj/Localizable.strings b/DashWallet/zh-Hans.lproj/Localizable.strings index 62b70ebfc0..eea9d6e250 100644 --- a/DashWallet/zh-Hans.lproj/Localizable.strings +++ b/DashWallet/zh-Hans.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "该身份尚无用户名。请在“查找名称”标签页中找一个购买或注册。"; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "该余额资金不足:需要 %@ DASH,可用 %@ DASH。"; diff --git a/DashWallet/zh-Hant-TW.lproj/Localizable.strings b/DashWallet/zh-Hant-TW.lproj/Localizable.strings index 12c4da9282..fc4ffb9f04 100644 --- a/DashWallet/zh-Hant-TW.lproj/Localizable.strings +++ b/DashWallet/zh-Hant-TW.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "該身分尚無用戶名稱。請在「尋找名稱」分頁中找一個購買或註冊。"; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "該餘額資金不足:需要 %@ DASH,可用 %@ DASH。"; diff --git a/DashWallet/zh.lproj/Localizable.strings b/DashWallet/zh.lproj/Localizable.strings index c7b587cde6..7d247f1845 100644 --- a/DashWallet/zh.lproj/Localizable.strings +++ b/DashWallet/zh.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "该身份尚无用户名。请在“查找名称”标签页中找一个购买或注册。"; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "该余额资金不足:需要 %@ DASH,可用 %@ DASH。"; diff --git a/DashWallet/zh_TW.lproj/Localizable.strings b/DashWallet/zh_TW.lproj/Localizable.strings index 183c3efa98..a1cf1a6b20 100644 --- a/DashWallet/zh_TW.lproj/Localizable.strings +++ b/DashWallet/zh_TW.lproj/Localizable.strings @@ -2310,6 +2310,8 @@ /* Username marketplace: empty owned list */ "No usernames on this identity yet. Find one to buy or register on the Find Names tab." = "該身分尚無用戶名稱。請在「尋找名稱」分頁中找一個購買或註冊。"; +"Not all of your mixed coins are confirmed yet. Please try again in a few minutes." = "Not all of your mixed coins are confirmed yet. Please try again in a few minutes."; + /* Identity top-up sheet — insufficient funding source */ "Not enough funds in this balance: %@ DASH needed, %@ DASH available." = "該餘額資金不足:需要 %@ DASH,可用 %@ DASH。"; diff --git a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift index 0c1f8f8887..92dc9190bc 100644 --- a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift +++ b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift @@ -19,6 +19,7 @@ import XCTest @testable import dashpay +import SwiftDashSDK /// Pins the one policy that decides what all three "move mixed coins" surfaces /// offer — the post-sync popup and the durable Settings / Tools rows. The @@ -173,8 +174,45 @@ final class CoinJoinShieldPlannerTests: XCTestCase { func testOverTheCapConsolidates() { XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 101, finalCount: 101), .consolidate) XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 104, finalCount: 104), .consolidate) - // Finality does not matter above the cap — the sweep is a regular tx. - XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 2_000, finalCount: 0), .consolidate) + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 2_000, finalCount: 2_000), .consolidate) + // More than one round: 51 outputs, consolidated again next time. + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 25_100, finalCount: 25_100), .consolidate) + } + + /// The consolidation spends final UTXOs only; it runs around up to 49 + /// pending ones, which plus one output fit under the threshold. + func testOverTheThresholdConsolidatesAroundFewPendingCoins() { + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 104, finalCount: 55), .consolidate) + // The smallest round: 2 final inputs into 1 output, 49 + 1 = 50. + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 51, finalCount: 2), .consolidate) + // 600 final make 2 outputs, 49 + 2 = 51: the next attempt's round is + // the smallest one above. + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 649, finalCount: 600), .consolidate) + // A single pending coin does not block a multi-round consolidation. + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 25_001, finalCount: 25_000), .consolidate) + } + + /// The outpoint set the consolidation hands the sweep holds only final + /// rows, and the sweep's filter keeps exactly those. + func testSweepInputsKeepOnlyTheFinalOutpoints() { + typealias Sender = SwiftDashSDKTransactionSender + let final = Sender.CoinJoinUtxoState.Entry(txid: Data([0xaa]), vout: 0, valueDuffs: 1_000, isFinal: true) + let pending = Sender.CoinJoinUtxoState.Entry(txid: Data([0xaa]), vout: 1, valueDuffs: 1_000, isFinal: false) + let state = Sender.CoinJoinUtxoState( + binding: Sender.CoinJoinWalletBinding(walletId: Data([1]), network: .testnet), + entries: [final, pending]) + let late = Sender.CoinJoinOutpoint(txid: Data([0xbb]), vout: 0) + let rows = [final.outpoint, pending.outpoint, late] + + XCTAssertEqual(Sender.sweepInputs(rows, restrictedTo: state.finalOutpoints) { $0 }, [final.outpoint]) + XCTAssertEqual(Sender.sweepInputs(rows, restrictedTo: nil) { $0 }, rows) + } + + func testOverTheThresholdWithTooManyPendingCoinsIsBlocked() { + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 104, finalCount: 54), .blockedByPending(pending: 50)) + XCTAssertEqual(CoinJoinShieldPlanner.nextStep(utxoCount: 2_000, finalCount: 0), .blockedByPending(pending: 2_000)) + XCTAssertTrue(CoinJoinShieldPlanner.Step.blockedByPending(pending: 50).isBlockedByPending) + XCTAssertFalse(CoinJoinShieldPlanner.Step.awaitFinality(pending: 50).isBlockedByPending) } /// After a consolidation the output is not final until InstantSend locks @@ -245,8 +283,9 @@ final class CoinJoinShieldPlannerTests: XCTestCase { XCTAssertTrue(chunks.allSatisfy { $0.count <= 500 }) } - /// A consolidation produces one output per chunk; even very large - /// accounts land at or under the direct-drain threshold after one pass. + /// A consolidation produces one output per chunk; an all-final account of + /// 25 000 lands at the direct-drain threshold after one pass (pending + /// UTXOs count on top, see `testOverTheThresholdConsolidatesAroundFewPendingCoins`). func testOneConsolidationPassFitsUnderTheThreshold() { XCTAssertLessThanOrEqual(chunkSizes(25_000).count, CoinJoinShieldPlanner.consolidationThreshold) } From b73e0401fafd0a26073909e9860cd7fa29b381f8 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Wed, 21 Oct 2026 13:40:22 +0300 Subject: [PATCH 10/11] refactor(coinjoin): split the Shielded preparation into phase helpers prepareCoinJoinInputs had a cyclomatic complexity of 27, over SwiftLint's error threshold of 20. Split it into the pending wait, the consolidation and the finality wait, which end the attempt by throwing a typed PreparationStop carrying the message. moveToShielded, sweepCoinJoin and performAssetLock get the same treatment so the branch adds no new cyclomatic_complexity warnings, and a 213-character log line is wrapped. No behaviour change: the checks, messages, logs, state updates and cancellation exits are the same as before. Co-Authored-By: Claude Opus 5.5 --- .../SwiftDashSDKTransactionSender.swift | 54 +-- .../CoinJoinMoveFundsViewModel.swift | 345 +++++++++++------- .../ShieldedTransferCoordinator.swift | 63 ++-- 3 files changed, 276 insertions(+), 186 deletions(-) diff --git a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift index daab33c33f..e8e5535c19 100644 --- a/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift +++ b/DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKTransactionSender.swift @@ -295,28 +295,7 @@ final class SwiftDashSDKTransactionSender: NSObject { throw SendError.walletNotReady("the active wallet changed") } let core = try wallet.coreWallet() - let walletId = wallet.walletId - - // CoinJoin account-0 balance descriptor (mirrors - // SwiftDashSDKCoinJoinBalanceReader: typeTag 1, index 0). Used only to - // address the account for UTXO enumeration. - guard let cjBalance = Self.coinJoinAccountBalance(in: manager.accountBalances(for: walletId)) else { - return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil, unknownTxids: []) - } - - // Snapshot the account's spendable UTXOs (after the recovery scan has - // materialized deep `/0/` + `/1/` addresses). `isLocked` rows are - // left out, matching `coinJoinUtxoState(expecting:)`: coin - // selection never spends them. - let utxos = Self.sweepInputs( - manager.accountUtxos(for: walletId, balance: cjBalance).filter { !$0.isLocked }, - restrictedTo: outpoints - ) { CoinJoinOutpoint(txid: $0.outpointTxid, vout: $0.outpointVout) } - if let outpoints, utxos.count < 2 { - Self.logger.info( - "💸 TXSEND :: coinjoin sweep — \(utxos.count, privacy: .public) of \(outpoints.count, privacy: .public) planned UTXO(s) still spendable, not sweeping") - return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil, unknownTxids: []) - } + let utxos = Self.sweepUtxos(manager: manager, walletId: wallet.walletId, restrictedTo: outpoints) guard !utxos.isEmpty else { return CoinJoinSweepOutcome(txids: [], failedChunkCount: 0, firstFailure: nil, unknownTxids: []) } @@ -425,6 +404,33 @@ final class SwiftDashSDKTransactionSender: NSObject { }) } + /// The CoinJoin rows a sweep spends: the unlocked ones, only those in + /// `outpoints` when it is set. None when there is nothing worth sweeping: + /// no CoinJoin account, or fewer than two of the planned rows left. + @MainActor + private static func sweepUtxos( + manager: PlatformWalletManager, walletId: Data, restrictedTo outpoints: Set? + ) -> [PlatformWalletManager.AccountUtxo] { + // CoinJoin account-0 balance descriptor (mirrors + // SwiftDashSDKCoinJoinBalanceReader: typeTag 1, index 0). Used only to + // address the account for UTXO enumeration. + guard let cjBalance = coinJoinAccountBalance(in: manager.accountBalances(for: walletId)) else { return [] } + // Snapshot the account's spendable UTXOs (after the recovery scan has + // materialized deep `/0/` + `/1/` addresses). `isLocked` rows are + // left out, matching `coinJoinUtxoState(expecting:)`: coin + // selection never spends them. + let utxos = sweepInputs( + manager.accountUtxos(for: walletId, balance: cjBalance).filter { !$0.isLocked }, + restrictedTo: outpoints + ) { CoinJoinOutpoint(txid: $0.outpointTxid, vout: $0.outpointVout) } + if let outpoints, utxos.count < 2 { + logger.info( + "💸 TXSEND :: coinjoin sweep — \(utxos.count, privacy: .public) of \(outpoints.count, privacy: .public) planned UTXO(s) still spendable, not sweeping") + return [] + } + return utxos + } + /// The CoinJoin account's descriptor and UTXO rows (locked ones included), /// or nil when the read can't be told apart from a failed one (see /// `CoinJoinShieldPlanner.utxoReadIsUsable`). An account that does not @@ -566,7 +572,9 @@ final class SwiftDashSDKTransactionSender: NSObject { guard let script = ScriptAddressCodec.scriptPubKey(forAddress: candidate.address, network: network), !fundedScripts.contains(script) else { continue } - logger.info("💸 TXSEND :: coinjoin consolidation address index=\(candidate.addressIndex, privacy: .public) of \(external.addresses.count, privacy: .public) watched (gap \(external.gapLimit, privacy: .public))") + let watched = external.addresses.count, gap = external.gapLimit + logger.info( + "💸 TXSEND :: coinjoin consolidation address index=\(candidate.addressIndex, privacy: .public) of \(watched, privacy: .public) watched (gap \(gap, privacy: .public))") return candidate.address } return nil diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index 5dba50b890..d8c4f5136b 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -199,19 +199,9 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { stage = .shielding preparation = nil consolidationSent = false - if !unobservedConsolidationTxids.isEmpty { - guard let state = binding.flatMap({ SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: $0) }) else { - Self.log("move to Shielded — the active wallet changed, or its CoinJoin UTXOs can't be read; stopping") - stage = .failed(message: Self.genericFailureMessage, destination: .shielded) - return - } - // Any output counts, final or not: it shows the wallet applied it. - guard Set(state.entries.map(\.txid)).isSuperset(of: unobservedConsolidationTxids) else { - Self.log("move to Shielded — an earlier consolidation is not in the wallet yet, not replanning") - stage = .failed(message: Self.preparingMessage, destination: .shielded) - return - } - unobservedConsolidationTxids = [] + if let message = unobservedConsolidationRefusal() { + stage = .failed(message: message, destination: .shielded) + return } // A prior failed attempt leaves the coordinator terminal; reset so // `beginTransfer()` doesn't silently bail. @@ -232,22 +222,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { preparation = .authorizing } - do { - try await DWIdentityAuthorizer().authorize() - } catch DWIdentityAuthorizer.AuthError.cancelled { - Self.log("move to Shielded — authorization cancelled") - preparation = nil - stage = .choice - return - } catch { - Self.log("move to Shielded — authorization failed") - preparation = nil - stage = .failed( - message: ShieldedTransferCoordinator.CoordinatorError.authFailed.errorDescription - ?? Self.genericFailureMessage, - destination: .shielded) - return - } + guard await authorizeShieldedMove() else { return } let current = Self.plan(expecting: binding) Self.log("move to Shielded — after authorization: \(current.description)") @@ -260,19 +235,33 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { stage = .failed(message: Self.genericFailureMessage, destination: .shielded) return } - if current.needsPreparation { + guard await prepareForDrain(needed: current.needsPreparation, from: state) else { return } + await drainToShielded(expecting: state.binding) + } + + /// Runs the preparation when `needed`, then marks a shown checklist done. + /// False when the preparation stopped the move (the failure is shown). + private func prepareForDrain( + needed: Bool, + from state: SwiftDashSDKTransactionSender.CoinJoinUtxoState + ) async -> Bool { + if needed { preparation = .preparingCoins if let message = await prepareCoinJoinInputs(state) { preparation = nil SwiftDashSDKWalletState.shared.refreshCoinJoinBalance() stage = .failed(message: message, destination: .shielded) - return + return false } } if preparation != nil { preparation = .done } + return true + } + /// The drain, once any preparation is done, and how it ended. + private func drainToShielded(expecting pinned: SwiftDashSDKTransactionSender.CoinJoinWalletBinding) async { guard !Task.isCancelled else { Self.log("move to Shielded — cancelled before the drain") let message = consolidationSent ? Self.preparingMessage : Self.genericFailureMessage @@ -283,7 +272,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // An empty account is reported by the coordinator / SDK preflight // exactly as before. await DWIdentityAuthorizer.preauthorized { [self] in - await coordinator.performAssetLock(funding: .coinJoinDrain, expecting: state.binding) + await coordinator.performAssetLock(funding: .coinJoinDrain, expecting: pinned) } // The coordinator's own cancel check (before any lock is built) after // a consolidation: the coins may sit mid-preparation, so say so @@ -302,6 +291,46 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { finishFromCoordinatorPhase() } + /// Why an earlier consolidation whose outcome was unknown blocks a new + /// plan, or nil once each of its transactions has an output in the + /// account (and then it is forgotten). + private func unobservedConsolidationRefusal() -> String? { + guard !unobservedConsolidationTxids.isEmpty else { return nil } + guard let state = binding.flatMap({ SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: $0) }) else { + Self.log("move to Shielded — the active wallet changed, or its CoinJoin UTXOs can't be read; stopping") + return Self.genericFailureMessage + } + // Any output counts, final or not: it shows the wallet applied it. + guard Set(state.entries.map(\.txid)).isSuperset(of: unobservedConsolidationTxids) else { + Self.log("move to Shielded — an earlier consolidation is not in the wallet yet, not replanning") + return Self.preparingMessage + } + unobservedConsolidationTxids = [] + return nil + } + + /// Asks for the PIN once for the whole move. False when it was cancelled + /// (back to the choice) or failed (the failure is shown). + private func authorizeShieldedMove() async -> Bool { + do { + try await DWIdentityAuthorizer().authorize() + return true + } catch DWIdentityAuthorizer.AuthError.cancelled { + Self.log("move to Shielded — authorization cancelled") + preparation = nil + stage = .choice + return false + } catch { + Self.log("move to Shielded — authorization failed") + preparation = nil + stage = .failed( + message: ShieldedTransferCoordinator.CoordinatorError.authFailed.errorDescription + ?? Self.genericFailureMessage, + destination: .shielded) + return false + } + } + /// The CoinJoin account's UTXO snapshot and the planner's verdict on it. private struct Plan { let state: SwiftDashSDKTransactionSender.CoinJoinUtxoState? @@ -315,7 +344,8 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { } var description: String { - "CoinJoin UTXOs n=\(state?.count ?? -1) final=\(state?.finalCount ?? -1) total=\(state?.totalDuffs ?? 0) duffs, plan=\(step.map { String(describing: $0) } ?? "unknown")" + "CoinJoin UTXOs n=\(state?.count ?? -1) final=\(state?.finalCount ?? -1) total=\(state?.totalDuffs ?? 0) duffs, " + + "plan=\(step.map { String(describing: $0) } ?? "unknown")" } } @@ -352,120 +382,166 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// /// - Parameter initial: the UTXO set read after authorization. private func prepareCoinJoinInputs(_ initial: SwiftDashSDKTransactionSender.CoinJoinUtxoState) async -> String? { - var state = initial - if let refusal = await Self.preparationRefusal(for: state) { return refusal } - // Too many pending to consolidate around; they normally lock within - // seconds. - if Self.step(for: state).isBlockedByPending { - guard let waited = await Self.waitForCoinJoinUtxos(state.binding, until: { !Self.step(for: $0).isBlockedByPending }) - else { return Self.genericFailureMessage } - state = waited.state - if !Self.step(for: state).isBlockedByPending { - // The wait can outlast the checks above: let sync settle, then - // plan from, and check, a read made after it. - if let refusal = await Self.syncRefusal(waitingUpTo: Self.syncSettleTimeout) { return refusal } - guard let fresh = SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: state.binding) else { - Self.log("move to Shielded — the active wallet changed, or CoinJoin UTXOs could not be read") - return Self.genericFailureMessage - } - state = fresh - if let refusal = Self.onlineRefusal(for: state) { return refusal } - } + do throws(PreparationStop) { + let state = try await Self.coinJoinStateToPlan(from: initial) + let consolidationTxids = try await consolidateIfDue(state) + try await Self.awaitDrainableCoinJoinState(state.binding, consolidationTxids: consolidationTxids) + return nil + } catch { + return error.message + } + } + + /// Ends a preparation attempt with the message to show. + private struct PreparationStop: Error { + let message: String + } + + /// The UTXO set to plan from: `initial`, or — when too many UTXOs are + /// pending to consolidate around — a read made after they no longer block + /// it, or after `finalityTimeout`. They normally lock within seconds; the + /// state returned after a timeout is still blocked, and `consolidateIfDue` + /// stops the attempt on it. + private static func coinJoinStateToPlan( + from initial: SwiftDashSDKTransactionSender.CoinJoinUtxoState + ) async throws(PreparationStop) -> SwiftDashSDKTransactionSender.CoinJoinUtxoState { + if let refusal = await Self.preparationRefusal(for: initial) { throw PreparationStop(message: refusal) } + guard Self.step(for: initial).isBlockedByPending else { return initial } + guard let waited = await Self.waitForCoinJoinUtxos(initial.binding, until: { !Self.step(for: $0).isBlockedByPending }) + else { throw PreparationStop(message: Self.genericFailureMessage) } + guard !Self.step(for: waited.state).isBlockedByPending else { return waited.state } + // The wait can outlast the checks above: let sync settle, then plan + // from, and check, a read made after it. + if let refusal = await Self.syncRefusal(waitingUpTo: Self.syncSettleTimeout) { throw PreparationStop(message: refusal) } + guard let fresh = SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: waited.state.binding) else { + Self.log("move to Shielded — the active wallet changed, or CoinJoin UTXOs could not be read") + throw PreparationStop(message: Self.genericFailureMessage) } - var consolidationTxids: [Data] = [] + if let refusal = Self.onlineRefusal(for: fresh) { throw PreparationStop(message: refusal) } + return fresh + } + + /// The consolidation's txids when `state` calls for one, else empty. + private func consolidateIfDue(_ state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) async throws(PreparationStop) -> [Data] { switch Self.step(for: state) { case .blockedByPending(let pending): Self.log("move to Shielded — n=\(state.count) with \(pending) not final, too many to consolidate around; stopping") - return Self.unconfirmedMessage + throw PreparationStop(message: Self.unconfirmedMessage) case .consolidate: - guard let address = SwiftDashSDKTransactionSender.unusedCoinJoinAddress(for: state.binding) else { - Self.log("move to Shielded — no unused CoinJoin address for the consolidation") - return Self.genericFailureMessage - } - let chunks = SwiftDashSDKTransactionSender.balancedChunks( - Array(repeating: 0, count: state.finalCount), - maxPerChunk: SwiftDashSDKTransactionSender.maxInputsPerSweep - ).map(\.count) - Self.log("move to Shielded — consolidating \(state.finalCount) final of n=\(state.count) CoinJoin UTXOs into \(chunks.count) tx(s) \(chunks)") - guard !Task.isCancelled else { - Self.log("move to Shielded — cancelled before the consolidation") - return Self.genericFailureMessage - } - do { - // Off the main actor so the checklist renders first; the - // sender hops back to main for the SDK calls themselves. - let binding = state.binding - let outpoints = state.finalOutpoints - let outcome = try await Task.detached(priority: .userInitiated) { - try SwiftDashSDKTransactionSender.sweepCoinJoin( - to: address, expecting: binding, outpoints: outpoints) - }.value - consolidationTxids = outcome.txids - unobservedConsolidationTxids = outcome.unknownTxids - consolidationSent = !outcome.txids.isEmpty - // Counts only: a txid leads to the consolidation address. - let failure = outcome.firstFailure.map { ", one: \(WalletSendService.logSummary(of: $0))" } ?? "" - Self.log("move to Shielded — consolidation broadcast \(outcome.txids.count) tx(s), \(outcome.failedChunkCount) failed\(failure)") - // A chunk that failed may still have reached peers (an - // unconfirmed broadcast), and the wallet may not show its - // inputs as spent yet; a drain now could spend them a second - // time. Stop here; the next attempt plans from the UTXO set - // as the wallet reads it then. - if outcome.isPartial { - Self.log("move to Shielded — partial consolidation, stopping before the drain") - return Self.partialPreparationMessage - } - } catch let error as SwiftDashSDKTransactionSender.CoinJoinSweepUnknownError { - // The broadcasts may have reached peers. The wallet applies a - // transaction before waiting for them, which spends its inputs - // locally; the next attempt waits until their outputs show. - consolidationSent = true - unobservedConsolidationTxids = error.unknownTxids - Self.log("move to Shielded — consolidation outcome unknown") - return Self.preparingMessage - } catch { - Self.log("move to Shielded — consolidation failed, nothing accepted: \(WalletSendService.logSummary(of: error))") - return Self.genericFailureMessage - } - guard !consolidationTxids.isEmpty else { - Self.log("move to Shielded — consolidation produced no transaction") - return Self.genericFailureMessage - } + return try await consolidate(state) case .awaitFinality, .drain, .nothingToMove: - break + return [] } + } - // Wait until every CoinJoin UTXO is final — the drain builder spends - // final inputs only — and, after a consolidation, at least until its - // outputs are back in the account and final. - let txids = consolidationTxids - // An output not in the account yet is not counted as pending. - let settled = { (state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) in - CoinJoinShieldPlanner.consolidationSettled(consolidationTxids: txids, utxos: state.txidFinality) - } - let isDone = { (state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) in - // Over the threshold another round is due whatever the pending - // ones do. - settled(state) - && (state.count > CoinJoinShieldPlanner.consolidationThreshold || state.finalCount == state.count) - } - guard await Self.waitForCoinJoinUtxos(state.binding, until: isDone) != nil else { - return txids.isEmpty ? Self.genericFailureMessage : Self.preparingMessage + /// Sweeps the final UTXOs of `state` onto a fresh CoinJoin address and + /// returns the txids. Stops the attempt unless every chunk was accepted. + private func consolidate(_ state: SwiftDashSDKTransactionSender.CoinJoinUtxoState) async throws(PreparationStop) -> [Data] { + guard let address = SwiftDashSDKTransactionSender.unusedCoinJoinAddress(for: state.binding) else { + Self.log("move to Shielded — no unused CoinJoin address for the consolidation") + throw PreparationStop(message: Self.genericFailureMessage) + } + let chunks = SwiftDashSDKTransactionSender.balancedChunks( + Array(repeating: 0, count: state.finalCount), + maxPerChunk: SwiftDashSDKTransactionSender.maxInputsPerSweep + ).map(\.count) + Self.log("move to Shielded — consolidating \(state.finalCount) final of n=\(state.count) CoinJoin UTXOs into \(chunks.count) tx(s) \(chunks)") + guard !Task.isCancelled else { + Self.log("move to Shielded — cancelled before the consolidation") + throw PreparationStop(message: Self.genericFailureMessage) } + let outcome: SwiftDashSDKTransactionSender.CoinJoinSweepOutcome + do { + // Off the main actor so the checklist renders first; the + // sender hops back to main for the SDK calls themselves. + let binding = state.binding + let outpoints = state.finalOutpoints + outcome = try await Task.detached(priority: .userInitiated) { + try SwiftDashSDKTransactionSender.sweepCoinJoin( + to: address, expecting: binding, outpoints: outpoints) + }.value + } catch let error as SwiftDashSDKTransactionSender.CoinJoinSweepUnknownError { + // The broadcasts may have reached peers. The wallet applies a + // transaction before waiting for them, which spends its inputs + // locally; the next attempt waits until their outputs show. + consolidationSent = true + unobservedConsolidationTxids = error.unknownTxids + Self.log("move to Shielded — consolidation outcome unknown") + throw PreparationStop(message: Self.preparingMessage) + } catch { + Self.log("move to Shielded — consolidation failed, nothing accepted: \(WalletSendService.logSummary(of: error))") + throw PreparationStop(message: Self.genericFailureMessage) + } + unobservedConsolidationTxids = outcome.unknownTxids + consolidationSent = !outcome.txids.isEmpty + // Counts only: a txid leads to the consolidation address. + let failure = outcome.firstFailure.map { ", one: \(WalletSendService.logSummary(of: $0))" } ?? "" + Self.log("move to Shielded — consolidation broadcast \(outcome.txids.count) tx(s), \(outcome.failedChunkCount) failed\(failure)") + // A chunk that failed may still have reached peers (an unconfirmed + // broadcast), and the wallet may not show its inputs as spent yet; a + // drain now could spend them a second time. Stop here; the next + // attempt plans from the UTXO set as the wallet reads it then. + if outcome.isPartial { + Self.log("move to Shielded — partial consolidation, stopping before the drain") + throw PreparationStop(message: Self.partialPreparationMessage) + } + guard !outcome.txids.isEmpty else { + Self.log("move to Shielded — consolidation produced no transaction") + throw PreparationStop(message: Self.genericFailureMessage) + } + return outcome.txids + } + + /// Waits until every CoinJoin UTXO is final — the drain builder spends + /// final inputs only — and, after a consolidation, at least until its + /// outputs are back in the account and final. Returns when the account + /// is ready to drain. + private static func awaitDrainableCoinJoinState( + _ binding: SwiftDashSDKTransactionSender.CoinJoinWalletBinding, + consolidationTxids txids: [Data] + ) async throws(PreparationStop) { + // Once a consolidation is out, its coins are mid-preparation. + let stop = { (message: String) in PreparationStop(message: txids.isEmpty ? message : Self.preparingMessage) } + guard await Self.waitForCoinJoinUtxos(binding, until: { Self.isDrainable($0, consolidationTxids: txids) }) != nil + else { throw stop(Self.genericFailureMessage) } // The coordinator refuses the drain off .syncDone, and the block that // ended the wait can briefly take the monitor out of it. Plan from a // read made after that settles. - if let refusal = await Self.syncRefusal(waitingUpTo: Self.syncSettleTimeout) { - return txids.isEmpty ? refusal : Self.preparingMessage - } - guard let after = SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: state.binding) else { + if let refusal = await Self.syncRefusal(waitingUpTo: Self.syncSettleTimeout) { throw stop(refusal) } + guard let after = SwiftDashSDKTransactionSender.coinJoinUtxoState(expecting: binding) else { Self.log("move to Shielded — the active wallet changed, or CoinJoin UTXOs could not be read") - return txids.isEmpty ? Self.genericFailureMessage : Self.preparingMessage + throw stop(Self.genericFailureMessage) + } + // Not through `stop`: `drainRefusal` picks its message from the + // consolidation's txids itself. + if let refusal = Self.drainRefusal(after, consolidationTxids: txids) { + throw PreparationStop(message: refusal) + } + guard !Task.isCancelled else { + Self.log("move to Shielded — cancelled before the drain") + throw stop(Self.genericFailureMessage) } - let satisfied = isDone(after) + } - if !satisfied { - if !settled(after) { + /// What ends the finality wait: the consolidation settled, and every + /// UTXO final — or over the threshold, where another round is due + /// whatever the pending ones do. + nonisolated private static func isDrainable( + _ state: SwiftDashSDKTransactionSender.CoinJoinUtxoState, consolidationTxids txids: [Data] + ) -> Bool { + // An output not in the account yet is not counted as pending. + CoinJoinShieldPlanner.consolidationSettled(consolidationTxids: txids, utxos: state.txidFinality) + && (state.count > CoinJoinShieldPlanner.consolidationThreshold || state.finalCount == state.count) + } + + /// Why `after`, the read made after the finality wait, can't be drained + /// now, or nil. + private static func drainRefusal( + _ after: SwiftDashSDKTransactionSender.CoinJoinUtxoState, + consolidationTxids txids: [Data] + ) -> String? { + if !Self.isDrainable(after, consolidationTxids: txids) { + if !CoinJoinShieldPlanner.consolidationSettled(consolidationTxids: txids, utxos: after.txidFinality) { // The consolidated coins are safe on their CoinJoin address; // a later attempt drains them once they are final. return Self.preparingMessage @@ -479,7 +555,6 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // before this preparation existed. The rest stays in the CoinJoin // account for a later move. } - let afterStep = Self.step(for: after) switch afterStep { case .consolidate, .blockedByPending: @@ -495,10 +570,6 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { case .nothingToMove: return Self.genericFailureMessage case .drain, .awaitFinality: - guard !Task.isCancelled else { - Self.log("move to Shielded — cancelled before the drain") - return txids.isEmpty ? Self.genericFailureMessage : Self.preparingMessage - } return nil } } diff --git a/DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedTransferCoordinator.swift b/DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedTransferCoordinator.swift index c6c247ab55..39be3d89be 100644 --- a/DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedTransferCoordinator.swift +++ b/DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedTransferCoordinator.swift @@ -511,6 +511,41 @@ final class ShieldedTransferCoordinator: ObservableObject { case coinJoinDrain } + /// Why the transfer must stop after the prompt, before anything is built + /// or broadcast, or nil. + private func executionRefusal( + funding: AssetLockFundingSource, + expecting binding: SwiftDashSDKTransactionSender.CoinJoinWalletBinding?, + env: Environment + ) -> Error? { + // After the prompt, so a switch while it was open is caught too; the + // sync gate below then reads the pinned wallet's state. + guard isStillBound(binding, env: env) else { + Self.logger.error("🛡️ SHIELD-TX :: asset lock refused — the active wallet changed") + return CoordinatorError.noWallet + } + + // A cancelled task stops here, before anything is built or broadcast. + // Reported as a cancel: the caller went away, nothing failed. + if Task.isCancelled { + Self.logger.error("🛡️ SHIELD-TX :: asset lock refused — task cancelled") + return CoordinatorError.authCancelled + } + + // Re-check at the execution boundary, not only where the surface was + // offered. The drain is whole-account and its value is computed + // SDK-side, so a scan that restarted while the sheet or the PIN prompt + // was open would lock a UTXO set the user never saw. The BIP44 route + // carries an explicit amount and its own screens gate on + // `isChainSynced`, so this is the drain's check alone. + if case .coinJoinDrain = funding, + SyncingActivityMonitor.shared.state != .syncDone { + Self.logger.error("🛡️ SHIELD-TX :: coinjoin drain refused — chain not synced") + return CoordinatorError.coinJoinDrainRequiresSync + } + return nil + } + /// `recipientRaw43` nil = the wallet's own default Orchard address (the /// internal transfer); an external Send passes the recipient's raw /// 43-byte payload. The recipient receives exactly `recipientAmountDuffs`: @@ -576,32 +611,8 @@ final class ShieldedTransferCoordinator: ObservableObject { return } - // After the prompt, so a switch while it was open is caught too; the - // sync gate below then reads the pinned wallet's state. - guard isStillBound(binding, env: env) else { - Self.logger.error("🛡️ SHIELD-TX :: asset lock refused — the active wallet changed") - handleFailure(CoordinatorError.noWallet) - return - } - - // A cancelled task stops here, before anything is built or broadcast. - // Reported as a cancel: the caller went away, nothing failed. - if Task.isCancelled { - Self.logger.error("🛡️ SHIELD-TX :: asset lock refused — task cancelled") - handleFailure(CoordinatorError.authCancelled) - return - } - - // Re-check at the execution boundary, not only where the surface was - // offered. The drain is whole-account and its value is computed - // SDK-side, so a scan that restarted while the sheet or the PIN prompt - // was open would lock a UTXO set the user never saw. The BIP44 route - // carries an explicit amount and its own screens gate on - // `isChainSynced`, so this is the drain's check alone. - if case .coinJoinDrain = funding, - SyncingActivityMonitor.shared.state != .syncDone { - Self.logger.error("🛡️ SHIELD-TX :: coinjoin drain refused — chain not synced") - handleFailure(CoordinatorError.coinJoinDrainRequiresSync) + if let refusal = executionRefusal(funding: funding, expecting: binding, env: env) { + handleFailure(refusal) return } From ac9238c3a5ac6032a1830233f09079f5b373b409 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Wed, 21 Oct 2026 15:09:58 +0300 Subject: [PATCH 11/11] fix(coinjoin): keep the sheet on the Shielded retry while a committed lock waits A cancelled PIN prompt during the resume of a committed asset lock sent the sheet back to the destination choice, where "Dash Wallet balance" started an independent sweep and could report the move done while the Shielded transfer was still unresolved. The cancel now leaves the sheet on the Shielded retry, whose Try again resumes the lock, and moveToWallet refuses while a lock is committed. The committed lock is read in one place (the coordinator's outpoint, or the one kept across its resets), and every coordinator reset keeps it. Co-Authored-By: Claude Opus 5.5 --- .../CoinJoinMoveFundsViewModel.swift | 63 ++++++++++++++++--- DashWallet/ar.lproj/Localizable.strings | 1 + DashWallet/bg.lproj/Localizable.strings | 1 + DashWallet/ca.lproj/Localizable.strings | 1 + DashWallet/cs.lproj/Localizable.strings | 1 + DashWallet/da.lproj/Localizable.strings | 1 + DashWallet/de.lproj/Localizable.strings | 1 + DashWallet/el.lproj/Localizable.strings | 1 + DashWallet/en.lproj/Localizable.strings | 1 + DashWallet/eo.lproj/Localizable.strings | 1 + DashWallet/es.lproj/Localizable.strings | 1 + DashWallet/et.lproj/Localizable.strings | 1 + DashWallet/fa.lproj/Localizable.strings | 1 + DashWallet/fi.lproj/Localizable.strings | 1 + DashWallet/fil.lproj/Localizable.strings | 1 + DashWallet/fr.lproj/Localizable.strings | 1 + DashWallet/hr.lproj/Localizable.strings | 1 + DashWallet/hu.lproj/Localizable.strings | 1 + DashWallet/id.lproj/Localizable.strings | 1 + DashWallet/it.lproj/Localizable.strings | 1 + DashWallet/ja.lproj/Localizable.strings | 1 + DashWallet/ko.lproj/Localizable.strings | 1 + DashWallet/mk.lproj/Localizable.strings | 1 + DashWallet/ms.lproj/Localizable.strings | 1 + DashWallet/nb.lproj/Localizable.strings | 1 + DashWallet/nl.lproj/Localizable.strings | 1 + DashWallet/pl.lproj/Localizable.strings | 1 + DashWallet/pt.lproj/Localizable.strings | 1 + DashWallet/ro.lproj/Localizable.strings | 1 + DashWallet/ru.lproj/Localizable.strings | 1 + DashWallet/sk.lproj/Localizable.strings | 1 + DashWallet/sl.lproj/Localizable.strings | 1 + DashWallet/sl_SI.lproj/Localizable.strings | 1 + DashWallet/sq.lproj/Localizable.strings | 1 + DashWallet/sr.lproj/Localizable.strings | 1 + DashWallet/sv.lproj/Localizable.strings | 1 + DashWallet/th.lproj/Localizable.strings | 1 + DashWallet/tr.lproj/Localizable.strings | 1 + DashWallet/uk.lproj/Localizable.strings | 1 + DashWallet/vi.lproj/Localizable.strings | 1 + DashWallet/zh-Hans.lproj/Localizable.strings | 1 + .../zh-Hant-TW.lproj/Localizable.strings | 1 + DashWallet/zh.lproj/Localizable.strings | 1 + DashWallet/zh_TW.lproj/Localizable.strings | 1 + .../CoinJoinMoveDestinationPolicyTests.swift | 18 ++++++ 45 files changed, 114 insertions(+), 10 deletions(-) diff --git a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift index d8c4f5136b..8ae0830383 100644 --- a/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsViewModel.swift @@ -143,6 +143,35 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { .store(in: &cancellables) } + /// The committed asset lock a retry resumes: the coordinator's, or the + /// one kept across its resets. After a terminal `.success` it still names + /// the lock that was spent; only the stages before it read this. + private var committedLock: (txidWire: Data, vout: UInt32)? { + coordinator.lastAssetLockOutPoint ?? unresumedLock + } + + private var hasCommittedLock: Bool { committedLock != nil } + + /// `coordinator.reset()` that keeps a committed lock for the retry: the + /// reset clears the coordinator's copy of the outpoint. + private func resetCoordinator() { + unresumedLock = committedLock + coordinator.reset() + } + + /// Where a cancelled PIN prompt leaves the sheet: the destination choice, + /// or — while a committed lock waits for its resume — the Shielded retry, + /// which resumes it. + nonisolated static func stageAfterAuthCancel(committedLock: Bool) -> Stage { + committedLock ? unresumedLockStage : .choice + } + + /// The Shielded retry offered while a committed lock waits for its + /// resume; its Try again resumes the lock. + nonisolated static var unresumedLockStage: Stage { + .failed(message: unresumedLockMessage, destination: .shielded) + } + var isInFlight: Bool { switch stage { case .movingToWallet, .shielding: @@ -155,9 +184,16 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // MARK: Actions /// Destination 1: the existing one-hop sweep into the spendable BIP44 - /// balance. Auth-cancel returns to the choice screen silently. + /// balance. Auth-cancel returns to the choice screen silently. Refused + /// while this sheet holds a committed Shielded lock: that transfer is + /// finished by resuming it, not by a sweep of what is left. func moveToWallet() async { guard !isInFlight else { return } + guard !hasCommittedLock else { + Self.log("move to wallet — refused, a committed Shielded lock is not resumed yet") + stage = Self.unresumedLockStage + return + } stage = .movingToWallet do { guard let binding else { @@ -191,7 +227,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { func moveToShielded() async { guard !isInFlight else { return } // A committed lock is resumed, never followed by a second drain. - if unresumedLock != nil { + if hasCommittedLock { preparation = nil await retryShielded() return @@ -206,7 +242,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // A prior failed attempt leaves the coordinator terminal; reset so // `beginTransfer()` doesn't silently bail. if coordinator.phase != .idle { - coordinator.reset() + resetCoordinator() } // Read before the prompt only to choose the checklist, and to stop @@ -282,7 +318,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { case .failed(let message) = coordinator.phase, message == ShieldedTransferCoordinator.CoordinatorError.authCancelled.errorDescription { Self.log("move to Shielded — cancelled before the drain") - coordinator.reset() + resetCoordinator() preparation = nil SwiftDashSDKWalletState.shared.refreshCoinJoinBalance() stage = .failed(message: Self.preparingMessage, destination: .shielded) @@ -662,6 +698,12 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { comment: "CoinJoin") } + nonisolated private static var unresumedLockMessage: String { + NSLocalizedString( + "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them.", + comment: "CoinJoin") + } + private static var unconfirmedMessage: String { NSLocalizedString( "Not all of your mixed coins are confirmed yet. Please try again in a few minutes.", @@ -684,15 +726,14 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { /// left the CoinJoin account untouched. func retryShielded() async { guard !isInFlight else { return } - if let op = coordinator.lastAssetLockOutPoint ?? unresumedLock { - unresumedLock = op + if let op = committedLock { guard let binding, binding == SwiftDashSDKTransactionSender.CoinJoinWalletBinding.current() else { Self.log("move to Shielded — resume refused, the active wallet changed") stage = .failed(message: Self.genericFailureMessage, destination: .shielded) return } stage = .shielding - coordinator.reset() + resetCoordinator() // Resume re-authorizes on its own (fresh user action). await coordinator.resumeAssetLock( outPointTxidWire: op.txidWire, outPointVout: op.vout, expecting: binding) @@ -707,7 +748,7 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { } // No committed lock to resume: plan afresh from the UTXO set as it is // now, a consolidation that already landed included. - coordinator.reset() + resetCoordinator() await moveToShielded() } @@ -727,9 +768,11 @@ final class CoinJoinMoveFundsViewModel: ObservableObject { // return to the destination choice (mirrors the wallet leg's // auth-cancel handling). Message-compare against the same // localized source the coordinator maps the cancel to. + // A committed lock still waits for its resume, so the sheet + // stays on the retry instead of offering the destinations again. if message == ShieldedTransferCoordinator.CoordinatorError.authCancelled.errorDescription { - coordinator.reset() - stage = .choice + resetCoordinator() + stage = Self.stageAfterAuthCancel(committedLock: hasCommittedLock) } else { stage = .failed(message: message, destination: .shielded) } diff --git a/DashWallet/ar.lproj/Localizable.strings b/DashWallet/ar.lproj/Localizable.strings index 7df34a2221..796ca81e10 100644 --- a/DashWallet/ar.lproj/Localizable.strings +++ b/DashWallet/ar.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/bg.lproj/Localizable.strings b/DashWallet/bg.lproj/Localizable.strings index 820237b8ba..4493889877 100644 --- a/DashWallet/bg.lproj/Localizable.strings +++ b/DashWallet/bg.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ca.lproj/Localizable.strings b/DashWallet/ca.lproj/Localizable.strings index 51e5e75cfb..dc16f7261d 100644 --- a/DashWallet/ca.lproj/Localizable.strings +++ b/DashWallet/ca.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/cs.lproj/Localizable.strings b/DashWallet/cs.lproj/Localizable.strings index d8ba228b87..fcaedea516 100644 --- a/DashWallet/cs.lproj/Localizable.strings +++ b/DashWallet/cs.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/da.lproj/Localizable.strings b/DashWallet/da.lproj/Localizable.strings index 30c0269e9a..7b2f67107c 100644 --- a/DashWallet/da.lproj/Localizable.strings +++ b/DashWallet/da.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/de.lproj/Localizable.strings b/DashWallet/de.lproj/Localizable.strings index e49458d3c8..11b5fe9d36 100644 --- a/DashWallet/de.lproj/Localizable.strings +++ b/DashWallet/de.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/el.lproj/Localizable.strings b/DashWallet/el.lproj/Localizable.strings index dc0dcd89c4..107704b786 100644 --- a/DashWallet/el.lproj/Localizable.strings +++ b/DashWallet/el.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/en.lproj/Localizable.strings b/DashWallet/en.lproj/Localizable.strings index 9fe87860da..4e74f13647 100644 --- a/DashWallet/en.lproj/Localizable.strings +++ b/DashWallet/en.lproj/Localizable.strings @@ -6361,6 +6361,7 @@ /* CoinJoin */ "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Still calculating the withdrawable amount. Tap Max again in a moment." = "Still calculating the withdrawable amount. Tap Max again in a moment."; diff --git a/DashWallet/eo.lproj/Localizable.strings b/DashWallet/eo.lproj/Localizable.strings index 36ddf618d6..961950bd83 100644 --- a/DashWallet/eo.lproj/Localizable.strings +++ b/DashWallet/eo.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/es.lproj/Localizable.strings b/DashWallet/es.lproj/Localizable.strings index 2e3aa37094..31625dbc3c 100644 --- a/DashWallet/es.lproj/Localizable.strings +++ b/DashWallet/es.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/et.lproj/Localizable.strings b/DashWallet/et.lproj/Localizable.strings index 27e3a07f50..f26d2a53f3 100644 --- a/DashWallet/et.lproj/Localizable.strings +++ b/DashWallet/et.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/fa.lproj/Localizable.strings b/DashWallet/fa.lproj/Localizable.strings index 12f46a5a56..3594346f8a 100644 --- a/DashWallet/fa.lproj/Localizable.strings +++ b/DashWallet/fa.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/fi.lproj/Localizable.strings b/DashWallet/fi.lproj/Localizable.strings index ec79b77655..dda715031d 100644 --- a/DashWallet/fi.lproj/Localizable.strings +++ b/DashWallet/fi.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/fil.lproj/Localizable.strings b/DashWallet/fil.lproj/Localizable.strings index b7775e2d89..4edc7dd2da 100644 --- a/DashWallet/fil.lproj/Localizable.strings +++ b/DashWallet/fil.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/fr.lproj/Localizable.strings b/DashWallet/fr.lproj/Localizable.strings index f1544c908e..bd02cbf1ea 100644 --- a/DashWallet/fr.lproj/Localizable.strings +++ b/DashWallet/fr.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/hr.lproj/Localizable.strings b/DashWallet/hr.lproj/Localizable.strings index 7379673bf8..92e5031337 100644 --- a/DashWallet/hr.lproj/Localizable.strings +++ b/DashWallet/hr.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/hu.lproj/Localizable.strings b/DashWallet/hu.lproj/Localizable.strings index 3aa054ad4b..e276ab88eb 100644 --- a/DashWallet/hu.lproj/Localizable.strings +++ b/DashWallet/hu.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/id.lproj/Localizable.strings b/DashWallet/id.lproj/Localizable.strings index d3d5c6e4b8..2dba32a07a 100644 --- a/DashWallet/id.lproj/Localizable.strings +++ b/DashWallet/id.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/it.lproj/Localizable.strings b/DashWallet/it.lproj/Localizable.strings index 32e9247295..17836a481b 100644 --- a/DashWallet/it.lproj/Localizable.strings +++ b/DashWallet/it.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ja.lproj/Localizable.strings b/DashWallet/ja.lproj/Localizable.strings index 6ba0e3c2ec..c838bf806f 100644 --- a/DashWallet/ja.lproj/Localizable.strings +++ b/DashWallet/ja.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ko.lproj/Localizable.strings b/DashWallet/ko.lproj/Localizable.strings index 33aa0e9176..126262f274 100644 --- a/DashWallet/ko.lproj/Localizable.strings +++ b/DashWallet/ko.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/mk.lproj/Localizable.strings b/DashWallet/mk.lproj/Localizable.strings index 82302c73ce..876de0a543 100644 --- a/DashWallet/mk.lproj/Localizable.strings +++ b/DashWallet/mk.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ms.lproj/Localizable.strings b/DashWallet/ms.lproj/Localizable.strings index e243a4f4bd..704c9f97f3 100644 --- a/DashWallet/ms.lproj/Localizable.strings +++ b/DashWallet/ms.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/nb.lproj/Localizable.strings b/DashWallet/nb.lproj/Localizable.strings index 93623c385d..0ef24b1609 100644 --- a/DashWallet/nb.lproj/Localizable.strings +++ b/DashWallet/nb.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/nl.lproj/Localizable.strings b/DashWallet/nl.lproj/Localizable.strings index 2bf7da9f20..d99720ea77 100644 --- a/DashWallet/nl.lproj/Localizable.strings +++ b/DashWallet/nl.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/pl.lproj/Localizable.strings b/DashWallet/pl.lproj/Localizable.strings index cc713da9d1..1cefd661f7 100644 --- a/DashWallet/pl.lproj/Localizable.strings +++ b/DashWallet/pl.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/pt.lproj/Localizable.strings b/DashWallet/pt.lproj/Localizable.strings index 43d29fdb2c..72c5951f0d 100644 --- a/DashWallet/pt.lproj/Localizable.strings +++ b/DashWallet/pt.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ro.lproj/Localizable.strings b/DashWallet/ro.lproj/Localizable.strings index c03414a496..5462f7595a 100644 --- a/DashWallet/ro.lproj/Localizable.strings +++ b/DashWallet/ro.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/ru.lproj/Localizable.strings b/DashWallet/ru.lproj/Localizable.strings index caeee53b83..00fd553e89 100644 --- a/DashWallet/ru.lproj/Localizable.strings +++ b/DashWallet/ru.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sk.lproj/Localizable.strings b/DashWallet/sk.lproj/Localizable.strings index 226a91c85e..a7210e81ea 100644 --- a/DashWallet/sk.lproj/Localizable.strings +++ b/DashWallet/sk.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sl.lproj/Localizable.strings b/DashWallet/sl.lproj/Localizable.strings index 142ad23d84..7cb1304832 100644 --- a/DashWallet/sl.lproj/Localizable.strings +++ b/DashWallet/sl.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sl_SI.lproj/Localizable.strings b/DashWallet/sl_SI.lproj/Localizable.strings index e4fe8fa1cc..f78c78c257 100644 --- a/DashWallet/sl_SI.lproj/Localizable.strings +++ b/DashWallet/sl_SI.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sq.lproj/Localizable.strings b/DashWallet/sq.lproj/Localizable.strings index 08c33239ad..2c925faa1e 100644 --- a/DashWallet/sq.lproj/Localizable.strings +++ b/DashWallet/sq.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sr.lproj/Localizable.strings b/DashWallet/sr.lproj/Localizable.strings index 5f2ff87d05..48ae270358 100644 --- a/DashWallet/sr.lproj/Localizable.strings +++ b/DashWallet/sr.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/sv.lproj/Localizable.strings b/DashWallet/sv.lproj/Localizable.strings index 8dffbe836c..8ea3032e5d 100644 --- a/DashWallet/sv.lproj/Localizable.strings +++ b/DashWallet/sv.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/th.lproj/Localizable.strings b/DashWallet/th.lproj/Localizable.strings index 66ed8214a2..e6d80fa919 100644 --- a/DashWallet/th.lproj/Localizable.strings +++ b/DashWallet/th.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/tr.lproj/Localizable.strings b/DashWallet/tr.lproj/Localizable.strings index 4497087eb3..046a78a960 100644 --- a/DashWallet/tr.lproj/Localizable.strings +++ b/DashWallet/tr.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/uk.lproj/Localizable.strings b/DashWallet/uk.lproj/Localizable.strings index 1bce949314..84266bcf5f 100644 --- a/DashWallet/uk.lproj/Localizable.strings +++ b/DashWallet/uk.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/vi.lproj/Localizable.strings b/DashWallet/vi.lproj/Localizable.strings index 92ffd04e76..4c804d2209 100644 --- a/DashWallet/vi.lproj/Localizable.strings +++ b/DashWallet/vi.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/zh-Hans.lproj/Localizable.strings b/DashWallet/zh-Hans.lproj/Localizable.strings index eea9d6e250..fdaf746032 100644 --- a/DashWallet/zh-Hans.lproj/Localizable.strings +++ b/DashWallet/zh-Hans.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/zh-Hant-TW.lproj/Localizable.strings b/DashWallet/zh-Hant-TW.lproj/Localizable.strings index fc4ffb9f04..d0d22a847f 100644 --- a/DashWallet/zh-Hant-TW.lproj/Localizable.strings +++ b/DashWallet/zh-Hant-TW.lproj/Localizable.strings @@ -6547,6 +6547,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/zh.lproj/Localizable.strings b/DashWallet/zh.lproj/Localizable.strings index 7d247f1845..fcaa041d93 100644 --- a/DashWallet/zh.lproj/Localizable.strings +++ b/DashWallet/zh.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWallet/zh_TW.lproj/Localizable.strings b/DashWallet/zh_TW.lproj/Localizable.strings index a1cf1a6b20..ed50d6fedd 100644 --- a/DashWallet/zh_TW.lproj/Localizable.strings +++ b/DashWallet/zh_TW.lproj/Localizable.strings @@ -6545,6 +6545,7 @@ "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance." = "Some of your mixed coins were prepared. Please try again to move them to your Shielded balance."; "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through." = "We couldn't confirm all of your CoinJoin funds reached the network. Don't move them again — the wallet keeps trying while it's open, and your balance will update as soon as they go through."; "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes." = "Your mixed coins are being prepared for the Shielded balance. Please try again in a few minutes."; +"Your mixed coins are locked for the Shielded balance. Please try again to finish moving them." = "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them."; "Some votes already cast" = "Some votes already cast"; "Special Purpose Account" = "Special Purpose Account"; "Start Platform sync before clearing its local state" = "Start Platform sync before clearing its local state"; diff --git a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift index 92dc9190bc..3ea1d4dfbd 100644 --- a/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift +++ b/DashWalletTests/CoinJoinMoveDestinationPolicyTests.swift @@ -304,6 +304,24 @@ final class CoinJoinShieldPlannerTests: XCTestCase { XCTAssertEqual(VM.preparedChecklistIndex(preparation: .done, phase: .success), 5) XCTAssertNil(VM.preparedChecklistIndex(preparation: .done, phase: .failed("x"))) } + + // MARK: Cancelled PIN prompt + + func testCancelledPromptReturnsToTheChoiceWithoutACommittedLock() { + XCTAssertEqual(CoinJoinMoveFundsViewModel.stageAfterAuthCancel(committedLock: false), .choice) + } + + /// A committed lock is finished by resuming it, so the sheet stays on the + /// Shielded retry and never offers the wallet destination again. + func testCancelledPromptKeepsTheShieldedRetryWhileALockIsCommitted() { + // Looked up the way the app does, so it holds in any locale. + let message = NSLocalizedString( + "Your mixed coins are locked for the Shielded balance. Please try again to finish moving them.", + comment: "CoinJoin") + XCTAssertEqual( + CoinJoinMoveFundsViewModel.stageAfterAuthCancel(committedLock: true), + .failed(message: message, destination: .shielded)) + } } /// How a CoinJoin sweep with failed chunks is reported.