-
Notifications
You must be signed in to change notification settings - Fork 129
Send onions along a fixed path #85
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
Conversation
cdecker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice idea. I was thinking about implementing something like this and call it waypoint but fixedroute also works :-)
fixroute/fixroute.py
Outdated
| d = {} | ||
| n = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can attach these globals to plugin instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I just realized I should also have renamed them as channelidx and nodeidx I did not set them up in init in the beginning but I thought it would be better to not parse through the json everyone time plugin is called
fixroute/fixroute.py
Outdated
| amount = amount + fees | ||
| key = "{}:{}".format(src, dest) | ||
| if key not in d: | ||
| route = plugin.rpc.getroute(dest, amount, 1, delay, src)["route"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to add error handling here, something like:
try:
route = plugin.rpc.getroute(dest, amount, 1, delay, src)["route"]
except RpcError as e:
# TODO: narrow down error types we catch
print("No route found:", e)
return {"route": None}
(Requires an include: from pyln.client import RpcError).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually quite fine already since Exceptions are bubbled up through the RPC passthrough interface. I'll fix this up by adding some more context, about which leg failed, but re-raising the exception.
|
Clean rebase on top of |
|
Fixed up and cleaned up. |
Users often use virtualenvs to confine the dependencies and use a different interpreter. This uses whatever they specified.
|
Needs rebase |
|
This plugin, Feel free to reopen this PR if you want to continue working on it! |
which might be extended if payment channels are missing.
It would be nice if you could double check that I did not mess up the check of global features and the direction flag of channels (comments in the code with references to c-lightning and BOLTs)
This plugin helps you to construct a route object (to be used with sendpay) which goes over a sequence of node ids. if all these nodeids are on a path of payment channels an onion following this path will be constructed. In the case of missing channels
lightning-cli gerouteis invoked to find partial routs.This plugin can be used to create circular onions or to send payments along specific paths if that is necessary (as long as the paths provide enough liquidity).
I guess this plugin could also be used to simulate the behaviour of trampoline payments.
And of course I imagine you the reader of this message will find even more creative ways of using it.
examples
First we have an example where a path of payment channel between all nodes exists. The output should be exactly the same as calling
lightning-cli getroute 0383494542d2e21cafc46d80ae9d2a0bd6b55db4b50721ac3703315c59b9ec27b3 1000 1 9 032060a40a94dc7b848d02314e4ccebe20f451dc87f28c1ed685caa58bfcc3989asufficiently often (until lightningd decides to return this particular route)same example as above but I artificially injected my own node (
03efccf2c383d7bf340da9a3f02e2c23104a0e4fe8ac1a880c8e2dc92fbdacd9df) at the 3rd hop so now the result contains more channels because my node was not connected to the nodes in this path.