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

fix(handle payment request): lowercase bolt11 invoice #198

Merged
merged 1 commit into from
Dec 21, 2023
Merged

fix(handle payment request): lowercase bolt11 invoice #198

merged 1 commit into from
Dec 21, 2023

Conversation

R3DRUN3
Copy link
Contributor

@R3DRUN3 R3DRUN3 commented Dec 20, 2023

This PR closes #184.
The problem lies in this code block of the decode.go file in the zpay32 package of lnd:

if !strings.HasPrefix(hrp[2:], expectedPrefix) {
	return nil, fmt.Errorf(
	"invoice not for current active network '%s'", net.Name)
}

Submitting an uppercase Bolt11 invoice sets the condition to always be false and triggers that error.
The associated commit in this pull request enforces the lowercase conversion of the invoice before all the processing take place, thereby eliminating the problem at its root.

I have tested it using go test, and the issue does not arise when hardcoding an uppercase invoice in service_test.go

Signed-off-by: r3drun3 <simone.ragonesi@sighup.io>
Copy link
Contributor

@rolznz rolznz left a comment

Choose a reason for hiding this comment

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

utACK

Thanks @R3DRUN3 !

@rolznz rolznz merged commit e3642fd into getAlby:main Dec 21, 2023
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.

Uppercase invoices fail to get decoded
2 participants