Feat/light mode runtime sync intervals #30
+667
−168
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.
Summary
This PR adds two major features for mobile optimization:
Mobile Developer Usage
Android: Battery Saving for Foreground Service
When your app goes to background and only the foreground service keeps the node alive:
The
batterySavingSyncIntervals()preset uses longer intervals:iOS: Notification Service Extension (25MB Limit)
For iOS NSE to receive payments while staying under Apple's ~24MB memory limit, use light mode minimal:
What
setLightModeMinimal()enables:single_threaded_runtime: truedisable_listening: truedisable_peer_reconnection: truedisable_node_announcements: truedisable_rgs_sync: truedisable_pathfinding_scores_sync: truedisable_liquidity_handler: trueThe node can still:
node.connect()node.syncWallets()Important: If
backgroundSyncConfigis set tonilat build time, wallet sync intervals (onchainWalletSyncIntervalSecs,lightningWalletSyncIntervalSecs,feeRateCacheUpdateIntervalSecs) cannot be updated at runtime viaupdateSyncIntervals(). The other intervals (peer reconnection, RGS, pathfinding scores, node announcements) will still update. For iOS NSE, this is the recommended approach since you'll callsyncWallets()manually and the extension is short-lived.Recommended iOS NSE flow:
Changes
Test Plan