Skip to content

Conversation

@pwltr
Copy link
Collaborator

@pwltr pwltr commented Oct 30, 2025

Description

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (improving code without creating new functionality)

Tests

  • Detox test
  • Unit test
  • Manual test
  • No test

@socket-security
Copy link

socket-security bot commented Oct 30, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​synonymdev/​react-native-ldk@​0.0.159 ⏵ 0.0.16379 +210073 +388 +1100

View full report

@jvsena42 jvsena42 requested a review from Copilot October 30, 2025 14:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades react-native-ldk to version 0.0.161 to fix channel persistence issues when remote backup fails, and consolidates LDK debugging functionality by cleaning up the Debug screen interface.

  • Upgrades react-native-ldk from 0.0.159 to 0.0.161
  • Includes channel monitor files (.bin) in log exports from both account root and channels folder
  • Consolidates LDK debug export functionality by removing duplicate "Export Logs" from DevSettings and enhancing LdkDebug screen

Reviewed Changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.

File Description
package.json Updates react-native-ldk dependency to version 0.0.161
src/utils/lightning/logs.ts Adds channel monitor files from channels folder to binary file exports
src/screens/Settings/DevSettings/index.tsx Removes duplicate LDK log export functionality and related imports
src/screens/Settings/DevSettings/LdkDebug.tsx Consolidates export functionality into single "Export Files" button with confirmation dialog

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jvsena42
Copy link
Member

jvsena42 commented Nov 3, 2025

LGTM, except the Copilot comment

Copy link
Contributor

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK.

@ovitrif
Copy link
Contributor

ovitrif commented Nov 3, 2025

Need testing of repro scenario by @catch-21 and/or @piotr-iohk, to validate the fix.

Please reach out to me for info on the repro steps if needed.

@ovitrif
Copy link
Contributor

ovitrif commented Nov 4, 2025

LGTM, except the Copilot comment

@jvsena42 That was false positive, it might affect devs on Windows machines, but most likely not.
Gladly welcoming your PR approval 🙏🏻

@piotr-iohk
Copy link
Collaborator

piotr-iohk commented Nov 4, 2025

QA Notes

Quick summary/observations:

  • I was able to reproduce the issue on master using "Steps to reproduce" using iOS and Android built locally using "Building Notes" (see below)
  • As far as I see, various CI checks failed for the branch fix/backup-client (see: https://github.com/synonymdev/bitkit/actions), not sure why are they not reported on the PR. IMHO they should be executed against the changes. ❌
  • I was NOT able to build fix/backup-client for Android locally (see notes below). I am able to build on master so don't think it is my local setup, but could be. It would be good if someone could verify or give some pointers in case I'm doing something obviously wrong. ❌
  • On positive note: I was able to build on iOS and execute the "Steps to reproduce" successfully. i.e. verifying the fix is working. ✅

Building Notes

Building the iOS and Android apps for regtest in a local simulator.

Clean build for iOS and Android

  • Get the branch with the fix
git fetch && git checkout fix/backup-client
  • Ensure DEFAULT_BITCOIN_NETWORK=bitcoinRegtest in .env.development.template [Note: I think this should be PRed, as it currently contains DEFAULT_BITCOIN_NETWORK=bitcoin so app is built with mainnet addresses]
  • Clean install dependencies:
watchman watch-del-all || true
rm -rf node_modules .yarn/cache
yarn install
  • Start Metro in a separate terminal
yarn start --reset-cache
  • build iOS:
# iOS
cd ios && pod install && cd ..
yarn ios
  • build Android
# Android
cd android && ./gradlew clean && cd ..
yarn android

⚠️ Android build fails for me. Also tried doing "deep clean" build using the script below:

Script
# Kill Metro & Watchman
pkill -f "node.*metro" || true
watchman watch-del-all || true

# Remove JS + Yarn caches
rm -rf node_modules .yarn/cache

# Remove all Android build + Gradle state
cd android
./gradlew --stop || true
rm -rf .gradle .kotlin build app/build

# Remove global Gradle + Kotlin caches
rm -rf ~/.gradle/caches ~/.gradle/daemon ~/.gradle/native ~/.gradle/wrapper ~/.konan

# Back to project root
cd ..

# Reinstall JS dependencies
yarn install

# Clear Metro cache
yarn start --reset-cache & sleep 5 && pkill -f "node.*metro"

# (Optional but good) Clear Bitkit app data from emulator
adb shell pm clear to.bitkit || true

# Rebuild Android
yarn android

Build fail:

e: file:///Users/piotr/code/synonym/bitkit/node_modules/@synonymdev/react-native-ldk/android/src/main/java/com/reactnativeldk/classes/LdkPersister.kt:42:27 Unresolved reference 'reactContext'.
e: file:///Users/piotr/code/synonym/bitkit/node_modules/@synonymdev/react-native-ldk/android/src/main/java/com/reactnativeldk/classes/LdkPersister.kt:78:27 Unresolved reference 'reactContext'.
Note: /Users/piotr/code/synonym/bitkit/node_modules/react-native-screens/android/src/paper/java/com/swmansion/rnscreens/NativeScreensModuleSpec.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details. FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':synonymdev_react-native-ldk:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more details * Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org. BUILD FAILED in 4m 35s.
info Run CLI with --verbose flag for more details.

full-android-build.log

Steps to reproduce

These steps are tailored for macOS. Cover funding a wallet, simulating backup failure, and verifying correct app behavior after the fix.

  1. Fund wallet onchain address (e.g. 200 000 sats)
    (Bitkit-Android/iOS regtest instances can be used for sending, depositing, and mining blocks.)

  2. Block the backup service host

echo "127.0.0.1 bitkit.stag0.blocktank.to" | sudo tee -a /etc/hosts
sudo killall -HUP mDNSResponder
  1. Verify the backup service is blocked:
$ curl -v https://bitkit.stag0.blocktank.to/backups-ldk --max-time 5

Expected:

...
curl: (7) Failed to connect to bitkit.stag0.blocktank.to port 443 after 4 ms: Couldn't connect to server
  1. Transfer funds to open a channel
    Transfer 25% (50 000 sats) to the Spending balance to trigger channel opening.
    Then mine a block.
    Expected:
  • Spending balance = 50 000 sats
  • Channel is opened and usable
    (Settings → Advanced → Lightning connections)
  1. Restart the app.
    Expected:
  • Spending balance = 50 000 sats
  • Channel is opened and usable
    (Settings → Advanced → Lightning connections)

5a. Verify Settings → Dev Settings → LDK → Export Files

  • Ensure alert on exporting: "This export contains sensitive data and gives control over your Lightning funds. Do you want to continue?"
  • Exported files contain *.bin files:
    • channel_manager.bin
    • network_graph.bin
    • <channel_id>.bin (verify with (Settings → Advanced → Lightning connections → Connection 1 > Channel ID ))
  1. Unblock the backup service
sudo sed -i '' '/bitkit.stag0.blocktank.to/d' /etc/hosts
sudo killall -HUP mDNSResponder

Expected:

  • Spending balance remains correct.
  • The channel remains open and usable
    (Settings → Advanced → Lightning connections)
  1. Verify channel usability.
    Send and receive funds via the Lightning channel.
    Expected: all Lightning transactions succeed normally.

@ovitrif
Copy link
Contributor

ovitrif commented Nov 20, 2025

@piotr-iohk Can you try testing the same flow that you did on iOS now on Android?!

Build is working again, just clone locally, then

Run

yarn start
# in another terminal
yarn android

@piotr-iohk
Copy link
Collaborator

@ovitrif I have tested Android and iOS. Both pass. ✔️

I see that e2e-ios has some issues, seems to be hanging on "Run regtest setup" step. The same hosted macOS is used in bitkit-ios with nearly identical instructions for regtest setup and it works fine there. @catch-21 could you take a look when you have a moment? I believe you have access to the machine that runs e2e-ios, so you may be able to spot what's causing the hang.

@ovitrif
Copy link
Contributor

ovitrif commented Nov 21, 2025

@piotr-iohk thank you sir, so from manual testing PoV we're ready for the next step towards releasing this bugfix?

cc. @catch-21

PS. i don't think we should care about the e2e tests of the RN app anymore, it's just a nice to have, but, since we would have to invest time to fix the suite, we're better to use that time for the native app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants