pyln-proto: expose ShortChannelId and PublicKey.

They're generally useful.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-09-07 13:39:15 +09:30
parent 4753ca4d35
commit 0ce473c656
2 changed files with 15 additions and 0 deletions

View File

@@ -85,6 +85,9 @@ class ShortChannelId(object):
and self.outnum == other.outnum
)
def __hash__(self):
return self.to_int().__hash__()
class Secret(object):
def __init__(self, data: bytes) -> None:
@@ -147,6 +150,15 @@ class PublicKey(object):
self.serializeCompressed().hex()
)
def __eq__(self, other: object) -> bool:
if not isinstance(other, PublicKey):
return False
return self.key == other.key
def __hash__(self):
return self.to_bytes().__hash__()
def Keypair(object):
def __init__(self, priv, pub):