This PR addresses a bug introduced when refactoring HODL-related logic (based on workflow from #118 ), where outbound RGB payment validation incorrectly checks both inbound and outbound payment info paths, leading to runtime panics in specific scenarios.
🔍Reproduction Steps
Following the flow from PR #118:
- Set up node and channels per documentation
- Initiate an outbound RGB payment via
/sendpayment
- At step 3, the node panics with:
INFO request{uri=/sendpayment request_id=...}: rgb_lightning_node: STARTED
thread 'tokio-rt-worker' panicked at rust-lightning/lightning/src/rgb_utils/mod.rs:548:51:
valid rgb payment info: Os { code: 2, kind: NotFound, message: "No such file or directory" }
thread 'tokio-rt-worker' panicked at src/utils.rs:318:14:
called `Result::unwrap()` on an `Err` value: RecvError(())
🐛 Root Cause
In [outbound_payment.rs], the helper function is_payment_rgb currently checks both outbound and inbound payment info paths:
pub(crate) fn is_payment_rgb(ldk_data_dir: &Path, payment_hash: &PaymentHash) -> bool {
get_rgb_payment_info_path(payment_hash, ldk_data_dir, false).exists() // outbound
|| get_rgb_payment_info_path(payment_hash, ldk_data_dir, true).exists() // inbound ← unnecessary here
}
For outbound payment flows, only the outbound path (false) should be validated. Including the inbound check (true) causes false negatives when inbound metadata is absent—triggering the panic above.
✅Fix
- Restrict is_payment_rgb usage in outbound contexts to check only the outbound path (
false)
- Add clarifying comments to prevent future misuse
This PR addresses a bug introduced when refactoring HODL-related logic (based on workflow from #118 ), where outbound RGB payment validation incorrectly checks both inbound and outbound payment info paths, leading to runtime panics in specific scenarios.
🔍Reproduction Steps
Following the flow from PR #118:
/sendpayment🐛 Root Cause
In
[outbound_payment.rs], the helper functionis_payment_rgbcurrently checks both outbound and inbound payment info paths:For outbound payment flows, only the outbound path (
false) should be validated. Including the inbound check (true) causes false negatives when inbound metadata is absent—triggering the panic above.✅Fix
false)