Skip to content

Conversation

@txalkan
Copy link

@txalkan txalkan commented Jan 19, 2026

This PR adds support for HODL invoices to the RGB Lightning Node per the #50 issue.

The main functional addition is the ability to create and manage HODL invoices, requiring updates across the API, core logic, error handling, persistence layer, and a new test suite. Incoming HTLCs are held and only settled or cancelled explicitly.

  • Primary API additions include: /invoice/hodl, /invoice/settle, and /invoice/cancel.

Other adjustments to workflows and documentation ensure the feature is well integrated.

  • src/routes.rs added new routes to create HODL invoices, settle or cancel them. It includes request validation and JSON responses that comply with the updated OpenAPI spec. Wired the new routes into src/main.rs.
  • src/ldk.rs upgraded how relevant events are processed. This includes new handlers for holding and settling payments, and updates to invoice retrieval and status checks.
  • src/test/hodl_invoice.rs is a comprehensive test suite verifying HODL invoice creation, payment flows, and settlement/cancellation scenarios.

More information and diagrams to support advanced flows such as submarine swaps are documented in: feat_hodl_invoice_v0.1.pdf.

A working submarine swap PoC (from Signet to Regtest) is available at https://github.com/UTEXO-Protocol/thunder-swap.

Copy link
Member

@zoedberg zoedberg left a comment

Choose a reason for hiding this comment

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

Thank you!

This is just a first review, will do a more detailed one after these changes are addressed:

  • revert changes to the github workflows
  • keep a single signed commit called add support for HODL invoices
  • drop nix/flake related files
  • drop changes to regtest.sh (shouldn't be necessary) or explain why they are necessary
  • rename APIs as requested in the initial google doc shared at the beginning of the task
  • please keep alphabetical order (in README, openapi.yaml, main.rs and routes.rs)
  • drop HODL Invoices explanation from the README, let's keep API documentation in the openapi.yaml (consise doc is preferred)
  • in openapi.yaml use the same syntax we used for other objects (in required for example)
  • drop docstrings from route methods (all other methods do not have it) and keep doc in openapi.yaml
  • in src/test/hodl_invoice.rs move imports to src/test/mod.rs
  • in src/test/hodl_invoice.rs please cleanup the code, keep the API calls logic in the mod.rs file (as we did for all other tests), avoid methods that are called only once and repeating utility methods that are already defined in the mod.rs file
  • in src/utils.rs keep methods only if used more than once

@txalkan
Copy link
Author

txalkan commented Jan 22, 2026

  • drop changes to regtest.sh (shouldn't be necessary) or explain why they are necessary

It waits for the Bitcoin RPC to be fully ready, preventing race conditions previously observed where Electrs or other services started too early and failed intermittently.

The rest I believe has been addressed, let me know.

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.

2 participants