From 309b141477f1ac4e69ee29e83b511d2a62499a79 Mon Sep 17 00:00:00 2001 From: cryptochangements34 Date: Sun, 11 Feb 2018 17:07:58 -0600 Subject: [PATCH 1/2] payment verification fixes --- monero/include/monero_payments.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/monero/include/monero_payments.php b/monero/include/monero_payments.php index f5cff4d..b8c4fcb 100644 --- a/monero/include/monero_payments.php +++ b/monero/include/monero_payments.php @@ -8,7 +8,7 @@ class Monero_Gateway extends WC_Payment_Gateway { - private $reloadTime = 30000; + private $reloadTime = 17000; private $discount; private $confirmed = false; private $monero_daemon; @@ -325,7 +325,7 @@ class Monero_Gateway extends WC_Payment_Gateway $uri = "monero:$address?tx_payment_id=$payment_id"; if($this->zero_confirm){ - $this->verify_zero_conf($payment_id, $amount, $order_id); + $this->verify_zero_conf($payment_id, $amount_xmr2, $order_id); } else{ $this->verify_non_rpc($payment_id, $amount_xmr2, $order_id); @@ -693,10 +693,15 @@ class Monero_Gateway extends WC_Payment_Gateway if(isset($output_found)) { $amount_atomic_units = $amount * 1000000000000; + if($txs_from_block[$block_index]['payment_id'] == $payment_id && $output_found['amount'] >= $amount_atomic_units) { $this->on_verified($payment_id, $amount_atomic_units, $order_id); } + if($txs_from_block_2[$block_index]['payment_id'] == $payment_id && $output_found['amount'] >= $amount_atomic_units) + { + $this->on_verified($payment_id, $amount_atomic_units, $order_id); + } return true; } From ad1edf568cb2614e622c654fbb4116e29863319e Mon Sep 17 00:00:00 2001 From: cryptochangements34 Date: Sun, 11 Feb 2018 17:13:00 -0600 Subject: [PATCH 2/2] make a little more verbose --- monero/include/monero_payments.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/monero/include/monero_payments.php b/monero/include/monero_payments.php index b8c4fcb..7cefd4c 100644 --- a/monero/include/monero_payments.php +++ b/monero/include/monero_payments.php @@ -578,10 +578,10 @@ class Monero_Gateway extends WC_Payment_Gateway $order = wc_get_order($order_id); if($this->is_virtual_in_cart($order_id) == true){ - $order->update_status('completed', __('Payment has been received', 'monero_gateway')); + $order->update_status('completed', __('Payment has been received' . $payment_id, 'monero_gateway')); } else{ - $order->update_status('processing', __('Payment has been received', 'monero_gateway')); + $order->update_status('processing', __('Payment has been received' . $payment_id, 'monero_gateway')); // Show payment id used for order } global $wpdb; $wpdb->query("DROP TABLE $payment_id"); // Drop the table from database after payment has been confirmed as it is no longer needed @@ -652,6 +652,10 @@ class Monero_Gateway extends WC_Payment_Gateway if($block_difference != 0) { + if($block_difference > 2){ + $this->log->add('[WARNING] Block difference is greater than 2'); + } + $txs_from_block_2 = $tools->get_txs_from_block($bc_height - 1); $tx_count_2 = count($txs_from_block_2) - 1;