lnaddr: don't call validate_features in parser
- see comment in lnaddr.py - Previously we used feature bit 50/51 for trampoline. The spec subsequently defined fbit 50/51 as option_zeroconf, which requires fbit 46/47 (option_scid_alias) to also be set. We moved the non-standard trampoline fbit to a different int. However, old wallets might have old invoices saved that set fbit 50/51 for trampoline, and those would not have the dependent bit set. Invoices are parsed at wallet-open, so if the parser ran these checks, those wallets could not be opened. - note: we could potentially also run lnaddr.validate_and_compare_features when saving new invoices into the wallet but this is not done here
This commit is contained in:
@@ -523,9 +523,11 @@ def lndecode(invoice: str, *, verbose=False, net=None) -> LnAddr:
|
||||
elif tag == '9':
|
||||
features = tagdata.uint
|
||||
addr.tags.append(('9', features))
|
||||
from .lnutil import validate_features
|
||||
validate_features(features)
|
||||
|
||||
# note: The features are not validated here in the parser,
|
||||
# instead, validation is done just before we try paying the invoice (in lnworker._check_invoice).
|
||||
# Context: invoice parsing happens when opening a wallet. If there was a backwards-incompatible
|
||||
# change to a feature, and we raised, some existing wallets could not be opened. Such a change
|
||||
# can happen to features not-yet-merged-to-BOLTs (e.g. trampoline feature bit was moved and reused).
|
||||
else:
|
||||
addr.unknown_tags.append((tag, tagdata))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user