mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 00:41:31 +00:00
fix tests (follow-up previous commit)
This commit is contained in:
parent
0e3e43f522
commit
560a8e99ac
4 changed files with 7 additions and 6 deletions
|
@ -28,7 +28,7 @@ from .lnutil import (Outpoint, LocalConfig, ChannelConfig,
|
|||
funding_output_script, get_per_commitment_secret_from_seed,
|
||||
secret_to_pubkey, LNPeerAddr, PaymentFailure, LnLocalFeatures,
|
||||
LOCAL, REMOTE, HTLCOwner, generate_keypair, LnKeyFamily,
|
||||
get_ln_flag_pair_of_bit)
|
||||
get_ln_flag_pair_of_bit, privkey_to_pubkey)
|
||||
from .lnutil import LightningPeerConnectionClosed, HandshakeFailed
|
||||
from .lnrouter import NotFoundChanAnnouncementForUpdate, RouteEdge
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import hashlib
|
|||
import cryptography.hazmat.primitives.ciphers.aead as AEAD
|
||||
|
||||
from .crypto import sha256
|
||||
from .lnutil import get_ecdh
|
||||
from .lnutil import get_ecdh, privkey_to_pubkey
|
||||
from .lnutil import LightningPeerConnectionClosed, HandshakeFailed
|
||||
from . import ecc
|
||||
|
||||
|
@ -71,8 +71,6 @@ def act1_initiator_message(hs, epriv, epub):
|
|||
assert len(msg) == 50
|
||||
return msg
|
||||
|
||||
def privkey_to_pubkey(priv: bytes) -> bytes:
|
||||
return ecc.ECPrivkey(priv[:32]).get_public_key_bytes()
|
||||
|
||||
def create_ephemeral_key() -> (bytes, bytes):
|
||||
privkey = ecc.ECPrivkey.generate_random_key()
|
||||
|
|
|
@ -162,6 +162,9 @@ def secret_to_pubkey(secret: int) -> bytes:
|
|||
assert type(secret) is int
|
||||
return ecc.ECPrivkey.from_secret_scalar(secret).get_public_key_bytes(compressed=True)
|
||||
|
||||
def privkey_to_pubkey(priv: bytes) -> bytes:
|
||||
return ecc.ECPrivkey(priv[:32]).get_public_key_bytes()
|
||||
|
||||
def derive_pubkey(basepoint: bytes, per_commitment_point: bytes) -> bytes:
|
||||
p = ecc.ECPubkey(basepoint) + ecc.generator() * ecc.string_to_number(sha256(per_commitment_point + basepoint))
|
||||
return p.get_public_key_bytes()
|
||||
|
|
|
@ -88,8 +88,8 @@ def create_test_channels(feerate=6000, local=None, remote=None):
|
|||
remote_amount = remote if remote is not None else (funding_sat * 1000 // 2)
|
||||
alice_raw = [ bip32("m/" + str(i)) for i in range(5) ]
|
||||
bob_raw = [ bip32("m/" + str(i)) for i in range(5,11) ]
|
||||
alice_privkeys = [lnutil.Keypair(lnbase.privkey_to_pubkey(x), x) for x in alice_raw]
|
||||
bob_privkeys = [lnutil.Keypair(lnbase.privkey_to_pubkey(x), x) for x in bob_raw]
|
||||
alice_privkeys = [lnutil.Keypair(lnutil.privkey_to_pubkey(x), x) for x in alice_raw]
|
||||
bob_privkeys = [lnutil.Keypair(lnutil.privkey_to_pubkey(x), x) for x in bob_raw]
|
||||
alice_pubkeys = [lnutil.OnlyPubkeyKeypair(x.pubkey) for x in alice_privkeys]
|
||||
bob_pubkeys = [lnutil.OnlyPubkeyKeypair(x.pubkey) for x in bob_privkeys]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue