diff options
-rw-r--r-- | configure.ac | 22 | ||||
-rwxr-xr-x | contrib/devtools/symbol-check.py | 6 | ||||
-rw-r--r-- | depends/Makefile | 2 | ||||
-rw-r--r-- | depends/funcs.mk | 8 | ||||
-rw-r--r-- | doc/build-unix.md | 4 | ||||
-rwxr-xr-x | qa/pull-tester/run-bitcoind-for-test.sh.in | 2 | ||||
-rw-r--r-- | src/Makefile.am | 7 | ||||
-rw-r--r-- | src/alert.h | 6 | ||||
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/m4/bitcoin_qt.m4 | 4 | ||||
-rw-r--r-- | src/main.cpp | 9 | ||||
-rw-r--r-- | src/net.cpp | 10 | ||||
-rw-r--r-- | src/net.h | 1 | ||||
-rw-r--r-- | src/netbase.cpp | 12 | ||||
-rw-r--r-- | src/netbase.h | 3 | ||||
-rw-r--r-- | src/qt/guiutil.cpp | 2 | ||||
-rw-r--r-- | src/qt/guiutil.h | 2 | ||||
-rw-r--r-- | src/rpcnet.cpp | 33 | ||||
-rw-r--r-- | src/serialize.h | 39 | ||||
-rw-r--r-- | src/txdb.cpp | 6 | ||||
-rw-r--r-- | src/wallet.h | 6 |
21 files changed, 131 insertions, 55 deletions
diff --git a/configure.ac b/configure.ac index d6d56fae34..7db6ebac0e 100644 --- a/configure.ac +++ b/configure.ac @@ -510,15 +510,15 @@ if test x$boost_sleep != xyes; then AC_MSG_ERROR(No working boost sleep implementation found. If on ubuntu 13.10 with libboost1.54-all-dev remove libboost.1.54-all-dev and use libboost1.53-all-dev) fi -AC_ARG_WITH([cli], - [AS_HELP_STRING([--with-cli], - [with CLI (default is yes)])], - [build_bitcoin_cli=$withval], - [build_bitcoin_cli=yes]) +AC_ARG_WITH([utils], + [AS_HELP_STRING([--with-utils], + [build bitcoin-cli bitcoin-tx (default=yes)])], + [build_bitcoin_utils=$withval], + [build_bitcoin_utils=yes]) AC_ARG_WITH([daemon], [AS_HELP_STRING([--with-daemon], - [with daemon (default is yes)])], + [build bitcoind daemon (default=yes)])], [build_bitcoind=$withval], [build_bitcoind=yes]) @@ -562,9 +562,9 @@ AC_MSG_CHECKING([whether to build bitcoind]) AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes]) AC_MSG_RESULT($build_bitcoind) -AC_MSG_CHECKING([whether to build bitcoin-cli]) -AM_CONDITIONAL([BUILD_BITCOIN_CLI], [test x$build_bitcoin_cli = xyes]) -AC_MSG_RESULT($build_bitcoin_cli) +AC_MSG_CHECKING([whether to build utils (bitcoin-cli bitcoin-tx)]) +AM_CONDITIONAL([BUILD_BITCOIN_UTILS], [test x$build_bitcoin_utils = xyes]) +AC_MSG_RESULT($build_bitcoin_utils) dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus BITCOIN_QT_CONFIGURE([$use_pkgconfig], [qt4]) @@ -672,8 +672,8 @@ else AC_MSG_RESULT([no]) fi -if test "x$use_tests$build_bitcoind$use_qt" = "xnonono"; then - AC_MSG_ERROR([No targets! Please specify at least one of: --enable-cli --enable-daemon --enable-gui or --enable-tests]) +if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests = xnononono; then + AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-daemon --with-gui or --enable-tests]) fi AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin]) diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py index 8dd6d8f037..f3999f1c0b 100755 --- a/contrib/devtools/symbol-check.py +++ b/contrib/devtools/symbol-check.py @@ -41,6 +41,10 @@ MAX_VERSIONS = { 'GLIBCXX': (3,4,13), 'GLIBC': (2,11) } +# Ignore symbols that are exported as part of every executable +IGNORE_EXPORTS = { +'_edata', '_end', '_init', '__bss_start', '_fini' +} READELF_CMD = '/usr/bin/readelf' CPPFILT_CMD = '/usr/bin/c++filt' @@ -105,6 +109,8 @@ if __name__ == '__main__': retval = 1 # Check exported symbols for sym,version in read_symbols(filename, False): + if sym in IGNORE_EXPORTS: + continue print('%s: export of symbol %s not allowed' % (filename, cppfilt(sym))) retval = 1 diff --git a/depends/Makefile b/depends/Makefile index d431653068..bd5f0bf536 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -72,7 +72,7 @@ packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_pack native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) $(qt_native_packages_) all_packages = $(packages) $(native_packages) -meta_depends = Makefile builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk +meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk $(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain) diff --git a/depends/funcs.mk b/depends/funcs.mk index 4c47cc926e..b5d8b0ee2e 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -20,7 +20,11 @@ $(sort $(foreach dep,$(2),$(2) $(call int_get_all_dependencies,$(1),$($(dep)_dep endef define fetch_file -(test -f $(SOURCES_PATH)/$(3) || ( mkdir -p $$($(1)_extract_dir) && $(build_DOWNLOAD) "$$($(1)_extract_dir)/$(3).temp" "$(2)" && echo "$(4) $$($(1)_extract_dir)/$(3).temp" | $(build_SHA256SUM) -c && mv $$($(1)_extract_dir)/$(3).temp $(SOURCES_PATH)/$(3) )) +(test -f $(SOURCES_PATH)/$(3) || \ + ( mkdir -p $$($(1)_extract_dir) && $(build_DOWNLOAD) "$$($(1)_extract_dir)/$(3).temp" "$(2)" && \ + echo "$(4) $$($(1)_extract_dir)/$(3).temp" > $$($(1)_extract_dir)/.$(3).hash && \ + $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$(3).hash && \ + mv $$($(1)_extract_dir)/$(3).temp $(SOURCES_PATH)/$(3) )) endef define int_get_build_recipe_hash @@ -62,7 +66,7 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path)) #default commands $(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)/$$($(1)_download_file)),$($(1)_file_name),$($(1)_sha256_hash)) -$(1)_extract_cmds ?= echo "$$($(1)_sha256_hash) $$($(1)_source)" | $(build_SHA256SUM) -c && tar --strip-components=1 -xf $$($(1)_source) +$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --strip-components=1 -xf $$($(1)_source) $(1)_preprocess_cmds ?= $(1)_build_cmds ?= $(1)_config_cmds ?= diff --git a/doc/build-unix.md b/doc/build-unix.md index 0f381d56c5..56054456a3 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -76,10 +76,6 @@ for Ubuntu 12.04 and later: Ubuntu 12.04 and later have packages for libdb5.1-dev and libdb5.1++-dev, but using these will break binary wallet compatibility, and is not recommended. -for Ubuntu 13.10: - libboost1.54 will not work, - remove libboost1.54-all-dev and install libboost1.53-all-dev instead. - for Debian 7 (Wheezy) and later: The oldstable repository contains db4.8 packages. Add the following line to /etc/apt/sources.list, diff --git a/qa/pull-tester/run-bitcoind-for-test.sh.in b/qa/pull-tester/run-bitcoind-for-test.sh.in index e186bd7a23..67318e5a4c 100755 --- a/qa/pull-tester/run-bitcoind-for-test.sh.in +++ b/qa/pull-tester/run-bitcoind-for-test.sh.in @@ -9,7 +9,7 @@ mkdir -p "$DATADIR"/regtest touch "$DATADIR/regtest/debug.log" tail -q -n 1 -F "$DATADIR/regtest/debug.log" | grep -m 1 -q "Done loading" & WAITER=$! -PORT=`expr 10000 + $BASHPID % 55536` +PORT=`expr 10000 + $$ % 55536` "@abs_top_builddir@/src/bitcoind@EXEEXT@" -connect=0.0.0.0 -datadir="$DATADIR" -rpcuser=user -rpcpassword=pass -listen -keypool=3 -debug -debug=net -logtimestamps -port=$PORT -whitelist=127.0.0.1 -regtest -rpcport=`expr $PORT + 1` & BITCOIND=$! diff --git a/src/Makefile.am b/src/Makefile.am index bec019b49e..6292b5d613 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -55,12 +55,10 @@ if BUILD_BITCOIND bin_PROGRAMS += bitcoind endif -if BUILD_BITCOIN_CLI - bin_PROGRAMS += bitcoin-cli +if BUILD_BITCOIN_UTILS + bin_PROGRAMS += bitcoin-cli bitcoin-tx endif -bin_PROGRAMS += bitcoin-tx - .PHONY: FORCE # bitcoin core # BITCOIN_CORE_H = \ @@ -229,6 +227,7 @@ libbitcoin_util_a_SOURCES += compat/glibcxx_compat.cpp endif # cli: shared between bitcoin-cli and bitcoin-qt +libbitcoin_cli_a_CPPFLAGS = $(BITCOIN_INCLUDES) libbitcoin_cli_a_SOURCES = \ rpcclient.cpp \ $(BITCOIN_CORE_H) diff --git a/src/alert.h b/src/alert.h index da140be5e5..296d48891a 100644 --- a/src/alert.h +++ b/src/alert.h @@ -60,9 +60,9 @@ public: READWRITE(setSubVer); READWRITE(nPriority); - READWRITE(strComment); - READWRITE(strStatusBar); - READWRITE(strReserved); + READWRITE(LIMITED_STRING(strComment, 65536)); + READWRITE(LIMITED_STRING(strStatusBar, 256)); + READWRITE(LIMITED_STRING(strReserved, 256)); ) void SetNull(); diff --git a/src/init.cpp b/src/init.cpp index 8ae228bbbe..42956a8d69 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -247,7 +247,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") + "\n"; strUsage += " -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n"; strUsage += " -onion=<ip:port> " + _("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: -proxy)") + "\n"; - strUsage += " -onlynet=<net> " + _("Only connect to nodes in network <net> (IPv4, IPv6 or Tor)") + "\n"; + strUsage += " -onlynet=<net> " + _("Only connect to nodes in network <net> (ipv4, ipv6 or onion)") + "\n"; strUsage += " -permitbaremultisig " + _("Relay non-P2SH multisig (default: 1)") + "\n"; strUsage += " -port=<port> " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)") + "\n"; strUsage += " -proxy=<ip:port> " + _("Connect through SOCKS5 proxy") + "\n"; diff --git a/src/m4/bitcoin_qt.m4 b/src/m4/bitcoin_qt.m4 index 4c1d40c394..27000ecbac 100644 --- a/src/m4/bitcoin_qt.m4 +++ b/src/m4/bitcoin_qt.m4 @@ -48,8 +48,8 @@ dnl CAUTION: Do not use this inside of a conditional. AC_DEFUN([BITCOIN_QT_INIT],[ dnl enable qt support AC_ARG_WITH([gui], - [AS_HELP_STRING([--with-gui], - [with GUI (no|qt4|qt5|auto. default is auto, qt4 tried first.)])], + [AS_HELP_STRING([--with-gui@<:@=no|qt4|qt5|auto@:>@], + [build bitcoin-qt GUI (default=auto, qt4 tried first)])], [ bitcoin_qt_want_version=$withval if test x$bitcoin_qt_want_version = xyes; then diff --git a/src/main.cpp b/src/main.cpp index e135e93adb..09b10c8e55 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3568,7 +3568,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (!vRecv.empty()) vRecv >> addrFrom >> nNonce; if (!vRecv.empty()) { - vRecv >> pfrom->strSubVer; + vRecv >> LIMITED_STRING(pfrom->strSubVer, 256); pfrom->cleanSubVer = SanitizeString(pfrom->strSubVer); } if (!vRecv.empty()) @@ -4192,7 +4192,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (fDebug) { string strMsg; unsigned char ccode; string strReason; - vRecv >> strMsg >> ccode >> strReason; + vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, 111); ostringstream ss; ss << strMsg << " code " << itostr(ccode) << ": " << strReason; @@ -4203,10 +4203,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, vRecv >> hash; ss << ": hash " << hash.ToString(); } - // Truncate to reasonable length and sanitize before printing: - string s = ss.str(); - if (s.size() > 111) s.erase(111, string::npos); - LogPrint("net", "Reject %s\n", SanitizeString(s)); + LogPrint("net", "Reject %s\n", SanitizeString(ss.str())); } } diff --git a/src/net.cpp b/src/net.cpp index ec58f84b06..2443740c45 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -307,12 +307,18 @@ bool IsLocal(const CService& addr) return mapLocalHost.count(addr) > 0; } +/** check whether a given network is one we can probably connect to */ +bool IsReachable(enum Network net) +{ + LOCK(cs_mapLocalHost); + return vfReachable[net] && !vfLimited[net]; +} + /** check whether a given address is in a network we can probably connect to */ bool IsReachable(const CNetAddr& addr) { - LOCK(cs_mapLocalHost); enum Network net = addr.GetNetwork(); - return vfReachable[net] && !vfLimited[net]; + return IsReachable(net); } bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const char* pszKeyword, CNetAddr& ipRet) @@ -106,6 +106,7 @@ bool AddLocal(const CNetAddr& addr, int nScore = LOCAL_NONE); bool SeenLocal(const CService& addr); bool IsLocal(const CService& addr); bool GetLocal(CService &addr, const CNetAddr *paddrPeer = NULL); +bool IsReachable(enum Network net); bool IsReachable(const CNetAddr &addr); void SetReachable(enum Network net, bool fFlag = true); CAddress GetLocalAddress(const CNetAddr *paddrPeer = NULL); diff --git a/src/netbase.cpp b/src/netbase.cpp index 1031e7e38a..e1637cd404 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -47,10 +47,20 @@ enum Network ParseNetwork(std::string net) { boost::to_lower(net); if (net == "ipv4") return NET_IPV4; if (net == "ipv6") return NET_IPV6; - if (net == "tor") return NET_TOR; + if (net == "tor" || net == "onion") return NET_TOR; return NET_UNROUTABLE; } +std::string GetNetworkName(enum Network net) { + switch(net) + { + case NET_IPV4: return "ipv4"; + case NET_IPV6: return "ipv6"; + case NET_TOR: return "onion"; + default: return ""; + } +} + void SplitHostPort(std::string in, int &portOut, std::string &hostOut) { size_t colon = in.find_last_of(':'); // if a : is found, and it either follows a [...], or no other : is in the string, treat it as port separator diff --git a/src/netbase.h b/src/netbase.h index 7d83e35344..bd8dbf9695 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -26,7 +26,7 @@ extern bool fNameLookup; enum Network { - NET_UNROUTABLE, + NET_UNROUTABLE = 0, NET_IPV4, NET_IPV6, NET_TOR, @@ -164,6 +164,7 @@ class CService : public CNetAddr typedef CService proxyType; enum Network ParseNetwork(std::string net); +std::string GetNetworkName(enum Network net); void SplitHostPort(std::string in, int &portOut, std::string &hostOut); bool SetProxy(enum Network net, CService addrProxy); bool GetProxy(enum Network net, proxyType &proxyInfoOut); diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 389a08d9e8..304177ee11 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -810,7 +810,7 @@ QString formatDurationStr(int secs) return strList.join(" "); } -QString formatServicesStr(uint64_t mask) +QString formatServicesStr(quint64 mask) { QStringList strList; diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 0ae5154d4b..67e11e59a0 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -180,7 +180,7 @@ namespace GUIUtil QString formatDurationStr(int secs); /* Format CNodeStats.nServices bitmask into a user-readable string */ - QString formatServicesStr(uint64_t mask); + QString formatServicesStr(quint64 mask); /* Format a CNodeCombinedStats.dPingTime into a user-readable string or display N/A, if 0*/ QString formatPingTime(double dPingTime); diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 88e7c4ab07..2baa481c4e 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -338,6 +338,26 @@ Value getnettotals(const Array& params, bool fHelp) return obj; } +static Array GetNetworksInfo() +{ + Array networks; + for(int n=0; n<NET_MAX; ++n) + { + enum Network network = static_cast<enum Network>(n); + if(network == NET_UNROUTABLE) + continue; + proxyType proxy; + Object obj; + GetProxy(network, proxy); + obj.push_back(Pair("name", GetNetworkName(network))); + obj.push_back(Pair("limited", IsLimited(network))); + obj.push_back(Pair("reachable", IsReachable(network))); + obj.push_back(Pair("proxy", proxy.IsValid() ? proxy.ToStringIPPort() : string())); + networks.push_back(obj); + } + return networks; +} + Value getnetworkinfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) @@ -351,7 +371,13 @@ Value getnetworkinfo(const Array& params, bool fHelp) " \"localservices\": \"xxxxxxxxxxxxxxxx\", (string) the services we offer to the network\n" " \"timeoffset\": xxxxx, (numeric) the time offset\n" " \"connections\": xxxxx, (numeric) the number of connections\n" - " \"proxy\": \"host:port\", (string, optional) the proxy used by the server\n" + " \"networks\": [ (array) information per network\n" + " \"name\": \"xxx\", (string) network (ipv4, ipv6 or onion)\n" + " \"limited\": xxx, (boolean) is the network limited using -onlynet?\n" + " \"reachable\": xxx, (boolean) is the network reachable?\n" + " \"proxy\": \"host:port\" (string) the proxy that is used for this network, or empty if none\n" + " },\n" + " ],\n" " \"relayfee\": x.xxxx, (numeric) minimum relay fee for non-free transactions in btc/kb\n" " \"localaddresses\": [, (array) list of local addresses\n" " \"address\": \"xxxx\", (string) network address\n" @@ -364,16 +390,13 @@ Value getnetworkinfo(const Array& params, bool fHelp) + HelpExampleRpc("getnetworkinfo", "") ); - proxyType proxy; - GetProxy(NET_IPV4, proxy); - Object obj; obj.push_back(Pair("version", (int)CLIENT_VERSION)); obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION)); obj.push_back(Pair("localservices", strprintf("%016x", nLocalServices))); obj.push_back(Pair("timeoffset", GetTimeOffset())); obj.push_back(Pair("connections", (int)vNodes.size())); - obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.ToStringIPPort() : string()))); + obj.push_back(Pair("networks", GetNetworksInfo())); obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()))); Array localAddresses; { diff --git a/src/serialize.h b/src/serialize.h index f876efd9b5..2eb69b3ec0 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -334,8 +334,9 @@ I ReadVarInt(Stream& is) } } -#define FLATDATA(obj) REF(CFlatData((char*)&(obj), (char*)&(obj) + sizeof(obj))) -#define VARINT(obj) REF(WrapVarInt(REF(obj))) +#define FLATDATA(obj) REF(CFlatData((char*)&(obj), (char*)&(obj) + sizeof(obj))) +#define VARINT(obj) REF(WrapVarInt(REF(obj))) +#define LIMITED_STRING(obj,n) REF(LimitedString< n >(REF(obj))) /** Wrapper for serializing arrays and POD. */ @@ -398,6 +399,40 @@ public: } }; +template<size_t Limit> +class LimitedString +{ +protected: + std::string& string; +public: + LimitedString(std::string& string) : string(string) {} + + template<typename Stream> + void Unserialize(Stream& s, int, int=0) + { + size_t size = ReadCompactSize(s); + if (size > Limit) { + throw std::ios_base::failure("String length limit exceeded"); + } + string.resize(size); + if (size != 0) + s.read((char*)&string[0], size); + } + + template<typename Stream> + void Serialize(Stream& s, int, int=0) const + { + WriteCompactSize(s, string.size()); + if (!string.empty()) + s.write((char*)&string[0], string.size()); + } + + unsigned int GetSerializeSize(int, int=0) const + { + return GetSizeOfCompactSize(string.size()) + string.size(); + } +}; + template<typename I> CVarInt<I> WrapVarInt(I& n) { return CVarInt<I>(n); } diff --git a/src/txdb.cpp b/src/txdb.cpp index 52cd96283e..d3d05c58d7 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -103,7 +103,7 @@ bool CBlockTreeDB::ReadLastBlockFile(int &nFile) { } bool CCoinsViewDB::GetStats(CCoinsStats &stats) { - leveldb::Iterator *pcursor = db.NewIterator(); + boost::scoped_ptr<leveldb::Iterator> pcursor(db.NewIterator()); pcursor->SeekToFirst(); CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); @@ -146,7 +146,6 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } } - delete pcursor; stats.nHeight = mapBlockIndex.find(GetBestBlock())->second->nHeight; stats.hashSerialized = ss.GetHash(); stats.nTotalAmount = nTotalAmount; @@ -178,7 +177,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) { bool CBlockTreeDB::LoadBlockIndexGuts() { - leveldb::Iterator *pcursor = NewIterator(); + boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator()); CDataStream ssKeySet(SER_DISK, CLIENT_VERSION); ssKeySet << make_pair('b', uint256(0)); @@ -224,7 +223,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts() return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } } - delete pcursor; return true; } diff --git a/src/wallet.h b/src/wallet.h index 73fcfa24e0..864a635ec7 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -858,7 +858,7 @@ public: READWRITE(vchPrivKey); READWRITE(nTimeCreated); READWRITE(nTimeExpires); - READWRITE(strComment); + READWRITE(LIMITED_STRING(strComment, 65536)); ) }; @@ -933,7 +933,7 @@ public: // Note: strAccount is serialized as part of the key, not here. READWRITE(nCreditDebit); READWRITE(nTime); - READWRITE(strOtherAccount); + READWRITE(LIMITED_STRING(strOtherAccount, 65536)); if (!fRead) { @@ -949,7 +949,7 @@ public: } } - READWRITE(strComment); + READWRITE(LIMITED_STRING(strComment, 65536)); size_t nSepPos = strComment.find("\0", 0, 1); if (fRead) |