mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
Handle multi-character prefixes in address sanity checking
This commit is contained in:
parent
b7fe9b0062
commit
9389e043e4
1 changed files with 9 additions and 4 deletions
13
tipbot.py
13
tipbot.py
|
@ -388,13 +388,18 @@ def CheckDisableWithdraw():
|
||||||
if disable_withdraw_on_error:
|
if disable_withdraw_on_error:
|
||||||
DisableWithdraw(None,None)
|
DisableWithdraw(None,None)
|
||||||
|
|
||||||
|
def IsValidAddress(address):
|
||||||
|
if len(address) < address_length[0] or len(address) > address_length[1]:
|
||||||
|
return False
|
||||||
|
for prefix in address_prefix:
|
||||||
|
if address.startswith(prefix):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def Withdraw(nick,data):
|
def Withdraw(nick,data):
|
||||||
address=data[0]
|
address=data[0]
|
||||||
amount=data[1]
|
amount=data[1]
|
||||||
if len(address) < address_length[0] or len(address) > address_length[1]:
|
if not IsValidAddress(address):
|
||||||
SendTo(nick, "Invalid address")
|
|
||||||
return
|
|
||||||
if not address[0] in address_prefix:
|
|
||||||
SendTo(nick, "Invalid address")
|
SendTo(nick, "Invalid address")
|
||||||
return
|
return
|
||||||
if amount:
|
if amount:
|
||||||
|
|
Loading…
Reference in a new issue