Repository navigation
Conversation
|
@jvsena42 please resolve conflicts. |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Derives the Paykit Server account xpub from the mnemonic through bitkit-core instead of the node, makes tracking a no-op when there is no node, and falls back to building without configured accounts when ldk-node rejects one. Reviewed d26fb81, full tier, static.
What I checked, and 5 candidates I ruled out
Build: not built here. iOS does not build on Linux, so this review is reasoned from the code and the pinned dependencies.
Read: the whole diff of LightningService.swift (setup, buildAcceptingPaykitServerAccounts, exportWatchOnlyAccountXpub, setWatchOnlyAccountTracking, reconcileWatchOnlyAccountTracking, sync) and WatchOnlyAccountService.swift (accountXpub(fromDescriptor:network:), the base58 encoder, prepareUnsignedClaim, beginSetupAuthorization and its rollbacks); both test files.
Dependency contract: ldk-node 0.7.0-rc.81 (366d56e) derives m/purpose'/coin'/account' with Xpriv::new_master(config.network), so test networks serialize as tpub, and validate_configured_onchain_wallet_accounts and add_onchain_wallet_account compare the string exactly. bitkit-core 0.8.0-rc15 (045c7ff) uses the same coin type (0 on bitcoin, 1 otherwise) and forces NetworkKind::Main, which is what the re-encode undoes.
Vectors: re-derived all four test xpubs from the BIP39 seed with an independent BIP32 implementation. All four match.
CI: no checks have reported on d26fb81 yet.
Ruled out
- Approval lands while the node is being built, so the account is in neither the build config nor the node: the node is nil, so tracking returns after the store is persisted, and
reconcileWatchOnlyAccountsafternode.start()adds it from the store. Both run underlifecycleCoordinator. - Different seed from the node: both read
bip39Mnemonicandbip39PassphraseforcurrentWalletIndex, with the same empty-to-nil normalisation, andprepareUnsignedClaimrecords that same index. - The fallback build retries side effects of the failed one: in
build_with_store_internal, account validation runs before the channel data migration is applied, so the first attempt fails before writing it. - The fallback hides a bad seed:
InvalidSeedBytesfrom the seed itself fails again on the retry with no accounts, so the error still surfaces, one build later. - One rejected account blocks sync or the other accounts:
syncnow logs the reconcile error, and the per-account loop keeps going and rethrows the first failure, so the next sync retries it.
Merge confidence: 4/5, no findings but not built here, and no CI result on this head yet.
d26fb81 to
f8c8999
Compare
|
Conflicts resolved in f8c8999: rebased onto master (be55060). The only conflict was the |
|
In 3.2.0: twin of synonymdev/bitkit-android#2006, which fixes a 3.1.1 Pubky auth approval failure; both ship together. |
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: full PR diff against its merge base, at f8c8999.
No new actionable code findings.
No actionable code findings. A watch-only Paykit Server approval can finish before the node exists: the account xpub is derived from that wallet's mnemonic at m/84'/coin'/account', test networks are re-encoded as tpub so the string matches ldk-node 0.7.0-rc.81 (366d56ef), and the store records tracking until start reconciles it. InvalidSeedBytes from a configured account is raised before channel migration or wallet writes; the retry builds without those accounts, and a bad seed fails that second build as well. One rejected account is logged and does not stop the other accounts or wallet sync. Cancel and tracking rollback use the same lifecycle lock as reconcile. The conflict noted on d26fb81 is resolved on this head; GitHub reports no merge conflicts.
Compared with bitkit-android#2006 at 54185b8 for this flow only. Derivation, version bytes, store-only tracking, the build fallback, per-account reconcile, and sync match. iOS keeps the node running in the background, so J1 approves on a cold start (approval-before-node-starts.xml). Android's matching journey approves while the node is stopped or rebuilding; the Android journeys README records that difference.
Device testing: not performed in this review. This environment cannot run the iOS unit suite or J1. The author reports WatchOnlyAccountServiceTests, LightningServiceConfigTests, LightningServiceTests, and RetiredElectrumServerTests passed on f8c8999 (62 tests, 0 failures). A local base58check check of the published BIP84 account-0 vector matched the test's tpub. The unit tests do not construct a real node, so they do not cover sync() continuing after a reconcile failure.
Ready for device testing. J1 still needs the integration fixture in journeys/pubky-marketplace/README.md.
Suggested additional test cases
- iOS, isolated wallet with a BIP39 passphrase and a Pubky identity. Cold-start from a fresh
bitkit://pubky-auth/setupURL withx-bitkit-claim=watch-only-account-v1, and authorize before the log shows "Node started". Expected: the success screen appears with no wallet error, and after sync the log shows that account index loaded and no "Provided xpub does not match the node's master seed". - iOS, same wallet, with one stored watch-only account whose xpub does not match the seed and one whose xpub does. Launch and let startup sync finish. Expected: the wallet logs "Node started" and completes sync, the matching account is loaded, and the mismatched account does not block sync.
Reviewer model: grok-4.7
Reasoning effort: xhigh
There was a problem hiding this comment.
Verdict: ✅ Approve
Findings: 2 low
Bitkit/Services/LightningService.swift:662A canceled refresh can still queue a full wallet sync after reconciliation throwsCancellationError.journeys/pubky-marketplace/approval-before-node-starts.xml:13The startup log appears after the node is running. Hold setup through the first Authorize so J1 proves approval with no node.
QA for f8c8999:
iPhone 17 Pro simulators on iOS 26.5 for the approvals and iOS 27.0 for the startup retry.
Approve a Paykit Server account before the Lightning node starts ✅ J1 completed on the first Authorize while node setup was held.
Paykit Server reported completion during the hold. After release, device logs confirmed LDK loaded account 1 and the Server Accounts snapshot showed one new account with tracking on.
J1-cold-start-approval.2x.mp4
Start and sync with a rejected Paykit Server account ✅ The wallet opened and synced with a mismatched account stored.
On the unmodified build, device logs showed the build retry, rejection of account 1, registration of valid account 2, and wallet sync completing after the reconciliation error.
R1-rejected-account.2x.mp4
Approve a Paykit Server account from a passphrase wallet ✅ The first Authorize completed before a node existed.
Paykit Server reported completion for a wallet created with a non-empty BIP39 passphrase. After release, device logs confirmed LDK loaded account 1 and synced. The Server Accounts snapshot showed tracking on.
R2-passphrase-approval.2x.mp4
J1 and the passphrase case used a debug-only hold before LDK construction. The rejected-account and passphrase cases follow the QA review suggestions.
The full review covered seven files in be55060…f8c8999. Cancellation and pending account unloads received code review. The unit tests and integration tests passed on this head.
Twin behavior matches synonymdev/bitkit-android#2006. The iOS journey drives a cold start and the Android journey drives a background restart.
Reviewed by gpt-6.2-sol-high
piotr-iohk
left a comment
There was a problem hiding this comment.
Approving at f8c8999. I tested Bitkit 3.1.1 (204) on an iPhone 17 simulator running iOS 27.2, using Bitcoin regtest, a local Pubky testnet, and Paykit Server v0.1.1-rc4.
- J1 — cold-start authorization passed. A 23-second simulator fixture held node setup while I opened a fresh request on a passphrase-protected wallet. The first Authorize tap succeeded. Paykit Server confirmed setup at 13:47:41.253 UTC, before node construction began at 13:47:58.234 UTC. The node then loaded account 1 and synced. Settings showed exactly one tracked account,
paykit account, atm/84'/1'/1'. This run exercised the timing condition raised in the journey instructions thread. - R1 — recovery with a mismatched account passed. On the same wallet, startup retried, loaded matching account 1, rejected account 2, and completed sync. A complementary real-node test reversed the order and verified that account 2 still loaded and synced after account 1 was rejected.
- XCTest passed 63/63. All 62 tests across the four focused repository suites passed, plus the real-node recovery check. The PR’s E2E job also passed.
Cancellation while a wallet refresh waits for reconciliation remains unverified by this run. The cancellation finding is still open.
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: changes since f8c8999, including affected code paths and prior findings, at 282b5b9. Baseline: previous QA review. This pass re-read the wallet sync path, the new LightningServiceConfigTests cases and the J1 journey step. Coverage of the other surfaces is inherited from the baseline: xpub derivation without the node, store-only tracking and rollback, the InvalidSeedBytes build fallback, the per-account reconcile loop and start, WatchOnlyAccountServiceTests, the journeys README and the changelog.
No new actionable code findings.
No new actionable code findings in the follow-up.
Cancelled sync. LightningService.reconcileBeforeSync rethrows CancellationError and still logs and continues on any other reconcile error. A cancelled caller waiting on the watch-only lifecycle lock (which throws CancellationError) now stops before node.syncWallets() is queued. A Paykit Server account the node rejects still does not block the wallet sync. The merge base also let cancellation propagate, so nothing regresses against it. Validation: a standalone Swift 5 program that copies the helper and its sync() call site compiled and ran. An account error was logged and the sync continued; a CancellationError propagated. This was a focused language and behavior check, not an app build. The cancellation thread is resolved, and the fix holds at this head.
J1 journey step. The new step requires that the app log has no LDK node setup line when the success screen appears. That line is written only after the node is built and assigned. A run that passes this check therefore shows the approval finished without a built node, which the previous xpub export (it asked the node) could not do. The journey thread stays open: the author is waiting until J1 has been run with the new step.
Android parity. Compared bitkit-android#2006 at ce0fbd9, for this flow only. Its reconcile before sync uses runSuspendCatching, which rethrows CancellationException and logs other errors, so it matches iOS. The matching Android journey step the author mentions came after that pinned revision and was not checked.
Recommended before device testing. Run J1 (approval-before-node-starts.xml) with the new log-order step on this head, then close the open journey thread.
Device testing: not performed in this review. piotr-iohk reports J1 and R1 passing at f8c8999, using a fixture that held node setup. That evidence belongs to the older build, and cancellation was not exercised in it.
Reviewer model: claude-opus-5-5
Reasoning effort: high
There was a problem hiding this comment.
Verdict: ✅ Approve
Findings: 1 low, carried forward
journeys/pubky-marketplace/approval-before-node-starts.xml:16The node becomes available beforeLDK node setupis written. A live log read can miss the marker after an approval used the node. Hold setup through the first successful Authorize or assert node availability directly. Existing thread
QA for 282b5b9:
iPhone 17 Pro simulator on iOS 27.0, Bitcoin regtest, Pubky testnet and Paykit Server v0.1.1-rc4.
Approve a Paykit Server account before the Lightning node starts ✅ The first Authorize succeeded on a passphrase wallet while node setup was held.
Paykit Server confirmed setup during the debug-only hold. The launch log had no setup marker at success. After release, device logs confirmed LDK loaded account 2 and synced. Settings showed one new account with tracking on.
J1-cold-start-approval.2x.mp4
Start and sync with a rejected Paykit Server account ✅ The wallet started and synced with a mismatched account stored.
On the unmodified build, device logs confirmed the build retry, rejection of account 1, registration of valid account 2 and completion of wallet sync after the reconciliation error.
R1-rejected-account.2x.mp4
Stop a cancelled refresh before wallet sync ✅ The focused iOS XCTest suites passed.
XCTest verified that a cancelled lifecycle waiter throws, the reconciliation wrapper propagates cancellation, and ordinary account errors still allow sync to proceed. The sync dispatch follows the throwing call in source. Cancellation was covered by XCTest and source review. Cancellation thread
Reviewed three files in f8c8999…282b5b9 and followed up on both findings from the previous review.
The pair PR synonymdev/bitkit-android#2006 at 5073e29 matches node-independent approval and cancellation handling. Its journey drives a background restart. Android schedules a retry for transient reconciliation errors after wallet sync. iOS retries on the next app-driven sync.
Reviewed by gpt-6.2-sol-high
piotr-iohk
left a comment
There was a problem hiding this comment.
Device QA passed on 282b5b9 using an iPhone 17 simulator on iOS 27.2, Bitcoin regtest, Pubky testnet, and Paykit Server v0.1.1-rc4.
- Cold-start authorization. With node creation held on a passphrase wallet, the first Authorize tap succeeded. Paykit confirmed setup with HTTP 200 while the hold was active, 17.8 seconds before LDK logged node setup. After release, the node loaded account 1 and synced. Settings showed exactly one tracked account.
- Cancelled refresh. A refresh cancelled while waiting on the account lifecycle coordinator exited before wallet sync was dispatched.
- Restored account mismatch. The regtest node excluded the mismatched account at index 1, loaded the matching account at index 2, and completed sync. All 66 focused XCTest cases passed, including the two additional simulator checks.
The journey follow-up remains open so future runs can prove node creation was held through approval. The log marker alone leaves a timing gap.
The post-onboarding HTTP 422 reproduced on both 282b5b9 and f8c8999. Bitkit showed success, but Paykit failed during publication after the homeserver returned HTTP 423 for the shared-state lock. Retrying the same setup 70 seconds later still returned 422. This failure is tracked separately in paykit-server#146.
Pull request was converted to draft
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: changes since 282b5b9, including affected code paths and prior findings, at 61b4c4b. Baseline: previous QA review. This pass inspected the new no-node log, the approval callers through the success screen, and the J1 step. Coverage of xpub derivation, store-only tracking and rollback, the InvalidSeedBytes build fallback, per-account reconcile and start, sync cancellation, and the unchanged tests, README, and changelog is inherited from that baseline.
No new actionable code findings.
No new actionable code findings in the follow-up.
setWatchOnlyAccountTracking logs Paykit Server account <index> tracking stored without a node only when node is nil, and it returns before the LDK queue. The success screen is set only after approveAuthRequest returns, so a successful approval whose log contains that line took the no-node branch before success. A missing line stays inconclusive. The session file write is still asynchronous; the same call also prints the line before it returns, so the previous false pass (no LDK node setup marker yet, after configuredNode was already assigned) does not remain. The journey thread is still open: the author left it open until J1 is driven with this line. The cancellation thread is resolved, and that sync path is unchanged on this head.
Compared bitkit-android#2006 at 09418d2 for this log and journey step only. The message matches WatchOnlyAccountRepo. Android's journey is a background restart and names that type; iOS stays a cold start. Android also logs if the node disappears while the call is queued; iOS logs on the nil check before the queue, which is the cold-start path. This is not a review of the Android PR.
Device testing: not performed in this review. J1 has not been run against the new line. piotr-iohk's J1 passes at f8c8999 and 282b5b9 used a debug hold and do not cover this assertion. The author reports LightningServiceConfigTests and WatchOnlyAccountServiceTests passed on this commit (48 tests); this review did not run them. J1 still needs the fixture in journeys/pubky-marketplace/README.md.
Reviewer model: grok-4.7
Reasoning effort: xhigh
There was a problem hiding this comment.
Verdict: ✅ Approve
Findings: 1 low, carried forward
journeys/pubky-marketplace/approval-before-node-starts.xml:16The new marker proves tracking saw no configured node. Claim delivery and account activation still follow it, so startup reconciliation can run before the success screen and the written journey can still pass. Existing thread
QA for 61b4c4b:
iPhone 17 Pro simulator on iOS 27.0, Bitcoin regtest, Pubky testnet and Paykit Server v0.1.1-rc4.
Approve a Paykit Server account before the Lightning node starts ✅ J1 succeeded on the first Authorize while startup was held.
The unmodified build showed authorization success on a passphrase wallet. Device logs confirmed the new marker for account 1, and Paykit Server reported setup complete with the startup lock still held. After release, device logs confirmed LDK loaded account 1 and synced. Settings showed one new paykit account with tracking on.
J1-cold-start-approval.2x.mp4
Rejected-account recovery and refresh cancellation were verified at 282b5b9. The code those cases exercise is unchanged in this delta. Prior QA
The GitHub integration job stopped before running its suite because the requested simulator was unavailable. Integration job
Reviewed the two-file delta and followed up on the open J1 thread. 282b5b9…61b4c4b
The Android twin has the same tracking marker. Its journey exercises a background restart, while the iOS journey exercises a cold start. synonymdev/bitkit-android#2006
Reviewed by gpt-6.2-sol-high
|
@jvsena42 please resolve conflicts. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pull request was converted to draft
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61b4c4b to
1218698
Compare
|
Rebased on master in 1218698 (conflict in |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryLets Pubky watch-only account approvals finish before the Lightning node is built.
No actionable issues were found. Tests and the journey were not run during this review. Acknowledged by Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User approves Pubky request] --> B[Derive account key from mnemonic]
B --> C{Node exists?}
C -->|No| D[Save account tracking]
C -->|Yes| E[Add account to node and save tracking]
D --> F[Node starts]
F --> G[Read stored accounts and add missing accounts]
E --> H[Complete approval]
D --> H
G --> I[Sync wallet]
Reviews (1) · Last reviewed commit: "docs: hold node setup through approval i..." · Reviewed by Greptile |
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: full PR at 1218698, re-reviewed after the comparison base moved to d9cf874 and master changed LightningService.swift. No coverage was carried over from earlier reviews.
No new actionable code findings.
No actionable code findings.
- Xpub without the node. The xpub is now derived from the wallet mnemonic through bitkit-core instead of the node. bitkit-core
0.8.0-rc15(045c7ff) and ldk-node0.7.0-rc.81(366d56e) use the same seed, passphrase andm/84'/coin'/account'path, with coin type 0 on Bitcoin and 1 elsewhere. bitkit-core always writes mainnet version bytes, and ldk-node compares the account xpub as an exact string. Re-encoding the key astpubon test networks therefore gives the string ldk-node expects. I re-encoded the BIP84 account-0 test vector with an independent Python base58check and it matched the expectedtpub. - Build fallback. ldk-node checks configured accounts (
validate_configured_onchain_wallet_accounts) before any store write or channel migration. Retrying the build without accounts afterInvalidSeedBytestherefore repeats only the LNURL-auth and VSS client setup. A genuinely bad seed fails the second build too. - Tracking stored without a node. Every caller of
setWatchOnlyAccountTrackingwas traced: approval, cancel, rollback and the Settings toggle. Each one runs under the watch-only lifecycle lock, and the reconcile instart()andsync()takes the same lock. The setup race was also checked: setup reads the account list before the node is assigned. If an approval, cancel or disable lands in that gap, the reconcile on start adds or removes the account. Accounts that are managed but no longer wanted are removed. - Sync and per-account reconcile. A failed account load no longer stops the wallet sync, while cancellation still stops it (
LightningService.swift:379-385). One rejected account no longer blocks the others. Pending removals stay pending until a reconcile fully succeeds. - Deeplink.
bitkit://pubky-auth/setupdoes not wait for the Lightning node, so the cold-start window this PR targets can be reached.
Existing review threads. The cancellation thread is resolved, and the fix holds at this head. The journey timing thread is still open. At this head J1 holds node setup through the success screen and the fixture's completion report by stalling VSS, which is what the thread asked for. No run of this new J1 version is attributed to this head; earlier J1 runs were done by other reviewers at f8c8999, 282b5b9 and 61b4c4b with a debug-only hold. ldk-node's VSS retry policy at 366d56e stops after about 180 seconds in total. A longer hold can therefore end in a failed node start rather than a held one.
Android parity. Compared with bitkit-android#2006 at 3ccc243 for this flow only. These match: derivation and tpub re-encoding, tracking stored without a node plus its log marker, the InvalidSeedBytes build fallback, the per-account reconcile, and sync continuing after an account error. One difference, non-blocking: after a transient reconcile failure in sync, Android retries every 15 seconds, while iOS waits for the next sync. No defect was demonstrated; the only effect is that tracking starts later.
Validation. This was source analysis plus dependency source fetched at the pinned revisions. I did not build iOS or run the iOS tests here. At this head, Run Tests, Run Integration Tests and build-local were still pending; SwiftFormat passed. New unit tests cover the build fallback, reconcileBeforeSync and the descriptor-to-xpub codec, including real bitkit-core derivation. No unit test covers setWatchOnlyAccountTracking without a node, the per-account reconcile loop, or sync continuing after a reconcile failure; the last two need a real ldk-node Node.
Device testing: not performed in this review.
Suggested additional test cases
- iOS, J1 setup with the VSS hold: finish Approve and Authorize, then check the fixture, within about 2 minutes of launch. Expected: the
tracking stored without a nodeline, success, and noLDK node setupline. After releasing the hold, the node starts without a manual relaunch and loads the account. If the hold runs past ldk-node's VSS retry budget, note whether the wallet shows a node start error and needs a restart. - iOS, Settings, node stopped or not yet built: turn off tracking for an active Paykit Server account. Expected: no error toast, the toggle stays off, and after the node starts the account is no longer listed by the node.
Reviewer model: claude-opus-5-5
Reasoning effort: high
There was a problem hiding this comment.
Verdict: ✅ Approve
Findings: None. The VSS hold added to J1 addresses the existing timing finding.
QA for 1218698:
iPhone 17 Pro simulator on iOS 27.0, Bitcoin regtest, Pubky testnet and Paykit Server v0.1.1-rc4.
Approve a Paykit Server account before the Lightning node starts ✅ J1 completed on the first Authorize with VSS reads held.
On the unmodified build with a BIP39 passphrase, the success screen appeared and Paykit Server reported setup complete while VSS reads remained held. The proxy confirmed blocked reads; device logs showed the account-1 no-node marker and no node-setup marker before release. After release, device logs confirmed account 1 loaded and wallet sync completed. Settings snapshots showed exactly one new paykit account at m/84'/1'/1' with tracking on.
J1-approval.2x.mp4
Start and sync with a rejected Paykit Server account ✅ The wallet started and synced despite a mismatched stored account.
On the unmodified build, device logs confirmed the fallback build, loading valid account 1, rejection of mismatched account 2, and wallet sync completing after the reconciliation error.
R1-recovery.2x.mp4
Derive account keys and preserve startup recovery and cancellation ✅ Focused XCTest passed.
XCTest checked real bitkit-core derivation and network version bytes, build retry boundaries, cancellation propagation and lifecycle waiters. It also covered the rebased node stop helpers. This is automated coverage; cancellation was not driven through the UI.
Disable account tracking before the Lightning node starts ✅ Turning tracking off completed while VSS reads were held.
The Settings toggle changed to off without an error while node construction was blocked. It remained off after release and wallet sync. Device logs showed the no-node branch during the toggle. The build had already read its account configuration, so it loaded account 1 and startup reconciliation removed it before Node started; wallet sync then completed.
S1-tracking.2x.mp4
Tracking after startup and sync:
The added Settings case follows the current-head QA suggestion. J1's hold was released within the VSS retry budget.
Re-reviewed the full seven-file PR diff after the rebase broke ancestry with 61b4c4b. The auth patches are preserved; the conflict retains both the account-build fallback and serialized restart. J1 drives the revised hold through approval and fixture completion. Codec and cancellation variants received XCTest and source review. The full unit and integration suites were not rerun locally; their GitHub jobs are still running.
Twin synonymdev/bitkit-android#2006 at 3ccc243 has the same VSS hold. iOS drives a cold start; Android drives a background restart. Android retries transient account reconciliation separately; iOS retries on its next app-driven sync.
Reviewed by gpt-6.1-sol-high
Twin: synonymdev/bitkit-android#2006
This PR lets a Pubky auth request that shares a Bitcoin watch-only account complete without the LDK node, matching synonymdev/bitkit-android#2006.
On Android the reported failure ("The wallet must be running before an account can be created") came from the node restarting on every trip to the browser. iOS keeps the node running in the background, so it does not hit that path. The same dependency remains, though:
exportWatchOnlyAccountXpubandsetWatchOnlyAccountTrackingthrownodeNotSetupwithout a node. That fails an approval that arrives on a cold start before the node is built, or after a failed node start. Related: pubky/paykit-server#146, pubky/pubky-marketplace#567.Description
LightningService.exportWatchOnlyAccountXpub: derives them/84'/coin'/account'xpub from the mnemonic through bitkit-core'sderiveOnchainDescriptorinstead ofNode.exportOnchainWalletAccountXpub.WatchOnlyAccountClaimCodec.accountXpub(fromDescriptor:network:): reads the xpub out of the descriptor and re-encodes it withtpubversion bytes on test networks. bitkit-core always uses mainnet bytes, whileNode.addOnchainWalletAccountcompares against ldk-node's network-specific string.LightningService.setWatchOnlyAccountTracking: returns without error when there is no node, so onlyWatchOnlyAccountManager's store changes. The next build loads tracked accounts from the store, andreconcileWatchOnlyAccountson start adds or removes any it missed.LightningService.buildAcceptingPaykitServerAccounts: an account stored without the node never had its xpub checked by ldk-node, and ldk-node fails the whole build withInvalidSeedByteswhen a configured account's xpub does not match the seed. On that error, with accounts configured, the node is built once more without them so the wallet still starts; the reconcile on start adds each account the node accepts. ldk-node runs that check before any store write or channel migration, so the retry repeats only the LNURL-auth token fetch and idempotent VSS setup.LightningService.reconcileWatchOnlyAccountTracking: tries every account, logs each one the node rejects and rethrows the first failure, so one bad account does not keep the others from loading. Pending removals stay pending until a reconcile fully succeeds, as before.LightningService.sync: a reconcile failure is logged and no longer stops the wallet sync (reconcileBeforeSync); a cancelled caller still stops before the wallet sync.LightningService.starthas no counterpart here.Out of Scope
WatchOnlyAccountManager: accounts left behind when Bitkit approved but Paykit Server failed the setup. Bitkit cannot tell that apart from success; Setup returns 422 for a creator the server already holds; /complete hangs past the gateway (504) pubky/paykit-server#146 covers the server side.Design
N/A — no UI changes.
Preview
N/A
QA Notes
Setup
Integration fixture runtime from
journeys/pubky-marketplace/README.md(Pubky testnet, Paykit Server, regtest), a Debug build of this branch on a simulator, an isolated wallet with a Pubky identity, and a freshbitkit://pubky-auth/setupURL withx-bitkit-claim=watch-only-account-v1.Journeys
approval-before-node-starts.xml— a watch-only setup approved on a cold start before the node starts completes on the first Authorize and the account is tracked once the node startsManual Tests
N/A
Automated Checks
LightningServiceConfigTests.swift— reconciliation before sync continues after an account error and stops on cancellation; the build retries without Paykit Server accounts onInvalidSeedBytes, and does not retry when no account is configured or on another build errorWatchOnlyAccountServiceTests.swift— the descriptor's xpub keeps mainnet bytes on Bitcoin and getstpubbytes on regtest and testnet; a descriptor without an xpub is rejected; bitkit-core's real derivation equals the BIP84 mainnet vector and independently derivedm/84'/0'/1'(mainnet) andm/84'/1'/1'(regtest) account xpubsEvidence
1218698, iPhone 17 simulator: rebased on master (conflict inLightningService.swiftonly, both sides kept). Build plusLightningServiceConfigTests,WatchOnlyAccountServiceTests,LightningServiceTestsandRetiredElectrumServerTestspassed (67 tests). J1 now holds node setup by stalling the fixture's VSS endpoint through the success screen and fixture completion, then releases it.61b4c4b, iPhone 17 simulator: build,LightningServiceConfigTestsandWatchOnlyAccountServiceTestspassed (48 tests), swiftformat clean.setWatchOnlyAccountTrackinglogsPaykit Server account N tracking stored without a nodewhen it finds no node, and J1 asserts that line instead of the absence ofLDK node setup(ovi-reviewer and piotr-iohk: the marker is written afterconfiguredNodeis assigned, through an async logger).282b5b9, iPhone 17 simulator:WatchOnlyAccountServiceTests,LightningServiceConfigTests,LightningServiceTestsandRetiredElectrumServerTestspassed (64 tests).testReconcileBeforeSyncStopsWhenCancelledfailed with the cancellation catch removed. J1 now requires the approval to finish beforeLDK node setupappears in the log (ovi-reviewer's journey finding).f8c8999(rebased onto masterbe55060), iPhone 17 simulator:WatchOnlyAccountServiceTests,LightningServiceConfigTests,LightningServiceTestsandRetiredElectrumServerTestspassed (62 tests, 0 failures). Master'sUsing Electrum serverlog line moved inside the new builder closure.d26fb81, iPhone 17 simulator: unit suite with the CI selection passed (4172 tests, 5 skipped, 0 failures), including the 3 build-fallback cases. SwiftFormat lint passed.d26fb81): no blocking findings. It traced ldk-node's build order to confirm the retry is safe and that accounts left out of a fallback build keep their persisted wallet and are reloaded byaddOnchainWalletAccount.0e66204, iPhone 17 simulator:WatchOnlyAccountServiceTestspassed (40 tests) after pinning the mainnet core test to account 1 and adding the node-load check to the journey.start()andsync(), and that the new code compiles into the notification extension target (not built locally). Its journey and test findings are fixed in0e66204.8ab7489, local macOS, iPhone 17 simulator: the unit suite with the CI selection fromunit-tests.ymlpassed (4169 tests, 5 skipped, 0 failures), including the 5 new cases. SwiftFormat lint passed on the changed files.Gaps
sync()continuing after a reconcile failure or the per-account reconcile: both need a real ldk-nodeNode.bitkit-dockermarketplace fixture was not set up.Models used
Claude Opus 5.5(reasoning:Not exposed)Claude Opus 5.5(reasoning:Not exposed)Claude Opus 5.5(reasoning:Not exposed)🤖 Generated with Claude Code
Closes #1404