mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge pull request #376 from UdjinM6/v0.12.0.x_fees
V0.12.0.x fees fixes
This commit is contained in:
commit
6aa49e5a70
@ -27,5 +27,5 @@ CAmount CFeeRate::GetFee(size_t nSize) const
|
||||
|
||||
std::string CFeeRate::ToString() const
|
||||
{
|
||||
return strprintf("%d.%08d BTC/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN);
|
||||
return strprintf("%d.%08d DASH/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN);
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if(!AcceptableInputs(mempool, state, CTransaction(tx), false, NULL)) {
|
||||
if(!AcceptableInputs(mempool, state, CTransaction(tx), false, NULL, false, true)) {
|
||||
LogPrintf("dsi -- transaction not valid! \n");
|
||||
errorID = ERR_INVALID_TX;
|
||||
pfrom->PushMessage("dssu", sessionID, GetState(), GetEntriesCount(), MASTERNODE_REJECTED, errorID);
|
||||
@ -607,7 +607,7 @@ void CDarksendPool::CheckFinalTransaction()
|
||||
if(fDebug) LogPrintf("Transaction 2: %s\n", txNew.ToString().c_str());
|
||||
|
||||
// See if the transaction is valid
|
||||
if (!txNew.AcceptToMemoryPool(false))
|
||||
if (!txNew.AcceptToMemoryPool(false, true, true));
|
||||
{
|
||||
LogPrintf("CDarksendPool::Check() - CommitTransaction : Error: Transaction not valid\n");
|
||||
SetNull();
|
||||
@ -1190,7 +1190,7 @@ void CDarksendPool::SendDarksendDenominate(std::vector<CTxIn>& vin, std::vector<
|
||||
|
||||
LogPrintf("Submitting tx %s\n", tx.ToString().c_str());
|
||||
|
||||
if(!AcceptableInputs(mempool, state, CTransaction(tx), false, NULL)){
|
||||
if(!AcceptableInputs(mempool, state, CTransaction(tx), false, NULL, false, true)){
|
||||
LogPrintf("dsi -- transaction not valid! %s \n", tx.ToString().c_str());
|
||||
UnlockCoins();
|
||||
SetNull(true);
|
||||
|
@ -342,8 +342,8 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += " -keepassname=<name> " + _("Name to construct url for KeePass entry that stores the wallet passphrase") + "\n";
|
||||
strUsage += " -keypool=<n> " + strprintf(_("Set key pool size to <n> (default: %u)"), 100) + "\n";
|
||||
if (GetBoolArg("-help-debug", false))
|
||||
strUsage += " -mintxfee=<amt> " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"), FormatMoney(CWallet::minTxFee.GetFeePerK())) + "\n";
|
||||
strUsage += " -paytxfee=<amt> " + strprintf(_("Fee (in BTC/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())) + "\n";
|
||||
strUsage += " -mintxfee=<amt> " + strprintf(_("Fees (in DASH/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"), FormatMoney(CWallet::minTxFee.GetFeePerK())) + "\n";
|
||||
strUsage += " -paytxfee=<amt> " + strprintf(_("Fee (in DASH/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())) + "\n";
|
||||
strUsage += " -rescan " + _("Rescan the block chain for missing wallet transactions") + " " + _("on startup") + "\n";
|
||||
strUsage += " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup") + "\n";
|
||||
strUsage += " -sendfreetransactions " + strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), 0) + "\n";
|
||||
@ -389,7 +389,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += " -relaypriority " + strprintf(_("Require high priority for relaying free or low-fee transactions (default:%u)"), 1) + "\n";
|
||||
strUsage += " -maxsigcachesize=<n> " + strprintf(_("Limit size of signature cache to <n> entries (default: %u)"), 50000) + "\n";
|
||||
}
|
||||
strUsage += " -minrelaytxfee=<amt> " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for relaying (default: %s)"), FormatMoney(::minRelayTxFee.GetFeePerK())) + "\n";
|
||||
strUsage += " -minrelaytxfee=<amt> " + strprintf(_("Fees (in DASH/Kb) smaller than this are considered zero fee for relaying (default: %s)"), FormatMoney(::minRelayTxFee.GetFeePerK())) + "\n";
|
||||
strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n";
|
||||
if (GetBoolArg("-help-debug", false))
|
||||
{
|
||||
|
13
src/main.cpp
13
src/main.cpp
@ -63,8 +63,11 @@ bool fCheckBlockIndex = false;
|
||||
unsigned int nCoinCacheSize = 5000;
|
||||
|
||||
|
||||
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying and mining) */
|
||||
CFeeRate minRelayTxFee = CFeeRate(1000);
|
||||
/** Fees smaller than this (in duffs) are considered zero fee (for relaying and mining)
|
||||
* We are ~100 times smaller then bitcoin now (2015-06-23), set minRelayTxFee only 10 times higher
|
||||
* so it's still 10 times lower comparing to bitcoin.
|
||||
*/
|
||||
CFeeRate minRelayTxFee = CFeeRate(10000);
|
||||
|
||||
CTxMemPool mempool(::minRelayTxFee);
|
||||
|
||||
@ -4607,7 +4610,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
CTransaction tx;
|
||||
|
||||
//masternode signed transaction
|
||||
bool allowFree = false;
|
||||
bool ignoreFees = false;
|
||||
CTxIn vin;
|
||||
vector<unsigned char> vchSig;
|
||||
int64_t sigTime;
|
||||
@ -4638,7 +4641,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
|
||||
LogPrintf("dstx: Got Masternode transaction %s\n", tx.GetHash().ToString().c_str());
|
||||
|
||||
allowFree = true;
|
||||
ignoreFees = true;
|
||||
pmn->allowFreeTx = false;
|
||||
|
||||
if(!mapDarksendBroadcastTxes.count(tx.GetHash())){
|
||||
@ -4663,7 +4666,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
|
||||
mapAlreadyAskedFor.erase(inv);
|
||||
|
||||
if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs, false, allowFree))
|
||||
if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs, false, ignoreFees))
|
||||
{
|
||||
mempool.check(pcoinsTip);
|
||||
RelayTransaction(tx);
|
||||
|
@ -600,7 +600,7 @@ void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn
|
||||
tr("Error: The wallet was unlocked only to anonymize coins."),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
case WalletModel::InsaneFee:
|
||||
msgParams.first = tr("A fee higher than %1 is considered an insanely high fee.").arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), 10000000));
|
||||
msgParams.first = tr("A fee %1 times higher than %2 per kB is considered an insanely high fee.").arg(10000).arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), ::minRelayTxFee.GetFeePerK()));
|
||||
break;
|
||||
// included to prevent a compiler warning.
|
||||
case WalletModel::OK:
|
||||
|
@ -305,8 +305,8 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
|
||||
return TransactionCreationFailed;
|
||||
}
|
||||
|
||||
// reject insane fee > 0.1 DASH
|
||||
if (nFeeRequired > 10000000)
|
||||
// reject insane fee
|
||||
if (nFeeRequired > ::minRelayTxFee.GetFee(transaction.getTransactionSize()) * 10000)
|
||||
return InsaneFee;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,8 @@ Value getinfo(const Array& params, bool fHelp)
|
||||
" \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n"
|
||||
" \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n"
|
||||
" \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
|
||||
" \"paytxfee\": x.xxxx, (numeric) the transaction fee set in btc/kb\n"
|
||||
" \"relayfee\": x.xxxx, (numeric) minimum relay fee for non-free transactions in btc/kb\n"
|
||||
" \"paytxfee\": x.xxxx, (numeric) the transaction fee set in dash/kb\n"
|
||||
" \"relayfee\": x.xxxx, (numeric) minimum relay fee for non-free transactions in dash/kb\n"
|
||||
" \"errors\": \"...\" (string) any error messages\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
|
@ -395,7 +395,7 @@ Value getnetworkinfo(const Array& params, bool fHelp)
|
||||
" }\n"
|
||||
" ,...\n"
|
||||
" ],\n"
|
||||
" \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for non-free transactions in btc/kb\n"
|
||||
" \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for non-free transactions in dash/kb\n"
|
||||
" \"localaddresses\": [ (array) list of local addresses\n"
|
||||
" {\n"
|
||||
" \"address\": \"xxxx\", (string) network address\n"
|
||||
|
@ -1970,7 +1970,7 @@ Value settxfee(const Array& params, bool fHelp)
|
||||
"settxfee amount\n"
|
||||
"\nSet the transaction fee per kB.\n"
|
||||
"\nArguments:\n"
|
||||
"1. amount (numeric, required) The transaction fee in BTC/kB rounded to the nearest 0.00000001\n"
|
||||
"1. amount (numeric, required) The transaction fee in DASH/kB rounded to the nearest 0.00000001\n"
|
||||
"\nResult\n"
|
||||
"true|false (boolean) Returns true if successful\n"
|
||||
"\nExamples:\n"
|
||||
|
@ -666,7 +666,7 @@ CTxMemPool::WriteFeeEstimates(CAutoFile& fileout) const
|
||||
{
|
||||
try {
|
||||
LOCK(cs);
|
||||
fileout << 99900; // version required to read: 0.9.99 or later
|
||||
fileout << 120000; // version required to read: 0.12.00 or later
|
||||
fileout << CLIENT_VERSION; // version that wrote the file
|
||||
minerPolicyEstimator->Write(fileout);
|
||||
}
|
||||
|
@ -39,10 +39,12 @@ bool fSendFreeTransactions = false;
|
||||
bool fPayAtLeastCustomFee = true;
|
||||
|
||||
/**
|
||||
* Fees smaller than this (in satoshi) are considered zero fee (for transaction creation)
|
||||
* Fees smaller than this (in duffs) are considered zero fee (for transaction creation)
|
||||
* We are ~100 times smaller then bitcoin now (2015-06-23), set minTxFee 10 times higher
|
||||
* so it's still 10 times lower comparing to bitcoin.
|
||||
* Override with -mintxfee
|
||||
*/
|
||||
CFeeRate CWallet::minTxFee = CFeeRate(1000);
|
||||
CFeeRate CWallet::minTxFee = CFeeRate(10000);
|
||||
|
||||
/** @defgroup mapWallet
|
||||
*
|
||||
@ -3184,10 +3186,10 @@ int CMerkleTx::GetBlocksToMaturity() const
|
||||
}
|
||||
|
||||
|
||||
bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree, bool fRejectInsaneFee)
|
||||
bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree, bool fRejectInsaneFee, bool ignoreFees)
|
||||
{
|
||||
CValidationState state;
|
||||
return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL, fRejectInsaneFee);
|
||||
return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL, fRejectInsaneFee, ignoreFees);
|
||||
}
|
||||
|
||||
int CMerkleTx::GetTransactionLockSignatures() const
|
||||
|
@ -601,7 +601,7 @@ public:
|
||||
int GetDepthInMainChain(bool enableIX = true) const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet, enableIX); }
|
||||
bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
|
||||
int GetBlocksToMaturity() const;
|
||||
bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectInsaneFee=true);
|
||||
bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectInsaneFee=true, bool ignoreFees=false);
|
||||
int GetTransactionLockSignatures() const;
|
||||
bool IsTransactionLockTimedOut() const;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user