[Merge] Fix conflicts with development
This commit is contained in:
commit
7e49e90996
@ -26,7 +26,7 @@ chdir(dirname(__FILE__));
|
||||
require_once('shared.inc.php');
|
||||
|
||||
// Fetch our last block found from the DB as a starting point
|
||||
$aLastBlock = @$block->getLast();
|
||||
$aLastBlock = @$block->getLastValid();
|
||||
$strLastBlockHash = $aLastBlock['blockhash'];
|
||||
if (!$strLastBlockHash) $strLastBlockHash = '';
|
||||
|
||||
@ -58,6 +58,15 @@ if (empty($aTransactions['transactions'])) {
|
||||
$aBlockRPCInfo = $bitcoin->getblock($aData['blockhash']);
|
||||
$config['reward_type'] == 'block' ? $aData['amount'] = $aData['amount'] : $aData['amount'] = $config['reward'];
|
||||
$aData['height'] = $aBlockRPCInfo['height'];
|
||||
$aTxDetails = $bitcoin->gettransaction($aBlockRPCInfo['tx'][0]);
|
||||
if (!isset($aBlockRPCInfo['confirmations'])) {
|
||||
$aData['confirmations'] = $aBlockRPCInfo['confirmations'];
|
||||
} else if (isset($aTxDetails['confirmations'])) {
|
||||
$aData['confirmations'] = $aTxDetails['confirmations'];
|
||||
} else {
|
||||
$log->logFatal(' RPC does not return any usable block confirmation information');
|
||||
$monitoring->endCronjob($cron_name, 'E0082', 1, true);
|
||||
}
|
||||
$aData['difficulty'] = $aBlockRPCInfo['difficulty'];
|
||||
$log->logInfo(sprintf($strLogMask, substr($aData['blockhash'], 0, 17)."...", $aData['height'], $aData['amount'], $aData['confirmations'], $aData['difficulty'], strftime("%Y-%m-%d %H:%M:%S", $aData['time'])));
|
||||
if ( ! empty($aBlockRPCInfo['flags']) && preg_match('/proof-of-stake/', $aBlockRPCInfo['flags']) ) {
|
||||
|
||||
@ -15,6 +15,18 @@ class Block extends Base {
|
||||
return $result->fetch_assoc();
|
||||
return $this->sqlError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific method to fetch the latest block found that is VALID
|
||||
* @param none
|
||||
* @return data array Array with database fields as keys
|
||||
**/
|
||||
public function getLastValid() {
|
||||
$stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE confirmations > -1 ORDER BY height DESC LIMIT 1");
|
||||
if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
|
||||
return $result->fetch_assoc();
|
||||
return $this->sqlError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific block, by block height
|
||||
|
||||
@ -84,6 +84,13 @@ $config['ap_threshold']['max'] = 250;
|
||||
**/
|
||||
$config['mp_threshold'] = 1;
|
||||
|
||||
/**
|
||||
* Minimum manual Payout Threshold
|
||||
* Minimum manual payout amount
|
||||
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-manual-payout-threshold
|
||||
**/
|
||||
$config['mp_threshold'] = 1;
|
||||
|
||||
/**
|
||||
* Donation thresholds
|
||||
* Minimum donation amount in percent
|
||||
|
||||
@ -94,6 +94,8 @@ if ($user->isAuthenticated()) {
|
||||
} else {
|
||||
switch (@$_POST['do']) {
|
||||
case 'cashOut':
|
||||
$aBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
|
||||
$dBalance = $aBalance['confirmed'];
|
||||
if ($setting->getValue('disable_payouts') == 1 || $setting->getValue('disable_manual_payouts') == 1) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Manual payouts are disabled.', 'TYPE' => 'alert alert-warning');
|
||||
} else if ($aBalance['confirmed'] < $config['mp_threshold']) {
|
||||
@ -101,8 +103,6 @@ if ($user->isAuthenticated()) {
|
||||
} else if (!$user->getCoinAddress($_SESSION['USERDATA']['id'])) {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'You have no payout address set.', 'TYPE' => 'alert alert-danger');
|
||||
} else {
|
||||
$aBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
|
||||
$dBalance = $aBalance['confirmed'];
|
||||
$user->log->log("info", $_SESSION['USERDATA']['username']." requesting manual payout");
|
||||
if ($dBalance > $config['txfee_manual']) {
|
||||
if (!$oPayout->isPayoutActive($_SESSION['USERDATA']['id'])) {
|
||||
|
||||
@ -89,6 +89,9 @@
|
||||
<p style="padding-left:3px; padding-redight:30px; font-size:10px;">
|
||||
Please note: a {if $GLOBAL.config.txfee_manual > 0.00001}{$GLOBAL.config.txfee_manual}{else}{$GLOBAL.config.txfee_manual|number_format:"8"}{/if} {$GLOBAL.config.currency} transaction will apply when processing "On-Demand" manual payments <span id="tt"><img width="15px" height="15px" title="This {if $GLOBAL.config.txfee_manual > 0.00001}{$GLOBAL.config.txfee_manual}{else}{$GLOBAL.config.txfee_manual|number_format:"8"}{/if} manual payment transaction fee is a network fee and goes back into the network not the pool." src="site_assets/mpos/images/questionmark.png"></span>
|
||||
</p>
|
||||
<p style="padding-left:3px; padding-redight:30px; font-size:10px;">
|
||||
Minimum Cashout: {$GLOBAL.config.mp_threshold} {$GLOBAL.config.currency}
|
||||
</p>
|
||||
<fieldset>
|
||||
<label>Account Balance</label>
|
||||
{nocache}<input type="text" value="{$GLOBAL.userdata.balance.confirmed|escape}" {$GLOBAL.config.currency} disabled />{/nocache}
|
||||
@ -109,7 +112,9 @@
|
||||
<input type="hidden" name="ctoken" value="{$CTOKEN|escape|default:""}" />
|
||||
<input type="hidden" name="utype" value="withdraw_funds">
|
||||
{if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.withdraw}
|
||||
{if $WITHDRAWSENT == 1 && $WITHDRAWUNLOCKED == 1}
|
||||
{if $GLOBAL.userdata.balance.confirmed|escape < $GLOBAL.config.mp_threshold}
|
||||
<input type="submit" value="Unlock" class="alt_btn" name="unlock" disabled>
|
||||
{elseif $WITHDRAWSENT == 1 && $WITHDRAWUNLOCKED == 1}
|
||||
<input type="submit" value="Cash Out" class="alt_btn">
|
||||
{elseif $WITHDRAWSENT == 0 && $WITHDRAWUNLOCKED == 1 || $WITHDRAWSENT == 1 && $WITHDRAWUNLOCKED == 0}
|
||||
<input type="submit" value="Cash Out" class="alt_btn" disabled>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user