verify address checksum
This commit is contained in:
parent
f74a52d56b
commit
ecc19adb83
@ -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,9 +272,13 @@ 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))
|
||||||
|
{
|
||||||
|
if($this->cryptonote->verify_checksum($monero_address))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public function check_viewKey()
|
public function check_viewKey()
|
||||||
|
Loading…
Reference in New Issue
Block a user