aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bitcoinrpc.cpp1
-rw-r--r--src/main.cpp7
-rw-r--r--src/main.h4
-rw-r--r--src/qt/bitcoingui.cpp35
-rw-r--r--src/rpcrawtransaction.cpp10
-rw-r--r--src/util.cpp12
-rw-r--r--src/wallet.cpp6
7 files changed, 42 insertions, 33 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index b61e0d37ab..f9e0c476f6 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -1223,6 +1223,7 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
if (strMethod == "createrawtransaction" && n > 1) ConvertTo<Object>(params[1]);
if (strMethod == "signrawtransaction" && n > 1) ConvertTo<Array>(params[1], true);
if (strMethod == "signrawtransaction" && n > 2) ConvertTo<Array>(params[2], true);
+ if (strMethod == "sendrawtransaction" && n > 1) ConvertTo<bool>(params[1], true);
if (strMethod == "gettxout" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "gettxout" && n > 2) ConvertTo<bool>(params[2]);
if (strMethod == "lockunspent" && n > 0) ConvertTo<bool>(params[0]);
diff --git a/src/main.cpp b/src/main.cpp
index 61d457eafc..5ee2deffc6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -787,7 +787,7 @@ void CTxMemPool::pruneSpent(const uint256 &hashTx, CCoins &coins)
}
bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fLimitFree,
- bool* pfMissingInputs)
+ bool* pfMissingInputs, bool fRejectInsaneFee)
{
if (pfMissingInputs)
*pfMissingInputs = false;
@@ -921,6 +921,11 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL
dFreeCount += nSize;
}
+ if (fRejectInsaneFee && nFees > CTransaction::nMinRelayTxFee * 10000)
+ return error("CTxMemPool::accept() : insane fees %s, %"PRI64d" > %"PRI64d,
+ hash.ToString().c_str(),
+ nFees, CTransaction::nMinRelayTxFee * 10000);
+
// Check against previous transactions
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
if (!CheckInputs(tx, state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC))
diff --git a/src/main.h b/src/main.h
index 7ce353d082..25a6d42272 100644
--- a/src/main.h
+++ b/src/main.h
@@ -1086,7 +1086,7 @@ public:
std::map<uint256, CTransaction> mapTx;
std::map<COutPoint, CInPoint> mapNextTx;
- bool accept(CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs);
+ bool accept(CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectInsaneFee = false);
bool addUnchecked(const uint256& hash, const CTransaction &tx);
bool remove(const CTransaction &tx, bool fRecursive = false);
bool removeConflicts(const CTransaction &tx);
@@ -1214,7 +1214,7 @@ public:
@see CTransaction::FetchInputs
*/
int64 GetValueIn(const CTransaction& tx);
-
+
// Check whether all prevouts of the transaction are present in the UTXO set represented by this view
bool HaveInputs(const CTransaction& tx);
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index bb9eb60e5b..49eb35dfec 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -590,21 +590,28 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned
int nMBoxIcon = QMessageBox::Information;
int nNotifyIcon = Notificator::Information;
- // Override title based on style
QString msgType;
- switch (style) {
- case CClientUIInterface::MSG_ERROR:
- msgType = tr("Error");
- break;
- case CClientUIInterface::MSG_WARNING:
- msgType = tr("Warning");
- break;
- case CClientUIInterface::MSG_INFORMATION:
- msgType = tr("Information");
- break;
- default:
- msgType = title; // Use supplied title
+
+ // Prefer supplied title over style based title
+ if (!title.isEmpty()) {
+ msgType = title;
+ }
+ else {
+ switch (style) {
+ case CClientUIInterface::MSG_ERROR:
+ msgType = tr("Error");
+ break;
+ case CClientUIInterface::MSG_WARNING:
+ msgType = tr("Warning");
+ break;
+ case CClientUIInterface::MSG_INFORMATION:
+ msgType = tr("Information");
+ break;
+ default:
+ break;
+ }
}
+ // Append title to "Bitcoin - "
if (!msgType.isEmpty())
strTitle += " - " + msgType;
@@ -625,7 +632,7 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned
if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK)))
buttons = QMessageBox::Ok;
- QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons);
+ QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this);
int r = mBox.exec();
if (ret != NULL)
*ret = r == QMessageBox::Ok;
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index 5f33849f77..ce9d60e667 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -518,9 +518,9 @@ Value signrawtransaction(const Array& params, bool fHelp)
Value sendrawtransaction(const Array& params, bool fHelp)
{
- if (fHelp || params.size() < 1 || params.size() > 1)
+ if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
- "sendrawtransaction <hex string>\n"
+ "sendrawtransaction <hex string> [allowhighfees=false]\n"
"Submits raw transaction (serialized, hex-encoded) to local node and network.");
// parse hex string from parameter
@@ -528,6 +528,10 @@ Value sendrawtransaction(const Array& params, bool fHelp)
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
CTransaction tx;
+ bool fOverrideFees = false;
+ if (params.size() > 1)
+ fOverrideFees = params[1].get_bool();
+
// deserialize binary data stream
try {
ssData >> tx;
@@ -545,7 +549,7 @@ Value sendrawtransaction(const Array& params, bool fHelp)
if (!fHave) {
// push to local node
CValidationState state;
- if (!mempool.accept(state, tx, false, NULL))
+ if (!mempool.accept(state, tx, false, NULL, !fOverrideFees))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state
}
}
diff --git a/src/util.cpp b/src/util.cpp
index 281ced2fa9..73428b4c22 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -198,15 +198,7 @@ uint256 GetRandHash()
return hash;
}
-
-
-
-
-
-
-//
-// OutputDebugStringF (aka printf -- there is a #define that we really
-// should get rid of one day) has been broken a couple of times now
+// LogPrintf() has been broken a couple of times now
// by well-meaning people adding mutexes in the most straightforward way.
// It breaks because it may be called by global destructors during shutdown.
// Since the order of destruction of static/global objects is undefined,
@@ -1065,7 +1057,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
fs::path &path = pathCached[nNet];
- // This can be called during exceptions by printf, so we cache the
+ // This can be called during exceptions by LogPrintf(), so we cache the
// value so we don't have to do memory allocations after that.
if (!path.empty())
return path;
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 91de93da7a..26ffc71e19 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -1145,11 +1145,11 @@ bool CWallet::SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfThe
nValueRet += vValue[i].first;
}
- LogPrintf("selectcoins", "SelectCoins() best subset: ");
+ LogPrint("selectcoins", "SelectCoins() best subset: ");
for (unsigned int i = 0; i < vValue.size(); i++)
if (vfBest[i])
- LogPrintf("selectcoins", "%s ", FormatMoney(vValue[i].first).c_str());
- LogPrintf("selectcoins", "total %s\n", FormatMoney(nBest).c_str());
+ LogPrint("selectcoins", "%s ", FormatMoney(vValue[i].first).c_str());
+ LogPrint("selectcoins", "total %s\n", FormatMoney(nBest).c_str());
}
return true;