Repository navigation
fix(node): share the current accumulator, not the first one dumped - #163
Merged
Merged
Conversation
The "Share validation" card kept the first Utreexo dump in `exportPayload` and handed it out for the rest of the session: Show QR, Copy and Share all returned the accumulator from whenever one of them was first tapped. On a node that had been running for a day the copied payload was 57 blocks behind, so the device importing it started that far back. Dump on every use instead; it only reads the chain state. Copy also wrote `uiState.exportPayload` to the clipboard synchronously, before the asynchronous dump had finished. The first tap showed "Copied to clipboard" without copying anything, and later taps copied the previous payload. The payload now reaches the clipboard through a `NodeEvents.OnCopyAccumulator` event, like Share already does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
jvsena42
enabled auto-merge (rebase)
September 20, 2026 18:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while checking the "Share validation" card on the emulator; independent of the FiltersMan work (#162).
The bug
withExportPayloadkept the first Utreexo dump inexportPayloadand returned it for the rest of the session. Show QR, Copy and Share all handed out the accumulator from whenever one of them was first tapped. On a mainnet node that had been running since the morning, the node was at height 967,875 (3,201,422,762 leaves, 19 roots) while the copied payload decoded to height 967,818 (3,201,204,366 leaves, 16 roots): valid, right network, 57 blocks stale. A device importing it starts that far behind.uiState.exportPayloadto the clipboard synchronously, before the asynchronous dump finished. The first tap showed "Copied to clipboard" and copied nothing; later taps copied the previous payload.The node itself is fine: over RPC the accumulator moves with every validated block (leaf count and all roots change).
The fix
dumpUtreexoStateonly reads the chain state, so there is nothing worth caching;exportPayloadstill holds the latest dump for the QR sheet.NodeEvents.OnCopyAccumulatorevent, the same way Share already works.Tests
NodeViewModelExportTest: two consecutive copies deliver two different dumps, the first copy already carries a payload, and reopening the QR sheet shows a fresh dump. Two of the three fail against the old caching code../gradlew testDebugUnitTest detektpass. Not re-checked on the emulator: the build installed there carries the unmerged node bindings on a throwaway branch.🤖 Generated with Claude Code