mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
pyln-proto: expose ShortChannelId and PublicKey.
They're generally useful. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
4753ca4d35
commit
0ce473c656
@ -1,4 +1,5 @@
|
||||
from .bech32 import bech32_decode
|
||||
from .primitives import ShortChannelId, PublicKey
|
||||
from .invoice import Invoice
|
||||
from .onion import OnionPayload, TlvPayload, LegacyOnionPayload
|
||||
from .wire import LightningConnection, LightningServerSocket
|
||||
@ -13,4 +14,6 @@ __all__ = [
|
||||
"LegacyOnionPayload",
|
||||
"TlvPayload",
|
||||
"bech32_decode",
|
||||
"ShortChannelId",
|
||||
"PublicKey",
|
||||
]
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user