Skip to content

Fix payment hash collision in outbound BTC payments - #38

Open
txalkan wants to merge 1 commit into
RGB-Tools:rgbfrom
txalkan:fix/inbound-rgb-outbound-btc-payment-hash-collision
Open

Fix payment hash collision in outbound BTC payments#38
txalkan wants to merge 1 commit into
RGB-Tools:rgbfrom
txalkan:fix/inbound-rgb-outbound-btc-payment-hash-collision

Conversation

@txalkan

@txalkan txalkan commented Aug 25, 2026

Copy link
Copy Markdown

Restrict RGB payment detection to outbound payments.

The helper was renamed from is_payment_rgb to is_payment_rgb_out and now checks only the .outbound RGB metadata file.

The helper is used exclusively by outbound routing code:

  • send_payment_for_bolt12_invoice
  • send_payment_for_non_bolt12_invoice
  • find_route_and_send_payment

No inbound payment handler calls this helper. Previously, the helper checked both .outbound and .inbound. If an inbound RGB payment and an outbound BTC payment reused the same payment hash, the outbound BTC payment could be incorrectly classified as RGB. This caused RGB-specific routing logic to run without outbound RGB metadata, leading to a panic.

The existing regression test use_same_hodl_invoice_hash_for_inbound_rgb_and_outbound_btc, included in RGB-Tools/rgb-lightning-node#91, verifies that an inbound RGB HODL payment and an outbound BTC HODL payment can successfully use the same payment hash.

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.

1 participant