int64_t CTransaction::GetMinFee(unsigned int nBlockSize, bool fAllowFree, enum GetMinFee_mode mode, unsigned int nBytes) const
{
- // Use new fees approach if we are on test network or
- // switch date has been reached
- bool fNewApproach = fTestNet || nTime > FEE_SWITCH_TIME;
-
int64_t nMinTxFee = MIN_TX_FEE, nMinRelayTxFee = MIN_RELAY_TX_FEE;
- if(!fNewApproach || IsCoinStake())
+ if(IsCoinStake())
{
// Enforce 0.01 as minimum fee for old approach or coinstake
nMinTxFee = CENT;
unsigned int nNewBlockSize = nBlockSize + nBytes;
int64_t nMinFee = (1 + (int64_t)nBytes / 1000) * nBaseFee;
- if (fNewApproach)
+ if (fAllowFree)
{
- if (fAllowFree)
+ if (nBlockSize == 1)
{
- if (nBlockSize == 1)
- {
- // Transactions under 1K are free
- if (nBytes < 1000)
- nMinFee = 0;
- }
- else
- {
- // Free transaction area
- if (nNewBlockSize < 27000)
- nMinFee = 0;
- }
+ // Transactions under 1K are free
+ if (nBytes < 1000)
+ nMinFee = 0;
+ }
+ else
+ {
+ // Free transaction area
+ if (nNewBlockSize < 27000)
+ nMinFee = 0;
}
-
- // To limit dust spam, require additional MIN_TX_FEE/MIN_RELAY_TX_FEE for
- // each non empty output which is less than 0.01
- //
- // It's safe to ignore empty outputs here, because these inputs are allowed
- // only for coinbase and coinstake transactions.
- BOOST_FOREACH(const CTxOut& txout, vout)
- if (txout.nValue < CENT && !txout.IsEmpty())
- nMinFee += nBaseFee;
- }
- else if (nMinFee < nBaseFee)
- {
- // To limit dust spam, require MIN_TX_FEE/MIN_RELAY_TX_FEE if
- // any output is less than 0.01
- BOOST_FOREACH(const CTxOut& txout, vout)
- if (txout.nValue < CENT)
- nMinFee = nBaseFee;
}
+ // To limit dust spam, require additional MIN_TX_FEE/MIN_RELAY_TX_FEE for
+ // each non empty output which is less than 0.01
+ //
+ // It's safe to ignore empty outputs here, because these inputs are allowed
+ // only for coinbase and coinstake transactions.
+ BOOST_FOREACH(const CTxOut& txout, vout)
+ if (txout.nValue < CENT && !txout.IsEmpty())
+ nMinFee += nBaseFee;
+
// Raise the price as the block approaches full
if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)
{
// Priority
dPriority = dPriorityInputs / nBytes;
sPriorityLabel = CoinControlDialog::getPriorityLabel(dPriority);
+ bool fAllowFree = CTransaction::AllowFree(dPriority);
// Fee
int64_t nFee = nTransactionFee * (1 + (int64_t)nBytes / 1000);
-
// Min Fee
- bool fAllowFree = CTransaction::AllowFree(dPriority);
-
- // Disable free transactions until 1 July 2014
- if (!fTestNet && txDummy.nTime < FEE_SWITCH_TIME)
- {
- fAllowFree = false;
- }
-
int64_t nMinFee = txDummy.GetMinFee(1, fAllowFree, GMF_SEND, nBytes);
nPayFee = max(nFee, nMinFee);
{
nChange = nAmount - nPayFee - nPayAmount;
- // if sub-cent change is required, the fee must be raised to at least CTransaction::nMinTxFee
- if (txDummy.nTime < FEE_SWITCH_TIME && !fTestNet)
- {
- if (nPayFee < CENT && nChange > 0 && nChange < CENT)
- {
- if (nChange < CENT) // change < 0.01 => simply move all change to fees
- {
- nPayFee = nChange;
- nChange = 0;
- }
- else
- {
- nChange = nChange + nPayFee - CENT;
- nPayFee = CENT;
- }
- }
- }
-
if (nChange == 0)
nBytes -= 34;
}
l8->setStyleSheet((nChange > 0 && nChange < CENT) ? "color:red;" : ""); // Change < 0.01BTC
// tool tips
- l5->setToolTip(tr("This label turns red, if the transaction size is bigger than 1000 bytes.\n\n This means a fee of at least %1 per kb is required.\n\n Can vary +/- 1 Byte per input.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, fTestNet || FEE_SWITCH_TIME < GetTime() ? MIN_TX_FEE : CENT)));
- l6->setToolTip(tr("Transactions with higher priority get more likely into a block.\n\nThis label turns red, if the priority is smaller than \"medium\".\n\n This means a fee of at least %1 per kb is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, fTestNet || FEE_SWITCH_TIME < GetTime() ? MIN_TX_FEE : CENT)));
- l7->setToolTip(tr("This label turns red, if any recipient receives an amount smaller than %1.\n\n This means a fee of at least %2 is required. \n\n Amounts below the minimum fee are shown as DUST.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)).arg(BitcoinUnits::formatWithUnit(nDisplayUnit, fTestNet || FEE_SWITCH_TIME < GetTime() ? MIN_RELAY_TX_FEE : CENT)));
- l8->setToolTip(tr("This label turns red, if the change is smaller than %1.\n\n This means a fee of at least %2 is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)).arg(BitcoinUnits::formatWithUnit(nDisplayUnit, fTestNet || FEE_SWITCH_TIME < GetTime() ? MIN_TX_FEE : CENT)));
+ l5->setToolTip(tr("This label turns red, if the transaction size is bigger than 1000 bytes.\n\n This means a fee of at least %1 per kb is required.\n\n Can vary +/- 1 Byte per input.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, MIN_TX_FEE)));
+ l6->setToolTip(tr("Transactions with higher priority get more likely into a block.\n\nThis label turns red, if the priority is smaller than \"medium\".\n\n This means a fee of at least %1 per kb is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, MIN_TX_FEE)));
+ l7->setToolTip(tr("This label turns red, if any recipient receives an amount smaller than %1.\n\n This means a fee of at least %2 is required. \n\n Amounts below the minimum fee are shown as DUST.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)).arg(BitcoinUnits::formatWithUnit(nDisplayUnit, MIN_RELAY_TX_FEE)));
+ l8->setToolTip(tr("This label turns red, if the change is smaller than %1.\n\n This means a fee of at least %2 is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)).arg(BitcoinUnits::formatWithUnit(nDisplayUnit, MIN_TX_FEE)));
dialog->findChild<QLabel *>("labelCoinControlBytesText") ->setToolTip(l5->toolTip());
dialog->findChild<QLabel *>("labelCoinControlPriorityText") ->setToolTip(l6->toolTip());
dialog->findChild<QLabel *>("labelCoinControlLowOutputText")->setToolTip(l7->toolTip());
result.push_back(Pair("tx", txinfo));
- if ( block.IsProofOfStake() || (!fTestNet && block.GetBlockTime() < ENTROPY_SWITCH_TIME) )
+ if ( block.IsProofOfStake() )
result.push_back(Pair("signature", HexStr(block.vchBlockSig.begin(), block.vchBlockSig.end())));
return result;
#ifndef BITCOIN_TIMESTAMPS_H
#define BITCOIN_TIMESTAMPS_H
-static const unsigned int ENTROPY_SWITCH_TIME = 1362791041; // Sat, 09 Mar 2013 01:04:01 GMT
static const unsigned int STAKE_SWITCH_TIME = 1371686400; // Thu, 20 Jun 2013 00:00:00 GMT
static const unsigned int TARGETS_SWITCH_TIME = 1374278400; // Sat, 20 Jul 2013 00:00:00 GMT
static const unsigned int CHAINCHECKS_SWITCH_TIME = 1379635200; // Fri, 20 Sep 2013 00:00:00 GMT
static const unsigned int STAKECURVE_SWITCH_TIME = 1382227200; // Sun, 20 Oct 2013 00:00:00 GMT
-static const unsigned int FEE_SWITCH_TIME = 1405814400; // Sun, 20 Jul 2014 00:00:00 GMT
static const unsigned int VALIDATION_SWITCH_TIME = 1408492800; // Wed, 20 Aug 2014 00:00:00 GMT
static const unsigned int SIG_SWITCH_TIME = 1411171200; // Sat, 20 Sep 2014 00:00:00 GMT
}
int64_t nChange = nValueIn - nValue - nFeeRet;
- // if sub-cent change is required, the fee must be raised to at least MIN_TX_FEE
- // or until nChange becomes zero
- // NOTE: this depends on the exact behaviour of GetMinFee
- if (wtxNew.nTime < FEE_SWITCH_TIME && !fTestNet)
- {
- if (nFeeRet < MIN_TX_FEE && nChange > 0 && nChange < CENT)
- {
- int64_t nMoveToFee = min(nChange, MIN_TX_FEE - nFeeRet);
- nChange -= nMoveToFee;
- nFeeRet += nMoveToFee;
- }
-
- // sub-cent change is moved to fee
- if (nChange > 0 && nChange < CENT)
- {
- nFeeRet += nChange;
- nChange = 0;
- }
- }
-
if (nChange > 0)
{
// Fill a vout to ourself
dPriority /= nBytes;
// Check that enough fee is included
- int64_t nPayFee = nTransactionFee * (1 + (int64_t)nBytes / 1000);
bool fAllowFree = CTransaction::AllowFree(dPriority);
-
- // Disable free transactions until 1 July 2014
- if (!fTestNet && wtxNew.nTime < FEE_SWITCH_TIME)
- {
- fAllowFree = false;
- }
-
+ int64_t nPayFee = nTransactionFee * (1 + (int64_t)nBytes / 1000);
int64_t nMinFee = wtxNew.GetMinFee(1, fAllowFree, GMF_SEND, nBytes);
if (nFeeRet < max(nPayFee, nMinFee))