getAlby / nostr-wallet-connect

Nostr Wallet Connect (NIP-47) application to allow apps to connect to your node
https://nwc.getalby.com
Apache License 2.0
103 stars 31 forks source link

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

Closed R3DRUN3 closed 8 months ago

R3DRUN3 commented 8 months ago

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