From 2d324d6415c90e6135e492d67351e008db963139 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Wed, 8 Jun 2016 21:22:00 +0100 Subject: [PATCH] Allow integrated addresses --- tipbot/coinspecs.py | 2 +- tipbot/utils.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tipbot/coinspecs.py b/tipbot/coinspecs.py index 9d5170b..a6c0b76 100644 --- a/tipbot/coinspecs.py +++ b/tipbot/coinspecs.py @@ -15,7 +15,7 @@ coinspecs = { "symbol": "XMR", "atomic_units": 1e12, "denominations": [[1000000, 1, "piconero"], [1000000000, 1e6, "micronero"], [1000000000000, 1e9, "millinero"]], - "address_length": [95, 95], # min/max size of addresses + "address_length": [[95, 95], [106, 106]], # min/max size of addresses "address_prefix": ['4', '9'], # allowed prefixes of addresses "min_withdrawal_fee": 10000000000, "web_wallet_url": "https://mymonero.com/", # None is there's none diff --git a/tipbot/utils.py b/tipbot/utils.py index 2a6015b..b1f3ec0 100644 --- a/tipbot/utils.py +++ b/tipbot/utils.py @@ -76,8 +76,18 @@ def GetIdentityFromPaymentID(p): identity = "freenode:"+identity return identity +def IsAddressLengthValid(address): + if type(coinspecs.address_length[0]) == list: + for allist in coinspecs.address_length: + if len(address) >= allist[0] and len(address) <= allist[1]: + return True + else: + if len(address) >= coinspecs.address_length[0] and len(address) <= coinspecs.address_length[1]: + return True + return False + def IsValidAddress(address): - if len(address) < coinspecs.address_length[0] or len(address) > coinspecs.address_length[1]: + if not IsAddressLengthValid(address): return False for prefix in coinspecs.address_prefix: if address.startswith(prefix):