Clean up and finish new adress validator method (#202)

* Removed coinaddrvalidator dependency

* Return generic "Ivalid address" error message instead of the error returned by bitcoind when validating an address

* Modified messages related to bitcoin addresses validation
This commit is contained in:
zx9r 2022-08-01 03:03:33 +02:00 committed by GitHub
parent 56bc602d34
commit f0cde287e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 13 deletions

View File

@ -51,9 +51,8 @@ def validate_onchain_address(address):
try: try:
validation = bitcoind_rpc('validateaddress', [address]) validation = bitcoind_rpc('validateaddress', [address])
if not validation['isvalid']: if not validation['isvalid']:
return False, {"bad_address": validation['error']} return False, {"bad_address": "Invalid address"}
except: except:
# TODO: log the exception ?
return False, {"bad_address": 'Unable to validate address, check bitcoind backend'} return False, {"bad_address": 'Unable to validate address, check bitcoind backend'}
return True, None return True, None

View File

@ -434,9 +434,8 @@
"Does not look like a valid lightning invoice":"Does not look like a valid lightning invoice", "Does not look like a valid lightning invoice":"Does not look like a valid lightning invoice",
"The invoice provided has already expired":"The invoice provided has already expired", "The invoice provided has already expired":"The invoice provided has already expired",
"Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.":"Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.", "Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.":"Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.",
"Does not look like a valid address":"Does not look like a valid address", "Invalid address":"Invalid address",
"This is not a bitcoin mainnet address":"This is not a bitcoin mainnet address", "Unable to validate address, check bitcoind backend":"Unable to validate address, check bitcoind backend",
"This is not a bitcoin testnet address":"This is not a bitcoin testnet address",
"Submit payout info for {{amountSats}} Sats":"Submit payout info for {{amountSats}} Sats", "Submit payout info for {{amountSats}} Sats":"Submit payout info for {{amountSats}} Sats",
"Submit a valid invoice for {{amountSats}} Satoshis.":"Submit a valid invoice for {{amountSats}} Satoshis.", "Submit a valid invoice for {{amountSats}} Satoshis.":"Submit a valid invoice for {{amountSats}} Satoshis.",
"Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.":"Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.", "Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.":"Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.",

View File

@ -434,9 +434,8 @@
"Does not look like a valid lightning invoice":"No parece ser una factura lightning válida", "Does not look like a valid lightning invoice":"No parece ser una factura lightning válida",
"The invoice provided has already expired":"La factura que has entregado ya ha caducado", "The invoice provided has already expired":"La factura que has entregado ya ha caducado",
"Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.":"Asegurate de EXPORTAR el registro del chat. Los administradores pueden pedirte el registro del chat en caso de discrepancias. Es tu responsabilidad proveerlo.", "Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.":"Asegurate de EXPORTAR el registro del chat. Los administradores pueden pedirte el registro del chat en caso de discrepancias. Es tu responsabilidad proveerlo.",
"Does not look like a valid address":"No parece una dirección Bitcoin válida", "Invalid address":"Dirección inválida",
"This is not a bitcoin mainnet address":"No es una dirección de mainnet", "Unable to validate address, check bitcoind backend":"No ha sido posible validar la dirección, comprobar el backend bitcoind",
"This is not a bitcoin testnet address":"No es una dirección de testnet",
"Submit payout info for {{amountSats}} Sats":"Envia info para recibir {{amountSats}} Sats", "Submit payout info for {{amountSats}} Sats":"Envia info para recibir {{amountSats}} Sats",
"Submit a valid invoice for {{amountSats}} Satoshis.": "Envía una factura por {{amountSats}} Sats", "Submit a valid invoice for {{amountSats}} Satoshis.": "Envía una factura por {{amountSats}} Sats",
"Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.":"Antes de dejarte enviar {{amountFiat}} {{currencyCode}}, queremos asegurarnos de que puedes recibir BTC.", "Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.":"Antes de dejarte enviar {{amountFiat}} {{currencyCode}}, queremos asegurarnos de que puedes recibir BTC.",

View File

@ -27,4 +27,3 @@ django-import-export==2.7.1
requests[socks] requests[socks]
python-gnupg==0.4.9 python-gnupg==0.4.9
daphne==3.0.2 daphne==3.0.2
coinaddrvalidator==1.1.3