verify address checksum

This commit is contained in:
cryptochangements34 2018-03-29 20:40:24 -04:00
parent f74a52d56b
commit ecc19adb83

View File

@ -5,6 +5,7 @@
* Authors: Serhack and cryptochangements * Authors: Serhack and cryptochangements
*/ */
require_once("cryptonote.php");
class Monero_Gateway extends WC_Payment_Gateway class Monero_Gateway extends WC_Payment_Gateway
{ {
@ -14,6 +15,7 @@ class Monero_Gateway extends WC_Payment_Gateway
private $monero_daemon; private $monero_daemon;
private $non_rpc = false; private $non_rpc = false;
private $zero_cofirm = false; private $zero_cofirm = false;
private $cryptonote;
function __construct() function __construct()
{ {
@ -71,6 +73,7 @@ class Monero_Gateway extends WC_Payment_Gateway
add_action('woocommerce_email_before_order_table', array($this, 'email_instructions'), 10, 2); add_action('woocommerce_email_before_order_table', array($this, 'email_instructions'), 10, 2);
} }
$this->monero_daemon = new Monero_Library($this->host, $this->port); $this->monero_daemon = new Monero_Library($this->host, $this->port);
$this->cryptonote = new Cryptonote();
} }
public function get_icon() public function get_icon()
@ -269,8 +272,12 @@ class Monero_Gateway extends WC_Payment_Gateway
public function check_monero() public function check_monero()
{ {
$monero_address = $this->settings['monero_address']; $monero_address = $this->settings['monero_address'];
if (strlen($monero_address) == 95 && substr($monero_address, 1)) { if (strlen($monero_address) == 95 && substr($monero_address, 1))
return true; {
if($this->cryptonote->verify_checksum($monero_address))
{
return true;
}
} }
return false; return false;
} }