LNPeerAddr: nicer str formatting for IPv6 hosts
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user