1
0

avoid duplicating bech32 module

This commit is contained in:
Janus
2018-04-17 15:31:00 +02:00
committed by ThomasV
parent f278833c40
commit 5b1a5e8786
3 changed files with 5 additions and 128 deletions

View File

@@ -2,7 +2,7 @@
import traceback
import ecdsa.curves
from ..bitcoin import MyVerifyingKey, GetPubKey
from .bech32 import bech32_encode, bech32_decode, CHARSET
from ..segwit_addr import bech32_encode, bech32_decode, CHARSET
from binascii import hexlify, unhexlify
from bitstring import BitArray
from decimal import Decimal
@@ -79,7 +79,7 @@ def encode_fallback(fallback, currency):
""" Encode all supported fallback addresses.
"""
if currency == 'bc' or currency == 'tb':
fbhrp, witness = bech32_decode(fallback)
fbhrp, witness = bech32_decode(fallback, ignore_long_length=True)
if fbhrp:
if fbhrp != currency:
raise ValueError("Not a bech32 address for this currency")
@@ -251,7 +251,7 @@ class LnAddr(object):
)
def lndecode(a, verbose=False):
hrp, data = bech32_decode(a)
hrp, data = bech32_decode(a, ignore_long_length=True)
if not hrp:
raise ValueError("Bad bech32 checksum")