mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
LNPeerAddr: nicer str formatting for IPv6 hosts
This commit is contained in:
parent
ddeb176b3d
commit
edba59ef54
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,8 @@ from collections import namedtuple
|
||||||
from typing import NamedTuple, List, Tuple, Mapping, Optional, TYPE_CHECKING, Union, Dict, Set
|
from typing import NamedTuple, List, Tuple, Mapping, Optional, TYPE_CHECKING, Union, Dict, Set
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from aiorpcx import NetAddress
|
||||||
|
|
||||||
from .util import bfh, bh2u, inv_dict, UserFacingException
|
from .util import bfh, bh2u, inv_dict, UserFacingException
|
||||||
from .crypto import sha256
|
from .crypto import sha256
|
||||||
from .transaction import (Transaction, PartialTransaction, PartialTxInput, TxOutpoint,
|
from .transaction import (Transaction, PartialTransaction, PartialTxInput, TxOutpoint,
|
||||||
|
@ -662,7 +664,8 @@ class LNPeerAddr(NamedTuple):
|
||||||
pubkey: bytes
|
pubkey: bytes
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{}@{}:{}'.format(bh2u(self.pubkey), self.host, self.port)
|
host_and_port = str(NetAddress(self.host, self.port))
|
||||||
|
return '{}@{}'.format(self.pubkey.hex(), host_and_port)
|
||||||
|
|
||||||
|
|
||||||
def get_compressed_pubkey_from_bech32(bech32_pubkey: str) -> bytes:
|
def get_compressed_pubkey_from_bech32(bech32_pubkey: str) -> bytes:
|
||||||
|
|
Loading…
Add table
Reference in a new issue