Allow unsafe addresses in input
This commit is contained in:
parent
8833e2e7b8
commit
0714791b9a
@ -12,12 +12,21 @@ logg = logging.getLogger(__name__)
|
||||
|
||||
class LookNoop:
|
||||
|
||||
def __init__(self, check=True):
|
||||
self.check = check
|
||||
|
||||
|
||||
def get(self, k, rpc=None):
|
||||
try:
|
||||
if not is_checksum_address(k):
|
||||
if not self.check:
|
||||
address_bytes = bytes.fromhex(strip_0x(k))
|
||||
if len(address_bytes) != 20:
|
||||
raise ValueError('{} is not a valid address'.format(k))
|
||||
else:
|
||||
try:
|
||||
if not is_checksum_address(k):
|
||||
raise ValueError('not valid checksum address {}'.format(k))
|
||||
except ValueError:
|
||||
raise ValueError('not valid checksum address {}'.format(k))
|
||||
except ValueError:
|
||||
raise ValueError('not valid checksum address {}'.format(k))
|
||||
return strip_0x(k)
|
||||
|
||||
|
||||
|
@ -118,7 +118,7 @@ def main():
|
||||
# TODO: make resolvers pluggable
|
||||
token_resolver = DefaultResolver(chain_spec, conn, sender_address=rpc.get_sender_address())
|
||||
|
||||
noop_lookup = LookNoop()
|
||||
noop_lookup = LookNoop(check=not config.true('_UNSAFE'))
|
||||
token_resolver.add_lookup(noop_lookup, 'noop')
|
||||
|
||||
if config.get('_TOKEN_INDEX') != None:
|
||||
|
Loading…
Reference in New Issue
Block a user