diff --git a/upload/catalog/controller/payment/bitcoin.php b/upload/catalog/controller/payment/bitcoin.php index 9e01113..f20ee76 100644 --- a/upload/catalog/controller/payment/bitcoin.php +++ b/upload/catalog/controller/payment/bitcoin.php @@ -179,9 +179,16 @@ public function runUpdate() { $btcdata = $dec; $currency = "BTC"; - $value = $btcdata['return']['avg']['value']; - - if ((float)$value) { + $avg_value = $btcdata['return']['avg']['value']; + $last_value = $btcdata['return']['last']['value']; + + if ((float)$avg_value && (float)$last_value) { + if($avg_value < $last_value) { + $value = $avg_value; + } + else { + $value = $last_value; + } $value = 1/$value; $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (float)$value . "', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($currency) . "'"); }