Resume Boltz submarine swaps on 409#75
Draft
andycreed0x wants to merge 1 commit into
Draft
Conversation
Collaborator
Author
|
This was for solving a bug that only happend once:
|
Base automatically changed from
74-add-qr-decode-to-send-pics-to-the-agents-and-it-can-pay-invoices
to
develop
June 4, 2026 02:55
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.
Purpose
Add QR code reading capability (image → decoded string), a
lightning decodeCLI command to inspect BOLT11 invoices without paying them, and automatic recovery when Boltz returns a 409 "swap already exists" error by finding and resuming the existing local swap.Main Changes
src/aqua/qr.py) —decode_qr(image_path)usingzxing-cpp+ Pillow; 5/5 on real phone photos including logo-overlaid QR codesqr_decode— registered intools.py+server.py; returns{"content": "<decoded_string>"}aqua qr decode <image_path>— newcli/qr.pygroup registered incommands.pylightning decodeCLI command —aqua lightning decode --invoice lnbc...shows amount, description, expiry without payinglightning_decode— same capability exposed over MCPsrc/aqua/bolt11.py— new module for BOLT11 protocol parsing (decode_bolt11_amount_sats,decode_bolt11_fields, bech32 tagged-field decoder); moved out ofboltz.pyto remove provider coupling and avoid circular import withlnurl.py_resume_existing_swap()inLightningManager: on duplicate invoice error, finds existing local swap, checks Boltz status, resumes if funded or re-funds if lockup address is storedboltz_lockup_addressfield added toLightningSwapdataclass — persisted at swap creation so unfunded swaps can be re-funded on recoveryStorage.find_lightning_swap_by_invoice()— lookup swap by invoice string for 409 recoveryBoltzSwapAlreadyExistsError— specific exception for Boltz 409 with a dedicated HTTP status mapping; replaces genericRuntimeErrorzxing-cpp>=2.2,pillow>=10.0; removedopencv-python-headless(was 50MB, only needed for imread which Pillow handles)tests/test_qr.py(5 tests),tests/test_cli.pyLightningSwap.from_dict()now defaultsboltz_lockup_address=Nonefor backward compatibility with existing swap files — no migration neededChecklist