Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign uprouting: allow route to self #3736
Conversation
f128194
to
bfc27d6
e651429
to
86027ba
Clean and well crafted PR! Only found a few nits, nothing critical. |
Given that this doesn't really have a use case, perhaps we could detect this and return an error? |
This comment has been minimized.
This comment has been minimized.
I wouldn't really want to hard block this. I think we can assume that people using send to self know what they are doing. I also think we cannot really rule out that such use case would emerge at some point. There is for example the trick where you drop off more routing fees than required as a way to do spontaneous payment. |
We may not be able to choose which channel the HTLC is forwarded over, but we can reject the payment if it doesn't come over the intended channel and retry. Now that we index the invoice htlcs by circuit key, it should be straight forward (apart from needing to add this restriction on the invoice).
I don't think this would be the expected behavior for simply calling |
f91c130
to
637fcc3
This comment has been minimized.
This comment has been minimized.
I consider this out of scope for this PR? It is definitely useful functionality, also to prevent tying up capital on expensive peers.
Flag added |
LGTM |
This comment has been minimized.
This comment has been minimized.
ZapUser77
commented
Nov 27, 2019
•
Thanks. Glad to see that merged in. |
joostjager commentedNov 18, 2019
•
edited
This PR makes it possible to find routes to yourself. It is useful for rebalancing purposes if combined with #3739 and an outgoing channel restriction.
Usage from the command line:
lncli addinvoice <amt>
lncli payinvoice --allow_self_payment --outgoing_chan_id <outgoing_chan> --last_hop <last_hop> <payreq_from_1>
This will push out
amt
throughoutgoing_chan
back to yourself via one of your channels with your peerlast_hop
. The exact incoming channel cannot be specified because routing nodes forward non-strict.Note that if you pay to yourself without any of these restrictions, it may happen that the payment comes back in through the same channel that was used to send it out. In that case balances don't change. They may only go down because of the routing fees paid.
Fixes #1645