1
0

lnaddr: clean-up SEGWIT_HRP vs BOLT11_HRP confusion

With signet, SEGWIT_HRP != BOLT11_HRP, so the previous "currency" string
became a flawed concept. Instead we pass around net objects now.
This commit is contained in:
SomberNight
2021-06-22 16:06:52 +02:00
parent 5dff461aaa
commit 57e52da77f
7 changed files with 73 additions and 82 deletions

View File

@@ -26,7 +26,7 @@
import os
import json
from .util import inv_dict
from .util import inv_dict, all_subclasses
from . import bitcoin
@@ -47,7 +47,17 @@ BIP39_WALLET_FORMATS = read_json('bip39_wallet_formats.json', [])
class AbstractNet:
BLOCK_HEIGHT_FIRST_LIGHTNING_CHANNELS = 0
NET_NAME: str
TESTNET: bool
WIF_PREFIX: int
ADDRTYPE_P2PKH: int
ADDRTYPE_P2SH: int
SEGWIT_HRP: str
BOLT11_HRP: str
GENESIS: str
BLOCK_HEIGHT_FIRST_LIGHTNING_CHANNELS: int = 0
BIP44_COIN_TYPE: int
LN_REALM_BYTE: int
@classmethod
def max_checkpoint(cls) -> int:
@@ -171,6 +181,8 @@ class BitcoinSignet(BitcoinTestnet):
LN_DNS_SEEDS = []
NETS_LIST = tuple(all_subclasses(AbstractNet))
# don't import net directly, import the module instead (so that net is singleton)
net = BitcoinMainnet