diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/alert.cpp | 1 | ||||
-rw-r--r-- | src/core.h | 4 | ||||
-rw-r--r-- | src/db.cpp | 1 | ||||
-rw-r--r-- | src/init.cpp | 1 | ||||
-rw-r--r-- | src/main.cpp | 28 | ||||
-rw-r--r-- | src/net.h | 1 | ||||
-rw-r--r-- | src/qt/forms/overviewpage.ui | 4 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 2 | ||||
-rw-r--r-- | src/rpcnet.cpp | 2 | ||||
-rw-r--r-- | src/rpcrawtransaction.cpp | 4 | ||||
-rw-r--r-- | src/rpcwallet.cpp | 10 | ||||
-rw-r--r-- | src/script.cpp | 4 | ||||
-rw-r--r-- | src/test/transaction_tests.cpp | 4 | ||||
-rw-r--r-- | src/txdb.h | 6 | ||||
-rw-r--r-- | src/util.h | 27 | ||||
-rw-r--r-- | src/wallet.cpp | 2 | ||||
-rw-r--r-- | src/walletdb.cpp | 2 |
17 files changed, 60 insertions, 43 deletions
diff --git a/src/alert.cpp b/src/alert.cpp index 4dd3716e80..4429ecadce 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -11,7 +11,6 @@ #include "util.h" #include <algorithm> -#include <inttypes.h> #include <map> #include <boost/algorithm/string/classification.hpp> diff --git a/src/core.h b/src/core.h index e61cad90ec..5eb953610d 100644 --- a/src/core.h +++ b/src/core.h @@ -156,8 +156,8 @@ public: // to spend something, then we consider it dust. // A typical txout is 34 bytes big, and will // need a CTxIn of at least 148 bytes to spend, - // so dust is a txout less than 54 uBTC - // (5460 satoshis) with default nMinRelayTxFee + // so dust is a txout less than 546 satoshis + // with default nMinRelayTxFee. return ((nValue*1000)/(3*((int)GetSerializeSize(SER_DISK,0)+148)) < nMinRelayTxFee); } diff --git a/src/db.cpp b/src/db.cpp index 592512c947..591d4ed477 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -10,7 +10,6 @@ #include "protocol.h" #include "util.h" -#include <inttypes.h> #include <stdint.h> #ifndef WIN32 diff --git a/src/init.cpp b/src/init.cpp index c05ed4356c..4cc04f5205 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -24,7 +24,6 @@ #include "walletdb.h" #endif -#include <inttypes.h> #include <stdint.h> #ifndef WIN32 diff --git a/src/main.cpp b/src/main.cpp index 8e879c3169..53b99101d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,6 @@ #include "ui_interface.h" #include "util.h" -#include <inttypes.h> #include <sstream> #include <boost/algorithm/string/replace.hpp> @@ -53,7 +52,7 @@ unsigned int nCoinCacheSize = 5000; /** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */ int64_t CTransaction::nMinTxFee = 10000; // Override with -mintxfee /** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */ -int64_t CTransaction::nMinRelayTxFee = 10000; +int64_t CTransaction::nMinRelayTxFee = 1000; static CMedianFilter<int> cPeerBlockCounts(8, 0); // Amount of blocks that other nodes claim to have @@ -2276,6 +2275,11 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CDiskBlockPos* dbp) return state.DoS(100, error("AcceptBlock() : rejected by checkpoint lock-in at %d", nHeight), REJECT_CHECKPOINT, "checkpoint mismatch"); + // Don't accept any forks from the main chain prior to last checkpoint + CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); + if (pcheckpoint && nHeight < pcheckpoint->nHeight) + return state.DoS(100, error("AcceptBlock() : forked chain older than last checkpoint (height %d)", nHeight)); + // Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded: if (block.nVersion < 2) { @@ -3133,10 +3137,28 @@ void static ProcessGetData(CNode* pfrom) if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) { - // Send block from disk + bool send = false; map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(inv.hash); if (mi != mapBlockIndex.end()) { + // If the requested block is at a height below our last + // checkpoint, only serve it if it's in the checkpointed chain + int nHeight = mi->second->nHeight; + CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); + if (pcheckpoint && nHeight < pcheckpoint->nHeight) { + if (!chainActive.Contains(mi->second)) + { + LogPrintf("ProcessGetData(): ignoring request for old block that isn't in the main chain\n"); + } else { + send = true; + } + } else { + send = true; + } + } + if (send) + { + // Send block from disk CBlock block; ReadBlockFromDisk(block, (*mi).second); if (inv.type == MSG_BLOCK) @@ -18,7 +18,6 @@ #include "util.h" #include <deque> -#include <inttypes.h> #include <stdint.h> #ifndef WIN32 diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index d1ca969431..e662912781 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -105,7 +105,7 @@ <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="text"> - <string>Confirmed:</string> + <string>Available:</string> </property> </widget> </item> @@ -137,7 +137,7 @@ <item row="1" column="0"> <widget class="QLabel" name="label_3"> <property name="text"> - <string>Unconfirmed:</string> + <string>Pending:</string> </property> </widget> </item> diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 1a460b9278..3b83a5ff62 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -85,7 +85,7 @@ void OptionsModel::Init() #endif if (!settings.contains("nDatabaseCache")) - settings.setValue("nDatabaseCache", nDefaultDbCache); + settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache); if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString())) strOverriddenByCommandLine += "-dbcache "; diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index b764349338..738b966b8a 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -15,8 +15,6 @@ #include "wallet.h" // for getinfo #endif -#include <inttypes.h> - #include <boost/foreach.hpp> #include "json/json_spirit_value.h" diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index e2bdc80aef..837aee7eaa 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -522,7 +522,7 @@ Value signrawtransaction(const Array& params, bool fHelp) "\nArguments:\n" "1. \"hexstring\" (string, required) The transaction hex string\n" "2. \"prevtxs\" (string, optional) An json array of previous dependent transaction outputs\n" - " [ (json array of json objects)\n" + " [ (json array of json objects, or 'null' if none provided)\n" " {\n" " \"txid\":\"id\", (string, required) The transaction id\n" " \"vout\":n, (numeric, required) The output number\n" @@ -532,7 +532,7 @@ Value signrawtransaction(const Array& params, bool fHelp) " ,...\n" " ]\n" "3. \"privatekeys\" (string, optional) A json array of base58-encoded private keys for signing\n" - " [ (json array of strings)\n" + " [ (json array of strings, or 'null' if none provided)\n" " \"privatekey\" (string) private key in base58-encoding\n" " ,...\n" " ]\n" diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 3b0c84e49e..7b605af589 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1114,10 +1114,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe Object entry; entry.push_back(Pair("account", strSentAccount)); MaybePushAddress(entry, s.first); - if (wtx.GetDepthInMainChain() < 0) - entry.push_back(Pair("category", "conflicted")); - else - entry.push_back(Pair("category", "send")); + entry.push_back(Pair("category", "send")); entry.push_back(Pair("amount", ValueFromAmount(-s.second))); entry.push_back(Pair("fee", ValueFromAmount(-nFee))); if (fLong) @@ -1150,10 +1147,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe } else { - if (wtx.GetDepthInMainChain() < 0) - entry.push_back(Pair("category", "conflicted")); - else - entry.push_back(Pair("category", "receive")); + entry.push_back(Pair("category", "receive")); } entry.push_back(Pair("amount", ValueFromAmount(r.second))); if (fLong) diff --git a/src/script.cpp b/src/script.cpp index 83fc91956c..f03a1e3cbb 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1261,7 +1261,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi // Template matching opcodes: if (opcode2 == OP_PUBKEYS) { - while (vch1.size() >= 33 && vch1.size() <= 120) + while (vch1.size() >= 33 && vch1.size() <= 65) { vSolutionsRet.push_back(vch1); if (!script1.GetOp(pc1, opcode1, vch1)) @@ -1275,7 +1275,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi if (opcode2 == OP_PUBKEY) { - if (vch1.size() < 33 || vch1.size() > 120) + if (vch1.size() < 33 || vch1.size() > 65) break; vSolutionsRet.push_back(vch1); } diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index ad33184bc5..5212dfc70d 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -271,10 +271,10 @@ BOOST_AUTO_TEST_CASE(test_IsStandard) string reason; BOOST_CHECK(IsStandardTx(t, reason)); - t.vout[0].nValue = 5011; // dust + t.vout[0].nValue = 501; // dust BOOST_CHECK(!IsStandardTx(t, reason)); - t.vout[0].nValue = 6011; // not dust + t.vout[0].nValue = 601; // not dust BOOST_CHECK(IsStandardTx(t, reason)); t.vout[0].scriptPubKey = CScript() << OP_1; diff --git a/src/txdb.h b/src/txdb.h index 0512396e97..5eb5731db3 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -19,11 +19,11 @@ class CCoins; class uint256; // -dbcache default (MiB) -static const int nDefaultDbCache = 100; +static const int64_t nDefaultDbCache = 100; // max. -dbcache in (MiB) -static const int nMaxDbCache = sizeof(void*) > 4 ? 4096 : 1024; +static const int64_t nMaxDbCache = sizeof(void*) > 4 ? 4096 : 1024; // min. -dbcache in (MiB) -static const int nMinDbCache = 4; +static const int64_t nMinDbCache = 4; /** CCoinsView backed by the LevelDB coin database (chainstate/) */ class CCoinsViewDB : public CCoinsView diff --git a/src/util.h b/src/util.h index 6f7627e090..6ef93021fd 100644 --- a/src/util.h +++ b/src/util.h @@ -16,7 +16,6 @@ #include <cstdio> #include <exception> -#include <inttypes.h> #include <map> #include <stdarg.h> #include <stdint.h> @@ -45,13 +44,25 @@ static const int64_t CENT = 1000000; #define UEND(a) ((unsigned char*)&((&(a))[1])) #define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0])) -/* Format characters for (s)size_t and ptrdiff_t (C99 standard) */ -#define PRIszx "zx" -#define PRIszu "zu" -#define PRIszd "zd" -#define PRIpdx "tx" -#define PRIpdu "tu" -#define PRIpdd "td" +/* Format characters for (s)size_t, ptrdiff_t, uint64_t. + * + * As the tinyformat-based formatting system is type-safe, no special format + * characters are really needed to specify sizes. Tinyformat can support + * (ignores) the C99 prefixes such as "ll" but chokes on MSVC's inttypes + * defines prefixes such as "I64X". So don't include inttypes.h and define our + * own for compatibility. + * If you get a warning here about a redefine of PRI?64, make sure that + * inttypes.h is not included. + */ +#define PRIszx "x" +#define PRIszu "u" +#define PRIszd "d" +#define PRIpdx "x" +#define PRIpdu "u" +#define PRIpdd "d" +#define PRIx64 "x" +#define PRIu64 "u" +#define PRId64 "d" // This is needed because the foreach macro can't get over the comma in pair<t1, t2> #define PAIRTYPE(t1, t2) std::pair<t1, t2> diff --git a/src/wallet.cpp b/src/wallet.cpp index 82f71d24a5..5e24738b54 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -9,8 +9,6 @@ #include "coincontrol.h" #include "net.h" -#include <inttypes.h> - #include <boost/algorithm/string/replace.hpp> #include <openssl/rand.h> diff --git a/src/walletdb.cpp b/src/walletdb.cpp index b3816a54b6..b5b523740b 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -11,8 +11,6 @@ #include "sync.h" #include "wallet.h" -#include <inttypes.h> - #include <boost/filesystem.hpp> #include <boost/foreach.hpp> |