synonymdev / react-native-ldk

React Native LDK
MIT License
51 stars 16 forks source link

No route hints in payment request (LDK -> LND -> LDK) #54

Closed tanx closed 1 year ago

tanx commented 2 years ago

I've tried starting my LDK demo app on two different iPhones and opened a channel from alice to each of them (with enough liquidity both ways). When I try to send sats from one phone to the other LDK says "No usable channel found" which makes sense since both channels from alice to the iPhones are private. But opening a channel with --private=false does not work. Is the LDK module somehow preconfigured to reject non-private channels? If so how would I test sending from one phone to another? Thanks

lnd@alice:/$ lncli openchannel --node_key=034bcb36c4e2f56e8b864620d6a1d823af738ad4dcaa0cd55a4799df15a3006717 --local_amt=100000 --push_amt=50000 --private=false
[lncli] rpc error: code = Unknown desc = received funding error from 034bcb36c4e2f56e8b864620d6a1d823af738ad4dcaa0cd55a4799df15a3006717: chan_id=2785db16c2f1a4d8be832cc39541ca66c8e9c662dbb1e5079f7ef3b33a89763e, err=Peer tried to open channel but their announcement preference is different from ours
Jasonvdb commented 2 years ago

That scenario should technically work fine. Can you confirm when you list channels on the sending iPhone that the channel says is_usable: true? Also that Alice's pubkey shows when listing peers.

The --private flag is a little misleading. LND went with that term while LDK went with announced_channel which I think makes more sense. For mobile I don't believe there's any advantage to a public/announced channel if you're not routing payments. That receiving iPhone should still be able to receive via a private/unannounced channel if it's encoding route hints in the invoice. If the payment fails to route and hints are missing (for some reason sometimes they're missing) then you'll see this additional message.

I did just in case did allow the announcement preference to be set natively but I just hardcoded announcedChannels=false in lightning-manager here. So if you would prefer that setting exposed via the start method it can be done. May have been wrong assuming everyone wanted unannounced channels only.

tanx commented 2 years ago

For mobile I don't believe there's any advantage to a public/announced channel if you're not routing payments. That receiving iPhone should still be able to receive via a private/unannounced channel if it's encoding route hints in the invoice. If the payment fails to route and hints are missing (for some reason sometimes they're missing) then you'll see this additional message.

That was my understanding as well. I created two private channels two each phone. Both channels are is_usable and active and I get this message when trying to pay the invoice of the other iPhone:

IMG_6DC4D320F453-1

tanx commented 2 years ago

Perhaps I need to resync the network graph? Is there an api for that?

tanx commented 2 years ago

So I called both ldk.completeGraphNodes() and ldk.completeGraphChannels(). When I list the nodes in the console I can only see the LND nodes from Polar, not the other LDK node.

Jasonvdb commented 2 years ago

Ok I am able to replicate the issue. Need to investigate why it has no route hints.

Don't think there's an official graph resync but going into the storage directory and deleting while the app is closed network_graph.bin will sync from scratch. But am not expecting the receiver node to be in the graph because its channel is not announced.

I might have to ask the LDK team for help on this one...

Jasonvdb commented 1 year ago

Waiting on a likely fix in LDK here

Jasonvdb commented 1 year ago

This is still an issue. Actually an LND bug https://github.com/lightningnetwork/lnd/issues/6870

Jasonvdb commented 1 year ago

Fixed in https://github.com/synonymdev/react-native-ldk/issues/54