-
Notifications
You must be signed in to change notification settings - Fork 901
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
Pure-python implementation of the Sphinx onion protocol #4056
Conversation
1ed32a5
to
0df8243
Compare
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.
Looks pretty snazzy.
(Missed the comment about this being a "builds on top of PR" whoops.)
@@ -67,4 +69,75 @@ def __str__(self): | |||
return "{self.block}x{self.txnum}x{self.outnum}".format(self=self) | |||
|
|||
def __eq__(self, other): | |||
return self.block == other.block and self.txnum == other.txnum and self.outnum == other.outnum | |||
return ( |
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 seems like something a bit different from a type annotations update. should be in a separate commit. also seems to be missing type annotation information?
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.
Well it's just reformatting some code, but you're right I forgot to add the annotations here (mypy seemed to infer them correctly).
@@ -739,7 +739,9 @@ def restart(self, timeout=10, clean=True): | |||
self.start() | |||
|
|||
def fund_channel(self, l2, amount, wait_for_active=True, announce_channel=True): |
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.
is there a way to mark this as deprecated?
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.
There's the warnings
package which is a bit heavy handed (runtime warnings). I added a warning since this is mostly used in testing anyway.
fd9044a
to
cac7c42
Compare
I moved the deprecation of |
e3e1a71
to
a46b8df
Compare
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.
Ah, I see you already moved away from hexlify. Will rebase now I've merged dep, and roll in fixup!
|
||
@classmethod | ||
def from_hex(cls, s: str): | ||
return cls.from_bin(unhexlify(s)) |
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.
we should really wean off unhexlify and hexlify in favor of bytes.fromhex() and bytes.hex()...
|
||
return struct.pack("b", self.version) + \ | ||
ephkey + \ | ||
self.payloads + \ |
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.
The backslashes here are kinda weird?
Suggested-by: Rusty Russell <@rustyrussell> Signed-off-by: Christian Decker <@cdecker>
Changelog-Added: pyln-proto: Added pure python implementation of the sphinx onion creation and processing functionality.
Suggested-by: Lisa <@niftynei>
898c324
to
18b6939
Compare
Ack 18b6939 |
This is a simple (insecure) implementation of the onion creation and processing functionality. It is mainly intended to be used in
lnprototest
and experimental code, but is not guaranteed to have constant-time execution, and should not be used in production.The PR builds on top of #3811, so the real content is in the last 4 commits.
Depends #3811