1
0

lnaddr: add feature bit support to invoices

see https://github.com/lightningnetwork/lightning-rfc/pull/656
This commit is contained in:
SomberNight
2020-03-24 15:31:19 +01:00
parent a66437f399
commit 4b78bf94d4
5 changed files with 64 additions and 23 deletions

View File

@@ -38,7 +38,8 @@ from .sql_db import SqlDB, sql
from . import constants
from .util import bh2u, profiler, get_headers_dir, bfh, is_ip_address, list_enabled_bits
from .logging import Logger
from .lnutil import LN_FEATURES_IMPLEMENTED, LNPeerAddr, format_short_channel_id, ShortChannelID
from .lnutil import (LNPeerAddr, format_short_channel_id, ShortChannelID,
UnknownEvenFeatureBits, validate_features)
from .lnverifier import LNChannelVerifier, verify_sig_for_channel_update
from .lnmsg import decode_msg
@@ -47,15 +48,6 @@ if TYPE_CHECKING:
from .lnchannel import Channel
class UnknownEvenFeatureBits(Exception): pass
def validate_features(features: int) -> None:
enabled_features = list_enabled_bits(features)
for fbit in enabled_features:
if (1 << fbit) & LN_FEATURES_IMPLEMENTED == 0 and fbit % 2 == 0:
raise UnknownEvenFeatureBits()
FLAG_DISABLE = 1 << 1
FLAG_DIRECTION = 1 << 0