mirror of
https://git.wownero.com/lza_menace/wownero-python.git
synced 2024-08-15 03:25:25 +00:00
Handle idempotence in Address()
This commit is contained in:
parent
7200d980d9
commit
176ab69638
2 changed files with 19 additions and 0 deletions
|
@ -5,6 +5,7 @@ from . import base58
|
|||
|
||||
class Address(object):
|
||||
def __init__(self, address):
|
||||
address = str(address)
|
||||
if len(address) != 95:
|
||||
raise ValueError("Address must be 95 characters long, is %d" % len(address))
|
||||
self._decode(address)
|
||||
|
@ -47,6 +48,7 @@ class Address(object):
|
|||
|
||||
class IntegratedAddress(Address):
|
||||
def __init__(self, address):
|
||||
address = str(address)
|
||||
if len(address) != 106:
|
||||
raise ValueError("Integrated address must be 106 characters long, is %d" % len(address))
|
||||
self._decode(address)
|
||||
|
@ -62,6 +64,7 @@ class IntegratedAddress(Address):
|
|||
|
||||
|
||||
def address(addr):
|
||||
addr = str(addr)
|
||||
if len(addr) == 95:
|
||||
return Address(addr)
|
||||
elif len(addr) == 106:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue