Repository navigation
[NMA-1315] Crowdnode minor fixes - #979
Conversation
| selector, | ||
| true | ||
| emptyWallet = true, | ||
| checkBalanceConditions = false |
| fun show(activity: FragmentActivity, onResult: ((Boolean?) -> Unit)? = null) { | ||
| onResultListener = onResult | ||
| show(activity.supportFragmentManager, "adaptive_dialog") | ||
| if (activity.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) { |
There was a problem hiding this comment.
This should fix it in theory. Let's wait and see.
| @Override | ||
| public Flow<Coin> observeBalance(@NonNull Wallet.BalanceType balanceType) { | ||
| if (wallet == null) { | ||
| return FlowKt.emptyFlow(); |
There was a problem hiding this comment.
What should we do in general if the wallet is null? I feel like there should be some kind of global handler for this case - recreate, reset the wallet, or something else.
There was a problem hiding this comment.
That is a good question. There are some wallet = null cases in some other crashes with Krip Phones on Android 8.1. And it is puzzling how the app gets in such a state, because it seems like the wallet must be loaded (and be non-null) before the code in this exception is executed.
A global handler is a good idea - we could log something to CrashLytics and tell the user to report the issue. If we get the logs we might be able to tell what is happening. Not sure at this point if the wallet needs to recreated, or reset or something else though.
| viewModel.logEvent(AnalyticsConstants.CrowdNode.PORTAL_VERIFY) | ||
| ConfirmationDialog().show(parentFragmentManager, "confirmation_dialog") | ||
|
|
||
| if (requireActivity().lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) { |
There was a problem hiding this comment.
Maybe it'll be moved into the OffsetDialog itself later the same as with AdaptiveDialog.
|
|
||
| try { | ||
| blockchainState = blockchainStateDao.loadSync(); | ||
| } catch (SQLiteException ex) { |
There was a problem hiding this comment.
Could be a disk error or something else. If we don't reset the percentage, the user won't see Syncing... and might get a CrowdNode error if he goes into the portal too quickly. Not critical.
| } | ||
|
|
||
| fun getWalletApplication() : WalletApplication { | ||
| return walletApplication |
There was a problem hiding this comment.
Called from RestoreWalletDialogFragment and ends up being not initialized. If we inject it in there instead, this should fix it.
HashEngineering
left a comment
There was a problem hiding this comment.
Good Work finding various crashes
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
int23 is integration/v42int23 @ 60ddbf8e6c: int22 with v4.2-dev @ 2498727049 merged in (108 upstream commits, 4.2.0-beta.4) plus platform#4302, which persists the DashPay backfill record on the wallet row (Room 14 -> 15) so a relaunch resumes from the restored cursor instead of rewinding to the earliest contact's height on every launch. Engine pin d20ecf6a = int22's 9d1804d6 (e4208c90 + #979 without the durable sweep + #1035 + #1015 + #1016) + e5c74fc3 (IS-locked mined tx stays promotable) + #1059 (reject a ChainLock the list refuses) + #1063 (defer a ChainLock until the masternode lists reach it). Correction to the int22 commit message: int22 already carried #1016; the sweep was gone there too. AAR sha256 5fa7b33dc21334f1, natives arm64 750fb0bca4d374ea / x86_64 054d4b24f4695134, 271 JNI exports, per wallet-snapshots/BUILD-RECIPE-v42int23.md. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
int23 is integration/v42int23 @ 60ddbf8e6c: int22 with v4.2-dev @ 2498727049 merged in (108 upstream commits, 4.2.0-beta.4) plus platform#4302, which persists the DashPay backfill record on the wallet row (Room 14 -> 15) so a relaunch resumes from the restored cursor instead of rewinding to the earliest contact's height on every launch. Engine pin d20ecf6a = int22's 9d1804d6 (e4208c90 + #979 without the durable sweep + #1035 + #1015 + #1016) + e5c74fc3 (IS-locked mined tx stays promotable) + #1059 (reject a ChainLock the list refuses) + #1063 (defer a ChainLock until the masternode lists reach it). Correction to the int22 commit message: int22 already carried #1016; the sweep was gone there too. AAR sha256 5fa7b33dc21334f1, natives arm64 750fb0bca4d374ea / x86_64 054d4b24f4695134, 271 JNI exports, per wallet-snapshots/BUILD-RECIPE-v42int23.md. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
int23 is integration/v42int23 @ 60ddbf8e6c: int22 with v4.2-dev @ 2498727049 merged in (108 upstream commits, 4.2.0-beta.4) plus platform#4302, which persists the DashPay backfill record on the wallet row (Room 14 -> 15) so a relaunch resumes from the restored cursor instead of rewinding to the earliest contact's height on every launch. Engine pin d20ecf6a = int22's 9d1804d6 (e4208c90 + #979 without the durable sweep + #1035 + #1015 + #1016) + e5c74fc3 (IS-locked mined tx stays promotable) + #1059 (reject a ChainLock the list refuses) + #1063 (defer a ChainLock until the masternode lists reach it). Correction to the int22 commit message: int22 already carried #1016; the sweep was gone there too. AAR sha256 5fa7b33dc21334f1, natives arm64 750fb0bca4d374ea / x86_64 054d4b24f4695134, 271 JNI exports, per wallet-snapshots/BUILD-RECIPE-v42int23.md. Co-Authored-By: Claude Fable 5.1 <[email protected]>
* fix(shielded): bound stop() so a bring-up parked in the native bind cannot hang the service shutdown Andrei, 2026-09-22 (SM-A536B, release 12000017): after a blockchain reset cleared the ready latch, the next bring-up entered bindShielded and the SDK parked it behind a resumed wallet shield waiting indefinitely for a ChainLock (shield_guard, rs-platform-wallet). When the idle detector then stopped the service, ShieldedBalanceServiceImpl.stop() waited on the bring-up mutex forever, the service's onDestroy never finished, and every later start refused itself as a "deadlock in onDestroy" — the L1 engine stayed off for four hours. Plan section 37. stop() now waits at most STOP_LOCK_TIMEOUT_MS (5 s) for the lock and tears the Kotlin side down without it. A stopGeneration counter, bumped by every stop, lets the abandoned bring-up recognise on return that it was superseded: it reports not-ready and starts nothing, and the next trigger binds afresh. Nothing is stopped natively in that branch — the sync loop is only started after the bind, which has not returned. Tests: the parked-bind case (stop returns inside its bound, stops nothing natively, the abandoned bring-up is inert, a fresh bring-up then succeeds) and the uncontended path unchanged. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(service): end the process when a refused start finds the previous cleanup stuck past 5 min in the background BlockchainServiceImpl.onCreate rightly refuses to start while a previous instance's cleanup is unfinished, but nothing ever gave up on a cleanup that was never going to finish. On 2026-09-22 twelve alarm-driven starts over four hours each logged "deadlock in onDestroy" and stopped themselves while the process lived on with the engine off. Plan section 37. The refused start now measures how long the active cleanup has been stuck (cleanupStartedAtMs, set when cleanupDeferred is created). Past CLEANUP_DEADLOCK_EXIT_MS (5 min) with the app in the background it ends the process, so the next start — the alarm or the user — begins from a clean one. Never while the app is visible: that start is the user's own, and exiting would close the app on them; they get the refusal as before. decideOnCleanupDeadlock is pure and pinned on both axes. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: section 37 — the 2026-09-22 shutdown deadlock; QA A-02; platform issue 17 drafted Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(plan): section 34 corrected — the final-batch park is dash-spv's committed-range sweep, not a stuck block fetch Andrei's 2026-09-22 engine log settles it: the final batch's 65 matched blocks were all processed within six seconds, and the batch still did not commit for seven minutes. The line in between is `Rescan committed filters (934848-2539848) … (sweep #1)`: before committing the last batch, dash-spv re-tests every filter since wallet birth against the scripts derived during the scan, inline on the filter task, with no persisted progress. At P=19, M=784931 a 13,024-script set false-matches 1.66% of all 1.6M mainnet filters — ~26,000 block fetches for nothing — and a phone never finishes before something stops the engine. Our own integration-branch commit 80e07b8f (durable pending-sweep set, #979) re-seeds the set at every start, which is why the park recurs identically after every restart. Already open upstream: rust-dashcore#1002 describes this wallet shape; rust-dashcore#1016 (dash-spv owner, draft) drops the sweep. The issue draft this section promised is retired in favour of a comment there. Also: the 06:08 watchdog restart in the same log was a device-offline stall (all peers ping-timed out, DNS down 21 min, new network at 06:21:49), not an engine defect. The four app log lines and KDocs that stated the pending-block story are reworded; no test asserted on them. Co-Authored-By: Claude Fable 5.1 <[email protected]> * build: SDK 0.1.0-v42int22-SNAPSHOT int22 is the int21 engine pin d525f431 plus two cherry-picks: rust-dashcore #1015 (key-wallet: re-apply a spend whose coin was funded after it) and the block-counter fix that stops re-applications inflating `processed`. It does NOT carry #1016: the committed-range sweep and our durable pending-sweep set are both still present, so the plan §34 final-batch park is unchanged on this build. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: 2026-09-22 evening evidence — int22 restores on both devices; the per-launch re-walk is the DashPay backfill, not a park Plan §38: emulator (debug 12000017) and Samsung (release 12000018) both restored the job flower wallet on int22 to the correct seed with no watchdog verdict, stall WARN or restart; the emulator's engine log shows no committed-range sweep this time, with the ordering hypothesis stated as such. Plan §34.1a corrected and §38.2: the 1,532,170 re-walk boundary seen on every emulator session is coreHeightCreatedAt of the wallet's earliest DashPay contact request; rs-platform-wallet's reconcile_dashpay_rescan rewinds synced_height to it at every startup behind an in-memory guard (dashpay/platform#4302, PR #4740). The mod-5,000 residue the earlier text read as a batch-boundary park is the batch grid anchored at that start. QA: A-01 gains the int22 restore evidence; A-03 records the per-launch re-walk as an SDK defect; header and summary updated. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(service): arm the periodic restart alarm at service start, not only at clean stop The alarm had one call site: WalletApplication.scheduleStartBlockchainService from onDestroy's cleanup coroutine, at the "detaching from wallet" step after the onCreate latch and the check-mutex acquisition. A kill that lands before that step leaves the wallet with no pending restart. Samsung SM-S901U, 2026-09-22: synced at 17:39, task swiped ~17:43 (deferred while the service was started), idle stop 17:47:01.0, deferred "remove task" kill at 17:47:01.2 — 600 ms into cleanup. dumpsys alarm then listed no alarm for the app's uid, and 70 minutes later there was still no process on an awake, charging, battery-exempt device. lowmemorykiller on a cached process gives no onDestroy at all and has the same effect. Plan section 36.6. onCreate now arms the alarm after the foreground promotion. The scheduler cancels and replaces its own PendingIntent, so the two arms are idempotent, and a start delivered while the service is already running is an ordinary onStartCommand. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(shielded): cancellation-safe bounded lock in stop(); fence the whole bring-up against a stop that timed out Two review findings on the bounded stop. Lock leak at the timeout boundary: `withTimeoutOrNull { lock.lock() }` can deliver ownership to this coroutine while the timeout still wins the completion, returning null with the lock held and nothing to release it — on this singleton every later bring-up would then wait forever. stop() now acquires with a tryLock poll (tryLockWithin): tryLock is non-suspending and atomic, so ownership and the result cannot disagree, and the only suspension is the poll delay, during which nothing is held. Fence: the generation guard covered configure/bind only. A bring-up past it could be parked in the native sync-loop start when stop() timed out and tore the Kotlin side down; on return it published ready and started the collectors and the pending-shield sweep over the teardown. And hasShieldedSupport()/boundWalletIdOrNull() call ensureStarted(), so a stop in that bootstrap interval was absorbed by a snapshot taken later. The generation is now sampled first and re-checked after every native step; a superseded bring-up stops the loop it started (or found running) and declines. Tests: a bring-up parked in the native loop start is superseded by stop(), stops the loop it started and declines, and a fresh bring-up is whole again; a stop during the bootstrap interval aborts the bring-up before it binds. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(shielded): the stop fallback bumps the generation again so a bring-up that took the lock mid-poll is superseded too A second bring-up queued on the lock wins the handoff over stop()'s tryLock when the first releases, and snapshots the generation stop had already produced at entry. If it then outlasts the timeout, the fallback teardown left its snapshot equal to the current generation, so it started the loop and published ready over the teardown. The fallback now bumps the generation once more before tearing down, so every snapshot taken during the poll window is stale by the time the teardown runs. Test: stop_fallbackAlsoSupersedesASecondBringUpThatTookTheLockDuringItsPoll — two bring-ups gated in their native binds around a polling stop; both decline, no loop starts, a fresh bring-up afterwards is whole. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: section 39 — Joel's upgrade to 12000017, the three rewinds, the sweep at 67,658 scripts; QA J-01 Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(plan): section 39.3 — the anchor against the binder's receivedContactFloor; the backfill gate is the no-op binding Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(service): take the per-minute memory sample off the main thread Debug.getPss() walks /proc/self/smaps, and on the reference install's 2 GB replay process that held the main thread — inside the tick broadcast receiver — for 5 s or more, four times in one evening (plan §39.6). The sample now runs on the service scope, one in flight at a time; a slow one skips ticks rather than queueing behind itself. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: int22 is the #1016 build — correct section 38's pin and its "no sweep" reading; what int22 changes for Joel's wallet The AAR's native-library hashes are the recipe's #1015 + #1016 build (9d1804d6), not the #1015-only 08c0c04e that section 38 named; the 09-22 debug APK and the 09-23 release APK were both built against it. Section 38.1's provisioning-order explanation for "no sweep tonight" was wrong: there is no sweep in int22. Section 39.4 separates the scan's own matching (438–817 blocks per batch) from the sweep's additions (up to 800), and 39.7 / QA J-01 now say what 12000018 would and would not change. Co-Authored-By: Claude Fable 5.1 <[email protected]> * feat(sync-status): the header percentage measures the session's work, in tenths Over the whole chain the figure said nothing: a rewind to 2,167,092 under a 2,544,483 tip read 95.1 → 99.9% for three hours, and the 27,000-block re-walk every launch pays sat at 99% from start to finish (Joel, 2026-09-25, plan §39.8). ShadowSyncProgress carries the session's floor — the lowest header and filter cursor reported since the engine started, a running minimum so the DashPay backfill's rewind a few seconds in lowers it — and shadowSyncPermille measures progress over [floor, target]. A fresh restore (floor 0) reads as before. The persisted percentageSync stays a whole number for its == 100 consumers; L1SyncUiStatus gains percentageTenths and the home header shows "99.1%" / "99.9%" ("100%", never "100.0%"; dashj's whole number pre-cutover). The 100 decision is unchanged. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(plan): 39.9 — topple restored on int22; the session percentage observed on screen; the balance question Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: topple's balance reconciles exactly against dashj; int22 as published carries the recipe's §5 mid-sync-kill fund loss Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: 39.10 — the int22 mid-sync kill reproduced on this build, 0.449 DASH across seven change outputs Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(plan): 39.10 correction — the resumed process runs at the default gap; the kill run was confounded by the once-only widening Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(sdk-bind): re-apply the address-window widening on every bind, not once per heal version The Rust side keeps AddressPool::gap_limit in memory only — no changeset, no persistence — so every fresh process and every re-created SDK wallet comes up at the defaults (30 for BIP44, 100 for CoinJoin). The widening to 1000 ran once per heal version, so a process killed mid-scan resumed at the defaults and never rediscovered the outputs paid to change addresses the killed session had derived past used + 30: the kill-test fund loss of 2026-09-23 and 2026-09-25 (plan §39.10), which only the now-removed committed-range sweep (rust-dashcore#1016) used to mask. The widening now runs on every bind, before the engine starts; the heal's retroactive half (the rewind to birth and the coverage invalidation) stays once per version. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs: the every-bind widening proven by the kill test — store identical to the clean control Co-Authored-By: Claude Fable 5.1 <[email protected]> * build: SDK 0.1.0-v42int23-SNAPSHOT int23 is integration/v42int23 @ 60ddbf8e6c: int22 with v4.2-dev @ 2498727049 merged in (108 upstream commits, 4.2.0-beta.4) plus platform#4302, which persists the DashPay backfill record on the wallet row (Room 14 -> 15) so a relaunch resumes from the restored cursor instead of rewinding to the earliest contact's height on every launch. Engine pin d20ecf6a = int22's 9d1804d6 (e4208c90 + #979 without the durable sweep + #1035 + #1015 + #1016) + e5c74fc3 (IS-locked mined tx stays promotable) + #1059 (reject a ChainLock the list refuses) + #1063 (defer a ChainLock until the masternode lists reach it). Correction to the int22 commit message: int22 already carried #1016; the sweep was gone there too. AAR sha256 5fa7b33dc21334f1, natives arm64 750fb0bca4d374ea / x86_64 054d4b24f4695134, 271 JNI exports, per wallet-snapshots/BUILD-RECIPE-v42int23.md. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(sync): debug builds stop the SDK engines on service teardown, like release The debug-only branch kept the Kotlin-SDK SPV and shielded-sync engines running across BlockchainService teardown so a warm SPV would skip the asset-lock islock-verification delay after an idle restart. It also made a debug build's service restart a different event from release: the engines never restarted, so a normal teardown could not exercise the engine-restart path at all. The int23 contact-rewind investigation (wallet-snapshots/2026-09-25-topple-int23-run2-relaunch) needed exactly that path. Debug now tears down like release; the wipe/reset paths are unchanged. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(anr): cut the three logcat amplifiers behind the emulator ANR kills On 2026-09-25 the testnet wallet died twice of background ANRs on Pixel_9 ("No response to onStartJob", then a sticky restart that failed process startup). The main thread was blocked in GreedyScheduler.schedule waiting for WorkManager's lock, held by a WM thread stuck in Log.println_native: logd was saturated, and the wallet itself was the source — 11,800 lines in five minutes from one process. - WorkManager minimum logging level VERBOSE -> INFO. Its debug logging runs under the scheduler lock that the main thread takes on every schedule() call. - AnrException.logProcessMap logs the unresponsive thread only, not the full ~150-thread map. The ANR supervisor re-fires every 5 s while the UI thread stays slow, so the map was ~5,000 lines per five minutes and made the stalls it reported worse. printProcessMap(PrintStream) is unchanged for reports that want everything. - SecurityGuard.logState once per process. It ran from the constructor AND every getInstance(), and the 15-second platform sync pass calls getInstance(), so the six-line key inventory landed 183 times in five minutes. Co-Authored-By: Claude Fable 5.1 <[email protected]> * build: SDK 0.1.0-v42int24-SNAPSHOT int24 is int23 (integration/v42int23 @ 60ddbf8e6c, engine d20ecf6a) plus the #4302 second pass from fix/persist-dashpay-backfill-completion-int23 @ 8fee97fe4e: the outbound contact-account marker (external_account_reference) is persisted on the contact rows, outbound registration no longer lowers synced_height, receival registration consults the backfill record and writes it in the same round it lowers, and record_pass no longer invents an extent. Device result on the topple wallet (Pixel_9, 21 contacts, restore from seed): first launch scanned once from birth and reconciled exactly against the clean control (1083 coins, 169.02812043, 21,227 watched); the cold restart did no filter walk at all — FiltersSyncComplete at the tip within a second, reconcile "record covers these contacts" with synced_height=1561118, zero external account rebuilds. int22/int23 re-walked 334,220 filters on every launch. Snapshot: wallet-snapshots/2026-09-26-topple-int24-restore/. AAR sha256 aac9ec1347901ccc, natives arm64 d3b059da45bbee6f / x86_64 fd308c0fe0525d54, 271 JNI exports; wallet-snapshots/BUILD-RECIPE-v42int24.md. Co-Authored-By: Claude Fable 5.1 <[email protected]> * build: SDK 0.1.0-v42int25-SNAPSHOT int25 is int24 (8fee97fe4e) plus 73c221cd36 (late-discovery test) and 71cee8e9da (Room schema collapse): the DashPay backfill columns and the outbound contact-account marker fold into MIGRATION_13_14, version 14, 15.json deleted. Native libraries are byte-identical to int24 (arm64 d3b059da45bbee6f / x86_64 fd308c0fe0525d54); only the Kotlin publish changed. Field installs (int22 = Room 13) migrate in one step; int23/int24 emulators need a wipe. Device result, the field upgrade path on the topple wallet (Pixel_9): an int22 Room-13 store (21 contacts, no record, no markers) dropped under this build migrated 13 -> 14 cleanly; the 8 outbound accounts rebuilt once without touching the cursor; reconcile lowered ONCE with the real pair (floor=1226329 rewound_from=1560555); killed at the 40th commit of the climb (1441329); the relaunch resumed at scan_start=1436330 = persisted+1 with the record intact, pending=true, zero rebuilds, and reached the tip 38 s later; the store reconciled exactly against the clean control. Snapshot: wallet-snapshots/2026-09-26-topple-int22-to-int25-upgrade/. Co-Authored-By: Claude Fable 5.1 <[email protected]> * build: SDK 0.1.0-v42int26-SNAPSHOT int26 is int25's line — every int carry, engine d20ecf6a, the #4302 second pass — with origin/v4.2-dev @ 2f54ec88eb merged (16 upstream commits, all drive / drive-abci / platform-version; grovedb -> dce8252f) and the Room schema collapse reverted: Room is 15 on upstream numbering again (14 = the #4829 token column, 14.json identical to upstream's; 15 = the four DashPay backfill columns), so a later rebase onto an upstream carrying the merged PR cannot hit a duplicate-column migration. Field installs (int22 = 13) migrate 13 -> 14 -> 15. Device result on the topple wallet (Pixel_9): an int22 Room-13 store under this build migrated cleanly; reconcile lowered once (floor=1226329, rewound_from=1561246); the 8 outbound accounts rebuilt once without touching the cursor; a kill at the 40th commit (1416329) resumed at scan_start=1411330 with the record intact and zero rebuilds; the final store reconciled exactly against the clean control; a cold start did no filter download. Snapshot: wallet-snapshots/2026-09-26-topple-int22-to-int26-upgrade/. AAR sha256 e9a79b40772247f1, natives arm64 ef3cc9d480f268ac / x86_64 903fa81909ff6ef4, 271 JNI exports; wallet-snapshots/BUILD-RECIPE-v42int26.md. Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore: bump version code to build 19 * fix(shielded): fence the bring-up after the prover warm-up and after publishing ready warmUpProver() suspends after the last generation check. A stop() that timed out on the lock while it was outstanding had already torn the Kotlin side down; when warm-up returned, the bring-up published ready anyway, left the native loop running, and let ensureShieldedReady() restart the collectors and the pending-shield sweep over the teardown. The bring-up now re-checks the generation after warm-up and, when superseded, stops the loop it started and declines. It also verifies once more after publishing: the fallback bumps the generation before it clears the latch, so either the verify sees the bump and withdraws the publish, or the clear lands after the publish and removes it. Warm-up no longer swallows cancellation. Regression test holds warm-up open until stop()'s fallback completes; it fails on the previous code ("superseded during warm-up: not ready"). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shielded): a timed-out stop leaves the native loop's stop owed to the lock No generation check closes the window after the last one: a bring-up that published ready and passed its final verify can still stall holding the lock (a slow log write). A stop() that times out then cleared the latch but could not reach the native loop, and nothing owed that loop a stop — later stops returned early on the null latch. The fallback now records the stop as owed and hands it to the lock: whoever releases or next takes it pays. Both sides set-then-check (the fallback sets the debt then tries the lock; a holder unlocks then checks the debt), so one of them always sees the other. A bring-up whose stop was paid on release returns false, so the caller starts no collectors or sweep. Loop ownership is tracked explicitly, so stop() also stops a loop a failed bring-up started without ever publishing ready. Regressions: park after the final check, complete the stop, release, the loop is stopped exactly once; and a start that throws after the loop began leaves a loop the next stop() stops. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(anr): label the saved stack with its own thread; test the debug teardown as it is now AnrException printed the monitored thread's stack under Thread.currentThread() — the monitor coroutine's thread — and still called Thread.getAllStackTraces() every 5 s only to count threads. It now keeps the constructor's thread and prints no count. PlatformSyncEngineTeardownTest still asserted the removed debug exemption (zero engine stops on shutdown); it now asserts both engines stop on the debug unit-test variant. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sdk-bind): a failed widening owes a rescan to the next successful one On a wallet that healed long ago, a bind whose address-window widening failed went on to scan that session at the Rust default windows, and the next launch's successful widening skipped the heal — so outputs beyond the default window in the blocks that session covered were never looked at again (the plan §39.10 loss, through the failure branch). The failure is now persisted (SDK_GAP_WIDEN_RESCAN_OWED); the next successful widening arms the SPV rescan to birth and only then clears it. A failed arm keeps the debt; the one-shot heal's own rewind clears it too. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(shielded): widen the two-bring-up handoff test's stop timeout so a slow runner cannot reorder it The test needs stop() still polling when the first bring-up's bind returns (~150 ms in); at 400 ms a slow CI runner could time out first, after which the queued bring-up legitimately samples the post-stop generation and starts. 2 s keeps the intended interleaving. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(anr): keep the constructor's Javadoc on the constructor; tolerate a null transient thread The saved-thread field landed between the constructor and its Javadoc. The field is transient, so a deserialized copy has no thread: print its frames unlabelled instead of throwing inside the ANR logger. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shielded): sample the bring-up generation before paying an owed stop; scope debts to their generation A queued bring-up sampled its generation only after draining an owed native stop, and that drain suspends in the native stop call. A second stop timing out during the drain was absorbed: the bring-up sampled the bumped generation, bound, started a replacement loop, published ready, paid the second debt on release (stopping that loop) and still returned true over the teardown. The sample now happens the moment the lock is taken, before the drain. The debt was also a bare flag, so paying it tore down whatever held the lock, including a bring-up that sampled after the stop. It now carries the stop's final generation, and paying it stops only a loop (and clears only a ready latch) owned by an older generation. Regression: #1 parked past its last check, stop A times out, #2 queued (UNDISPATCHED, so provably before #1 releases) pays A's debt and parks in the native stop, stop B times out; #2 must decline without binding. It fails with the old sampling order. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shielded): scope the stop fallback's Kotlin teardown to runtimes older than the stop The fallback cleared the ready latch unconditionally. If it paused after its final generation bump, a bring-up that sampled after that bump could bind, start and publish; the teardown then cleared that newer runtime's latch while the generation-scoped debt rightly spared its loop, leaving a loop running with no readiness. Publication and teardown are now atomic with respect to each other (readyMonitor), and the fallback and the owed-stop drain clear the latch only when it was published by an older generation. Regression: park the fallback after its bump, complete a newer bring-up, resume; the newer runtime stays ready and its loop is not stopped. It fails with the unconditional teardown ("expected 2 binds but was 3"). Also: stopSdkEngines' KDoc no longer claims debug builds skip the engine stops on shutdown. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sync): judge a filter-stall restart by whether the cursor passes the stuck height (QA D-901b) The filter-stall watchdog logged "engine restart succeeded" as soon as the new engine started. In QA run 9 it logged that twice against a filter cursor that never left 948,000. A restart now arms FilterStallRestartVerifier instead. It reports RECOVERED only when the cursor passes the stuck height (a restarted engine resumes below it from the durable watermark, so merely moving is not recovery), and NOT RECOVERED when the watchdog is about to act on a stall again, or stand down, without that having happened. The not- recovered line says whether the cursor wedged again at the same height and how many consecutive restarts failed there: the deterministic shape that points at persisted SPV state rather than a transient condition (D-901). Logging only; the restart ladder is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shielded): an owed native stop survives its draining caller being cancelled A queued bring-up pays an owed stop in its caller's context. The drain cleared the debt and the loop ownership BEFORE the native stop ran, and the SDK dispatches that stop through withContext(Dispatchers.IO), which a cancelled caller skips. Cancelled at that point (a view-model scope going away), both markers were gone with the loop still running, and every later stop() returned early. The native stop now runs non-cancellably. Loop ownership is cleared only once the SDK call returns successfully, so a failed stop is retried by the next stop(). The debt is cleared by compare-and-set after the attempt, so a newer debt recorded meanwhile survives. Regressions: cancel the queued bring-up while it is inside the native stop of its drain, and the loop still ends up stopped; a failed native stop is retried by the next stop(). Both fail on the previous code. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(shielded): pay an owed stop on a cancelled lock handoff; start collectors and the sweep only for the committed runtime Two remaining gaps in the bring-up/stop protocol, found in an adversarial pass over it: - A queued bring-up cancelled AFTER the mutex was handed to it: kotlinx's prompt-cancellation path releases the lock itself, skipping releaseLock(), and the previous holder's handoff had already lost its tryLock to that handoff. A debt from a timed-out stop then sat unpaid with the lock free and the old loop running. The acquisition now pays any owed stop before rethrowing the cancellation. - ensureShieldedReady() started the collectors and the pending-shield sweep after the lock was released, so a stop landing in between could be followed by them starting anyway, and the untracked sweep could resume a wallet shield after that stop. They now start under readyMonitor and only while the runtime this pass committed is still the published one; the sweep's Job is tracked and cancelled by teardown. (Pre-existing window, now closed.) Regressions for both; each fails on the previous code. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(shielded): wait for the sweep callback to end before asserting it was cancelled The sweep-cancellation test slept a fixed 200 ms before asserting, so on a slow runner an uncancelled sweep could still set its flag afterwards and the test would pass. The callback now signals completion on both outcomes and the assertion waits for it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(service): start the cleanup deadlock clock at the claim and clear it when that cleanup ends The plan §37 exit policy measured a stuck cleanup from a timestamp set only after the cleanup had waited for its instance's initialization, and never cleared. A cleanup stuck in that wait read 0 ms, so a refused start never reached the five-minute exit; and after a cleanup finished, a later refused start could be measured against the old timestamp and end the process early. CleanupDeadlockClock now starts when a cleanup claims isCleaningUp, before the initialization wait, and that same owner clears it in its finally by compare-and-set on the token start() returned, so a stale finish cannot clear a newer owner's clock. Also refreshes two comments the review flagged as stale: AnrException's logProcessMap Javadoc (it logs one thread now) and the wipe path's note about the removed debug engine-stop exemption. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(service): put the cleanup-deadlock policy KDoc back on decideOnCleanupDeadlock CleanupDeadlockClock and its KDoc had been inserted between the policy KDoc and the function it documents, leaving that block dangling. The clock now sits above it. No code change. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(service): make the final foreground check and the §37 process exit one main-thread step The refused-start path read AppForegroundMonitor on Dispatchers.IO, logged, then called Runtime.exit(). Activity lifecycle callbacks update that monitor on the main thread, so an activity starting between the read and the exit could have its now-visible app closed on a stale snapshot. endProcessIfStillBackgrounded() now re-reads visibility and exits in the same main-thread task, with nothing between them; the stuck-cleanup line is logged before it. Regressions drive it on a StandardTestDispatcher: the app foregrounding after eligibility but before the main-thread decision runs is never exited; still backgrounded, it exits; below the bound it never does. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sdk-bind): hold the SPV scan when a failed widening's rescan debt cannot be recorded On an already-healed wallet, a failed address-window widening followed by a failed DataStore write left neither wide windows nor a durable rescan obligation, yet the bind continued and SPV scanned at the default windows. The next launch's successful widening found no debt, so outputs beyond the default window in the blocks that session covered could stay missing. The debt write now reports failure, and SdkWalletBinder.ensureScanMayAdvance is the scan-start gate: while the windows are narrow and the debt is unrecorded it retries the widening, then the write, and returns false only when both fail again. L1ShadowSyncService.startIfEnabled declines the SPV start on false; its next trigger asks again. Recorded debt or wide windows leave the gate open, so the normal best-effort bind is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sdk-bind): the scan gate widens the windows itself and a refused start retries on its own Two gaps in the widening-debt scan gate: - It was open while widening was still pending, and before any bind pass in the process. A start in that window (a shield's ensureSpvRunning during a rebind, say) could scan at the default windows before the widening failed and the flag closed. The gate now guarantees the outcome instead of checking a failure flag afterwards: it widens the loaded wallet itself when this process has not (widening needs no seed), falls back to recording the debt, and declines only when both fail. It shares a lock with the bind's own widening step, so a start during that step waits for its result. Re-creating the SDK wallet clears the per-wallet state, since the new wallet is at the defaults. - A refusal had no continuing recovery: the one-shot post-bind starter had already spent itself, so sync could stay stopped after the failures recovered. A refusal now schedules its own start retry (30 s doubling to 5 min, one in flight, cancelled by an external stop() and when the gate opens). The gate call is bounded under the engine mutex. Tests: the gate widens before any bind pass, waits for a widening in progress, and widens again after wallet re-creation; a refusal retries until the gate opens with no other trigger; stop() cancels the retry. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(sync): a scan-gate retry carries its originating start's stop generation The retry sampled externalStopGeneration when it was scheduled, after the suspending gate call. A stop() landing while an ordinary start was parked in the gate bumped the generation, cancelled the retry recorded at that moment (none), and waited for the mutex; the refusal then scheduled a new retry carrying the NEW generation, which stop() never cancelled, and SPV restarted after the stop had completed. startIfEnabled now samples the generation before any suspending work, declines to schedule when it has already moved, and hands that original generation to the retry, so any stop after the start began keeps the engine down. Regression: park a start inside the gate, stop(), release the gate with a refusal, open the gate; SPV never restarts. It fails on the previous code (1 start after the stop). Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
…n step (#1599) * fix(walker): re-net CoinJoin rounds stored income-only When a restore processes a mixing round before the transactions that funded its inputs, the SDK stores the round with netAmount = +(our outputs) instead of the true net (0 for a pure denomination round). rust-dashcore#979 fixes this in the engine; stores without it keep the wrong value (236 of 5,070 rounds, +84.41 DASH, on Wallet A; 52 of 1,526, +4.79 DASH, on Wallet B). For every CoinJoin row, funded - spent over the TXO mirror equals the correct net. reattributed() now also flags CoinJoin rows (transactionTypeKind 1, direction COINJOIN) with confirmed spent evidence and corrects only their net to fundedOwned - spentOwned (recomputeCoinJoinRecordNet). Direction and fee are kept. A correct row produces an equal record: no payload fetch, no write, no log. A correction needs payload facts and passes the mirror-completeness guard, otherwise it is deferred. It is persisted through the existing compare-and-set on the row's current values. The flag is structural, so a partial recompute made mid-sync is recomputed again until the spent marks are complete. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(history): re-sum Mixing group rows from their members' current nets planMixingGroupUpdates adds a member's net once, when the member is first grouped, and skips it after that. During a restore a round is often grouped while its record still has the income-only net. When the record is corrected later (by the engine via rust-dashcore#979, or by the walker's CoinJoin re-net), the group row keeps the old sum. Measured on pulled stores with #979: Wallet A showed +1.86290304 where its members sum to -0.08511644; Wallet B showed +4.78013929 where they sum to -0.01190863. Each coinjoin_<date> group row is now recomputed from its tx_group_cache members: value = sum of the current nets of the members the SDK store holds, count = member count (planMixingGroupResum). The re-sum runs: - after every complete reconcile walk, once per group, as actions on the pipeline's sequential collector so it never races syncDisplayCache; - when the walker persists corrections (onCorrectionsPersisted -> CutoverUiSource.observeCorrectedRecordTxids), for the groups holding a corrected txid. Members are read in keyset pages of 500 and their nets through the walker's served (reattributed) records, chunked. Only rows whose value or count differ are written, and only those two columns, through a targeted UPDATE, so memos, rates and titles are never touched. Members missing from the SDK store are left out of the value and logged once per group. A group with no member in the store is left as it is. Non-CoinJoin groups are never touched. A dashj-era row for the same date shares the id and is re-summed the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(walker): only ever lower a CoinJoin round's net On a store with rust-dashcore#979 the engine has already persisted the fully attributed net. During a restore the TXO mirror's spent marks can still be incomplete, so funded - spent reads higher than the truth. The re-net used to overwrite the correct value with that partial one, and if an input's txos row never lands (the rust-dashcore#1006 class) the wrong value would have been permanent. recomputeCoinJoinRecordNet now refuses any recompute higher than the stored net. Without #979 the stored net is born too high and each new spent mark only lowers the recompute, so corrections still move down to the truth. With #979 a partial recompute is higher and is left alone: no payload fetch, no write, no log. Accepted cost: a CoinJoin net stored too low (an output missed at the time) is never raised by the walker. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
#1597) * chore(sdk): pin Kotlin SDK 0.1.0-v42int28-SNAPSHOT int28 = int27 without dashpay/platform#4740. The DashPay receive path is upstream #5026 (up to 72b34c0e7b: the stale-debt fix and review rounds 7-8), the fork's one-way contact receival, and #4439 + 56f6c055df, which sends the full account tuple in TXO classification. That last one fixes "malformed outpoint queries: missing field standardTag". The base, engine (d20ecf6a) and Room schema (15) are unchanged. Published as 0.1.0-v42int28-20261002.062748-1 from HashEngineering/platform integration/v42int28-pin @ 4dd8e3d0a2. Device check on topple, int27 -> int28 in place: - the 72-byte record resumed for the 8 known contacts; - the 3 one-way contacts got receiving accounts and one rewind, which found a previously missed contact payment; - the TXO reconcile is consistent; - a relaunch did not rewind. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(sdk): pin the exact int28 SDK build, not the SNAPSHOT name 0.1.0-v42int28-20261002.062748-1 is the build tested on device. A SNAPSHOT name can be republished, which would change what a later build gets with no source change. Resolves from the Sonatype snapshots repo; the AAR is byte-identical to the tested one (sha256 57044712...). Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(sdk): pin Kotlin SDK v42int29 (0.1.0-v42int29-20261007.000257-1) The only int29 build on Sonatype. Built from HashEngineering/platform integration/v42int29 @ 762b2ddcdd; the published AAR matches the local build (sha1 f75ebc71). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(history): correct CoinJoin mixing nets and keep the Mixing rows in step (#1599) * fix(walker): re-net CoinJoin rounds stored income-only When a restore processes a mixing round before the transactions that funded its inputs, the SDK stores the round with netAmount = +(our outputs) instead of the true net (0 for a pure denomination round). rust-dashcore#979 fixes this in the engine; stores without it keep the wrong value (236 of 5,070 rounds, +84.41 DASH, on Wallet A; 52 of 1,526, +4.79 DASH, on Wallet B). For every CoinJoin row, funded - spent over the TXO mirror equals the correct net. reattributed() now also flags CoinJoin rows (transactionTypeKind 1, direction COINJOIN) with confirmed spent evidence and corrects only their net to fundedOwned - spentOwned (recomputeCoinJoinRecordNet). Direction and fee are kept. A correct row produces an equal record: no payload fetch, no write, no log. A correction needs payload facts and passes the mirror-completeness guard, otherwise it is deferred. It is persisted through the existing compare-and-set on the row's current values. The flag is structural, so a partial recompute made mid-sync is recomputed again until the spent marks are complete. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(history): re-sum Mixing group rows from their members' current nets planMixingGroupUpdates adds a member's net once, when the member is first grouped, and skips it after that. During a restore a round is often grouped while its record still has the income-only net. When the record is corrected later (by the engine via rust-dashcore#979, or by the walker's CoinJoin re-net), the group row keeps the old sum. Measured on pulled stores with #979: Wallet A showed +1.86290304 where its members sum to -0.08511644; Wallet B showed +4.78013929 where they sum to -0.01190863. Each coinjoin_<date> group row is now recomputed from its tx_group_cache members: value = sum of the current nets of the members the SDK store holds, count = member count (planMixingGroupResum). The re-sum runs: - after every complete reconcile walk, once per group, as actions on the pipeline's sequential collector so it never races syncDisplayCache; - when the walker persists corrections (onCorrectionsPersisted -> CutoverUiSource.observeCorrectedRecordTxids), for the groups holding a corrected txid. Members are read in keyset pages of 500 and their nets through the walker's served (reattributed) records, chunked. Only rows whose value or count differ are written, and only those two columns, through a targeted UPDATE, so memos, rates and titles are never touched. Members missing from the SDK store are left out of the value and logged once per group. A group with no member in the store is left as it is. Non-CoinJoin groups are never touched. A dashj-era row for the same date shares the id and is re-summed the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(walker): only ever lower a CoinJoin round's net On a store with rust-dashcore#979 the engine has already persisted the fully attributed net. During a restore the TXO mirror's spent marks can still be incomplete, so funded - spent reads higher than the truth. The re-net used to overwrite the correct value with that partial one, and if an input's txos row never lands (the rust-dashcore#1006 class) the wrong value would have been permanent. recomputeCoinJoinRecordNet now refuses any recompute higher than the stored net. Without #979 the stored net is born too high and each new spent mark only lowers the recompute, so corrections still move down to the truth. With #979 a partial recompute is higher and is left alone: no payload fetch, no write, no log. Accepted cost: a CoinJoin net stored too low (an output missed at the time) is never raised by the walker. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * chore(sdk): pin Kotlin SDK v42int30 (0.1.0-v42int30-20261009.200225-1) int29 plus #5026's newer backfill-record commits, #5256 (docs) and the SDK fallback that opens DashPay contact requests dashj encrypted with its altered ECDH key. Built from HashEngineering/platform integration/v42int30 @ c4a2b6e83d; the published AAR matches the tested build (sha256 809c0267). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(history): never overwrite a Mixing group total with partial SDK history planMixingGroupResum replaced a group row's value whenever at least one member had an SDK record, summing only the members the store held while keeping the full member count. dashj-era groups share these group ids, so a complete cached total (-300 = -100 + -200) became -100 when the store held only the first member, and stayed truncated until the missing record arrived. A member the store does not hold has an unknown net, not a zero one: the row is now rewritten only when every member has a current SDK net; otherwise it keeps its cached value and count. The partial-member regression tests now protect the complete cached value and check the group converges once the missing record arrives. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(history): read Mixing group members off the tx-feed collector A group re-sum read every member of a group (one 500-txid page at a time) inside a single action on txPipeline's sequential collector, so a large group held every live transaction and InstantLock event until the whole group had been read. The reads now run in a child worker coroutine of txPipeline, one group at a time. Each group's tally (member count, present count, net sum, and the row's value/count when the read began) comes back through the collector's lane and is written there. Before writing, the collector re-checks that the row's value and count are unchanged and the group's member count (new TxGroupCacheDao.countGroupMembers) still matches; a group that gained members meanwhile is queued again and re-read rather than overwritten with a sum that misses them. The worker waits for each write before reading the next group. Re-sum requests (reconcile walk, store corrections) go through MixingResumQueue, which coalesces them by group id; a group requested while its re-sum is running is queued once more, never once per request. The result is unchanged. Tests: a transaction event is rendered while a 3-page group re-sum is held between pages; a group that grows mid-read is re-read and written once, complete; queue coalescing. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(history): don't re-queue a Mixing group from its own re-sum reads recordNetsFor() read group members through a walker that reports every correction it persists on observeCorrectedRecordTxids. A re-sum reading a group whose members still carried stale nets therefore reported one correction batch per corrected 500-member page, and each batch queued a full re-sum of the same group again: up to ~20 redundant full-group passes for a 10,000-member group, although the running re-sum had already read the corrected nets. recordNetsFor() now reads through a walker with no corrections listener (the correction is still persisted; only the signal is dropped), and the CutoverUiSource contract says so. Corrections reported by other walkers while a re-sum runs are still coalesced by group id (MixingResumQueue): at most one more pass, never one per batch. Tests: a 10,000-member group whose reads each report their page as corrected costs exactly two passes (40 reads), one write, then settles; a walker without the listener still persists the correction once. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(history): treat SDK store stubs as absent in the Mixing group re-sum A TXO-parent stub (L1TxUiRecord.isStoreStub: zero timestamp, zero net, no transaction data) was returned by recordNetsFor as a member net, so tallyMixingGroup counted the member as present and the all-members-present guard passed with a placeholder zero: a cached -300 (-100 + -200) became -100 when one member was real and the other still a stub. The member nets now go through a pure mixingMemberNets helper that drops stubs, exactly like a txid the store does not hold. The group keeps its cached total until the stub becomes its real transaction, then re-sums. Regression: one real member + one stub keeps the cached total; replacing the stub with its real record re-sums the group to the full value. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Minor CrowdNode-related fixes and a couple of other low-hanging stuff.
Issue being fixed or feature implemented
Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist: