fix(receive): handle additional receive liquidity edge cases - #1222
fix(receive): handle additional receive liquidity edge cases#1222pwltr wants to merge 3 commits into
Conversation
b894427 to
53e0156
Compare
53e0156 to
314445d
Compare
Greptile SummaryThis PR centralizes receive-liquidity decisions and updates invoice creation, CJIT limits, receive navigation, session reset behavior, and receive-detail presentation.
Confidence Score: 4/5The PR should not merge until the CJIT maximum is derived from current Blocktank options rather than potentially stale cached limits. A previously populated Blocktank info object bypasses refresh during maximum calculation, so the receive flow can enforce an outdated channel-size limit and repeat it after a server rejection. Files Needing Attention: app/src/main/java/to/bitkit/repositories/BlocktankRepo.kt
|
| Filename | Overview |
|---|---|
| app/src/main/java/to/bitkit/models/ReceiveLiquidityDecision.kt | Adds a pure, tested decision model for ordinary Lightning invoices and source-aware additional-liquidity routing. |
| app/src/main/java/to/bitkit/repositories/BlocktankRepo.kt | Adds channel-size validation and maximum-CJIT calculation, but derives the maximum from potentially stale cached Blocktank options. |
| app/src/main/java/to/bitkit/repositories/WalletRepo.kt | Gates invoice generation and channel-event refreshes on ready-channel inbound capacity. |
| app/src/main/java/to/bitkit/ui/screens/wallets/receive/EditInvoiceVM.kt | Coordinates source-specific liquidity decisions and Blocktank limit lookup for edited receive amounts. |
| app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveAmountScreen.kt | Adds maximum CJIT validation, input clamping, and dedicated maximum-exceeded feedback. |
| app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveQrScreen.kt | Updates receive-tab availability, fallback selection, and details layout according to Lightning receive capability. |
| app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveSheet.kt | Tracks the edit source and routes initial versus additional CJIT flows to their corresponding confirmation screens. |
| app/src/main/java/to/bitkit/ui/ContentView.kt | Keys each receive-sheet instance so remembered navigation and CJIT state reset on close and reopen. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Edit receive amount] --> B{Selected source}
B -->|Savings or Auto| C[Update shared receive invoice]
B -->|Spending| D{Amount exceeds inbound liquidity?}
D -->|No| C
D -->|Yes| E{Geo-blocked?}
E -->|Yes| F[Geo-block screen]
E -->|No| G{Within current CJIT limits?}
G -->|No| H[CJIT amount entry]
G -->|Yes| I[Create additional CJIT]
I --> J[Additional-liquidity confirmation]
H --> J
Reviews (1): Last reviewed commit: "fix(receive): handle additional receive ..." | Re-trigger Greptile
ovitrif
left a comment
There was a problem hiding this comment.
QA Notes
Pixel_8_Pro emulator (sdk_gphone16k_arm64), regtest via network Electrum/Blocktank.
- Savings edit above inbound stayed on the on-chain QR and did not route to CJIT.
- Auto edit above inbound fell back to Savings/on-chain QR.
- Spending edit below the CJIT minimum routed to CJIT amount entry.
- Spending edit with a valid additional-CJIT amount opened confirmation.
- Spending edit above the real CJIT maximum stayed on amount entry and clamped to max.
- Receive sheet close/reopen started fresh on Auto.
- Auto details showed both on-chain and Lightning copy cards.
Approve.
Description
Ports the receive liquidity/CJIT behavior from bitkit-ios synonymdev/bitkit-ios#711.
ReceiveLiquidityDecisionhelper for Lightning invoice vs additional CJIT routing.Preview
Screen.Recording.2026-09-03.at.12.35.19.mov
QA Notes
Manual checks:
Automated checks:
ReceiveLiquidityDecisionTest.ktReceiveInvoiceUtilsTest.ktEditInvoiceVMTest.kt