lnaddr: add get_features method
This commit is contained in:
@@ -6,7 +6,7 @@ import time
|
||||
from hashlib import sha256
|
||||
from binascii import hexlify
|
||||
from decimal import Decimal
|
||||
from typing import Optional
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
import random
|
||||
import bitstring
|
||||
@@ -17,6 +17,9 @@ from . import constants
|
||||
from . import ecc
|
||||
from .bitcoin import COIN
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .lnutil import LnFeatures
|
||||
|
||||
|
||||
# BOLT #11:
|
||||
#
|
||||
@@ -315,6 +318,10 @@ class LnAddr(object):
|
||||
return None
|
||||
return int(self.amount * COIN * 1000)
|
||||
|
||||
def get_features(self) -> 'LnFeatures':
|
||||
from .lnutil import LnFeatures
|
||||
return LnFeatures(self.get_tag('9') or 0)
|
||||
|
||||
def __str__(self):
|
||||
return "LnAddr[{}, amount={}{} tags=[{}]]".format(
|
||||
hexlify(self.pubkey.serialize()).decode('utf-8') if self.pubkey else None,
|
||||
|
||||
Reference in New Issue
Block a user