Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change short_channel_id to string #1082

Merged
merged 2 commits into from
Sep 11, 2024
Merged

Change short_channel_id to string #1082

merged 2 commits into from
Sep 11, 2024

Conversation

dangeross
Copy link
Collaborator

This PR changes the short_channel_id of the RouteHintHop model to string in the format:

<BLOCK_HEIGHT>x<TX_INDEX>x<OUTPUT_INDEX>

@@ -61,7 +61,7 @@ impl From<BoltzRouteHintHop> for RouteHintHop {
fn from(value: BoltzRouteHintHop) -> Self {
RouteHintHop {
src_node_id: value.node_id,
short_channel_id: 0_u64,
short_channel_id: "0".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
short_channel_id: "0".to_string(),
short_channel_id: "0x0x0".to_string(),

fn parse_short_channel_id(id_str: &str) -> InvoiceResult<u64> {
let parts: Vec<&str> = id_str.split('x').collect();
if parts.len() != 3 {
return Ok(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this was already there, but shouldn't this return an error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed to throw an error, also added some tests

Copy link
Contributor

@JssDWt JssDWt left a comment

Choose a reason for hiding this comment

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

LGTM

@dangeross dangeross merged commit 6b3d705 into main Sep 11, 2024
9 checks passed
@dangeross dangeross deleted the savage-short-channel-id branch September 11, 2024 10:17
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.

3 participants