From: Pieter Wuille Date: Fri, 6 Apr 2012 11:11:14 +0000 (-0700) Subject: Merge pull request #1033 from sipa/wait X-Git-Tag: v0.4.0-unstable~129^2~99 X-Git-Url: https://git.novaco.in/?a=commitdiff_plain;h=9362da78b0d8f0dd7bbad259adcb3e4d0cf58e56;hp=092631f0ba0030dec1ccfa66e206fb2a6c9bf73b;p=novacoin.git Merge pull request #1033 from sipa/wait Condition variables instead of polling --- diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 7ad9403..edb0fad 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -62,12 +62,6 @@ contains(USE_DBUS, 1) { QT += dbus } -# use: qmake "USE_SSL=1" -contains(USE_SSL, 1) { - message(Building with SSL support for RPC) - DEFINES += USE_SSL -} - # use: qmake "FIRST_CLASS_MESSAGING=1" contains(FIRST_CLASS_MESSAGING, 1) { message(Building with first-class messaging) @@ -87,7 +81,7 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) { } # disable quite some warnings because bitcoin core "sins" a lot -QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wno-strict-aliasing -Wno-invalid-offsetof -Wno-unused-variable -Wno-unused-parameter -Wno-sign-compare -Wno-char-subscripts -Wno-unused-value -Wno-sequence-point -Wno-parentheses -Wno-unknown-pragmas -Wno-switch +QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wno-strict-aliasing -Wno-invalid-offsetof -Wno-unused-variable -Wno-unused-parameter -Wno-sign-compare -Wno-char-subscripts -Wno-unused-value -Wno-sequence-point -Wno-parentheses -Wno-unknown-pragmas -Wno-switch # Input DEPENDPATH += src/qt src src json/include diff --git a/contrib/debian/rules b/contrib/debian/rules index 6d6f119..49c7766 100755 --- a/contrib/debian/rules +++ b/contrib/debian/rules @@ -20,7 +20,7 @@ override_dh_auto_clean: cd src; $(MAKE) -f makefile.unix clean override_dh_auto_configure: - qmake bitcoin-qt.pro USE_SSL=1 USE_QRCODE=1 + qmake bitcoin-qt.pro USE_QRCODE=1 override_dh_auto_test: cd src; $(MAKE) -f makefile.unix test_bitcoin diff --git a/contrib/gitian-descriptors/gitian-win32.yml b/contrib/gitian-descriptors/gitian-win32.yml index 9e372c7..e929eb8 100644 --- a/contrib/gitian-descriptors/gitian-win32.yml +++ b/contrib/gitian-descriptors/gitian-win32.yml @@ -52,7 +52,7 @@ script: | export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME export TZ=UTC - $HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross USE_SSL=1 MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_47_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_47_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.0e OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.0e/include QRENCODE_LIB_PATH=$HOME/build/qrencode-3.2.0/.libs QRENCODE_INCLUDE_PATH=$HOME/build/qrencode-3.2.0 USE_QRCODE=1 INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin QMAKE_LFLAGS=-frandom-seed=bitcoin + $HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_47_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_47_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.0e OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.0e/include QRENCODE_LIB_PATH=$HOME/build/qrencode-3.2.0/.libs QRENCODE_INCLUDE_PATH=$HOME/build/qrencode-3.2.0 USE_QRCODE=1 INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin QMAKE_LFLAGS=-frandom-seed=bitcoin make $MAKEOPTS cp release/bitcoin-qt.exe $OUTDIR/ # @@ -61,7 +61,7 @@ script: | export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME export TZ=UTC - make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoind.exe USE_SSL=1 USE_UPNP=0 + make -f makefile.linux-mingw $MAKEOPTS DEPSDIR=$HOME/build bitcoind.exe USE_UPNP=0 i586-mingw32msvc-strip bitcoind.exe makensis ../share/setup.nsi cp ../share/bitcoin-*-win32-setup.exe $OUTDIR/ diff --git a/contrib/gitian-descriptors/gitian.yml b/contrib/gitian-descriptors/gitian.yml index 086e097..de622e9 100644 --- a/contrib/gitian-descriptors/gitian.yml +++ b/contrib/gitian-descriptors/gitian.yml @@ -48,10 +48,10 @@ script: | cp $OUTDIR/src/COPYING $OUTDIR cd src sed 's/$(DEBUGFLAGS)//' -i makefile.unix - make -f makefile.unix STATIC=1 OPENSSL_INCLUDE_PATH="$INSTDIR/include" OPENSSL_LIB_PATH="$INSTDIR/lib" $MAKEOPTS bitcoind USE_UPNP=0 USE_SSL=1 + make -f makefile.unix STATIC=1 OPENSSL_INCLUDE_PATH="$INSTDIR/include" OPENSSL_LIB_PATH="$INSTDIR/lib" $MAKEOPTS bitcoind USE_UPNP=0 mkdir -p $OUTDIR/bin/$GBUILD_BITS install -s bitcoind $OUTDIR/bin/$GBUILD_BITS cd .. - qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" RELEASE=1 USE_SSL=1 USE_QRCODE=1 + qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" RELEASE=1 USE_QRCODE=1 make $MAKEOPTS install bitcoin-qt $OUTDIR/bin/$GBUILD_BITS diff --git a/doc/assets-attribution.txt b/doc/assets-attribution.txt index fabcdee..0b0e377 100644 --- a/doc/assets-attribution.txt +++ b/doc/assets-attribution.txt @@ -1,3 +1,7 @@ +Code: src/strlcpy.h +Author: Todd C. Miller +License: ISC + Icon: src/qt/res/icons/clock*.png, src/qt/res/icons/tx*.png, src/qt/res/src/*.svg Designer: Wladimir van der Laan diff --git a/doc/release-process.txt b/doc/release-process.txt index 977780c..051a215 100644 --- a/doc/release-process.txt +++ b/doc/release-process.txt @@ -79,7 +79,7 @@ Gavin also had trouble with the macports py27-appscript package; he ended up installing a version that worked with: /usr/bin/easy_install-2.7 appscript - qmake RELEASE=1 USE_SSL=1 USE_UPNP=1 USE_QRCODE=1 bitcoin-qt.pro + qmake RELEASE=1 USE_UPNP=1 USE_QRCODE=1 bitcoin-qt.pro make export QTDIR=/opt/local/share/qt4 # needed to find translations/qt_*.qm files T=$(contrib/qt_translations.py $QTDIR/translations src/qt/locale) diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index eb2f04f..8cd4750 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -14,12 +14,11 @@ #include #include #include -#ifdef USE_SSL #include #include #include typedef boost::asio::ssl::stream SSLStream; -#endif + #include "json/json_spirit_reader_template.h" #include "json/json_spirit_writer_template.h" #include "json/json_spirit_utils.h" @@ -986,8 +985,6 @@ Value addmultisigaddress(const Array& params, bool fHelp) "If [account] is specified, assign address to [account]."; throw runtime_error(msg); } - if (!fTestNet) - throw runtime_error("addmultisigaddress available only when running -testnet\n"); int nRequired = params[0].get_int(); const Array& keys = params[1].get_array(); @@ -2275,7 +2272,6 @@ bool ClientAllowed(const string& strAddress) return false; } -#ifdef USE_SSL // // IOStream device that speaks SSL but can also speak non-SSL // @@ -2327,7 +2323,6 @@ private: bool fUseSSL; SSLStream& stream; }; -#endif void ThreadRPCServer(void* parg) { @@ -2386,7 +2381,6 @@ void ThreadRPCServer2(void* parg) acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); -#ifdef USE_SSL ssl::context context(io_service, ssl::context::sslv23); if (fUseSSL) { @@ -2404,29 +2398,17 @@ void ThreadRPCServer2(void* parg) "TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH"); SSL_CTX_set_cipher_list(context.impl(), ciphers.c_str()); } -#else - if (fUseSSL) - throw runtime_error("-rpcssl=1, but bitcoin compiled without full openssl libraries."); -#endif loop { // Accept connection -#ifdef USE_SSL SSLStream sslStream(io_service, context); SSLIOStreamDevice d(sslStream, fUseSSL); iostreams::stream stream(d); -#else - ip::tcp::iostream stream; -#endif ip::tcp::endpoint peer; vnThreadsRunning[THREAD_RPCSERVER]--; -#ifdef USE_SSL acceptor.accept(sslStream.lowest_layer(), peer); -#else - acceptor.accept(*stream.rdbuf(), peer); -#endif vnThreadsRunning[4]++; if (fShutdown) return; @@ -2553,7 +2535,6 @@ Object CallRPC(const string& strMethod, const Array& params) // Connect to localhost bool fUseSSL = GetBoolArg("-rpcssl"); -#ifdef USE_SSL asio::io_service io_service; ssl::context context(io_service, ssl::context::sslv23); context.set_options(ssl::context::no_sslv2); @@ -2562,15 +2543,6 @@ Object CallRPC(const string& strMethod, const Array& params) iostreams::stream stream(d); if (!d.connect(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "8332"))) throw runtime_error("couldn't connect to server"); -#else - if (fUseSSL) - throw runtime_error("-rpcssl=1, but bitcoin compiled without full openssl libraries."); - - ip::tcp::iostream stream(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "8332")); - if (stream.fail()) - throw runtime_error("couldn't connect to server"); -#endif - // HTTP basic authentication string strUserPass64 = EncodeBase64(mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"]); diff --git a/src/crypter.cpp b/src/crypter.cpp index 6643bcd..83041ad 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -73,14 +73,16 @@ bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector& vchCiphertext, CKeyingM EVP_CIPHER_CTX ctx; - EVP_CIPHER_CTX_init(&ctx); - EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV); - - EVP_DecryptUpdate(&ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen); - EVP_DecryptFinal_ex(&ctx, (&vchPlaintext[0])+nPLen, &nFLen); + bool fOk = true; + EVP_CIPHER_CTX_init(&ctx); + if (fOk) fOk = EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV); + if (fOk) fOk = EVP_DecryptUpdate(&ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen); + if (fOk) fOk = EVP_DecryptFinal_ex(&ctx, (&vchPlaintext[0])+nPLen, &nFLen); EVP_CIPHER_CTX_cleanup(&ctx); + if (!fOk) return false; + vchPlaintext.resize(nPLen + nFLen); return true; } diff --git a/src/db.cpp b/src/db.cpp index 2a09e2e..b86a56e 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -28,7 +28,6 @@ static bool fDbEnvInit = false; DbEnv dbenv(0); static map mapFileUseCount; static map mapDb; -static int64 nTxn = 0; static void EnvShutdown() { @@ -164,13 +163,7 @@ void CDB::Close() if (strFile == "blkindex.dat" && IsInitialBlockDownload()) nMinutes = 5; - if (nMinutes == 0 || nTxn > 200000) - { - nTxn = 0; - nMinutes = 0; - } - - dbenv.txn_checkpoint(0, nMinutes, 0); + dbenv.txn_checkpoint(nMinutes ? GetArg("-dblogsize", 100)*1024 : 0, nMinutes, 0); CRITICAL_BLOCK(cs_db) --mapFileUseCount[strFile]; @@ -344,7 +337,6 @@ bool CTxDB::ReadTxIndex(uint256 hash, CTxIndex& txindex) bool CTxDB::UpdateTxIndex(uint256 hash, const CTxIndex& txindex) { assert(!fClient); - nTxn++; return Write(make_pair(string("tx"), hash), txindex); } @@ -355,7 +347,6 @@ bool CTxDB::AddTxIndex(const CTransaction& tx, const CDiskTxPos& pos, int nHeigh // Add to tx index uint256 hash = tx.GetHash(); CTxIndex txindex(pos, tx.vout.size()); - nTxn++; return Write(make_pair(string("tx"), hash), txindex); } diff --git a/src/init.cpp b/src/init.cpp index eecbc83..3f900fc 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -171,6 +171,7 @@ bool AppInit2(int argc, char* argv[]) " -splash \t\t " + _("Show splash screen on startup (default: 1)") + "\n" + " -datadir= \t\t " + _("Specify data directory") + "\n" + " -dbcache= \t\t " + _("Set database cache size in megabytes (default: 25)") + "\n" + + " -dblogsize= \t\t " + _("Set database disk log size in megabytes (default: 100)") + "\n" + " -timeout= \t " + _("Specify connection timeout (in milliseconds)") + "\n" + " -proxy= \t " + _("Connect through socks4 proxy") + "\n" + " -dns \t " + _("Allow DNS lookups for addnode and connect") + "\n" + @@ -221,14 +222,12 @@ bool AppInit2(int argc, char* argv[]) " -checkblocks= \t\t " + _("How many blocks to check at startup (default: 2500, 0 = all)") + "\n" + " -checklevel= \t\t " + _("How thorough the block verification is (0-6, default: 1)") + "\n"; -#ifdef USE_SSL strUsage += string() + _("\nSSL options: (see the Bitcoin Wiki for SSL setup instructions)") + "\n" + " -rpcssl \t " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n" + " -rpcsslcertificatechainfile=\t " + _("Server certificate file (default: server.cert)") + "\n" + " -rpcsslprivatekeyfile= \t " + _("Server private key (default: server.pem)") + "\n" + " -rpcsslciphers= \t " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)") + "\n"; -#endif strUsage += string() + " -? \t\t " + _("This help message") + "\n"; diff --git a/src/keystore.cpp b/src/keystore.cpp index e76f779..23f9e32 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -84,6 +84,8 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) CSecret vchSecret; if(!DecryptSecret(vMasterKeyIn, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecret)) return false; + if (vchSecret.size() != 32) + return false; CKey key; key.SetPubKey(vchPubKey); key.SetSecret(vchSecret); @@ -146,6 +148,8 @@ bool CCryptoKeyStore::GetKey(const CBitcoinAddress &address, CKey& keyOut) const CSecret vchSecret; if (!DecryptSecret(vMasterKey, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecret)) return false; + if (vchSecret.size() != 32) + return false; keyOut.SetPubKey(vchPubKey); keyOut.SetSecret(vchSecret); return true; diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index 0bbe612..3f7e611 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -26,7 +26,7 @@ LIBS= \ -l ssl \ -l crypto -DEFS=-D_MT -DWIN32 -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB +DEFS=-D_MT -DWIN32 -D_WINDOWS -DNOPCH -DBOOST_THREAD_USE_LIB DEBUGFLAGS=-g CFLAGS=-O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) diff --git a/src/makefile.mingw b/src/makefile.mingw index 307fca7..33cc68b 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -23,7 +23,7 @@ LIBS= \ -l ssl \ -l crypto -DEFS=-DWIN32 -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB +DEFS=-DWIN32 -D_WINDOWS -DNOPCH -DBOOST_THREAD_USE_LIB DEBUGFLAGS=-g CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) diff --git a/src/makefile.osx b/src/makefile.osx index 6388a71..ed35b33 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -49,12 +49,19 @@ LIBS += \ TESTDEFS += -DBOOST_TEST_DYN_LINK endif -DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DUSE_SSL +DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 + +ifdef RELEASE +# Compile for maximum compatibility and smallest size. +# This requires that dependencies are compiled +# the same way. +CFLAGS = -mmacosx-version-min=10.5 -arch i386 -O3 +else +CFLAGS = -g +endif -DEBUGFLAGS=-g # ppc doesn't work because we don't support big-endian -CFLAGS=-mmacosx-version-min=10.5 -arch i386 -O3 \ - -Wextra -Wno-sign-compare -Wno-char-subscripts -Wno-invalid-offsetof -Wformat-security \ +CFLAGS += -Wextra -Wno-sign-compare -Wno-char-subscripts -Wno-invalid-offsetof -Wformat-security \ $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) OBJS= \ diff --git a/src/makefile.unix b/src/makefile.unix index 66e020b..1fb8e27 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -39,10 +39,6 @@ ifneq (${USE_UPNP}, -) DEFS += -DUSE_UPNP=$(USE_UPNP) endif -ifneq (${USE_SSL}, 0) - DEFS += -DUSE_SSL -endif - LIBS+= \ -Wl,-B$(LMODE2) \ -l z \ diff --git a/src/net.cpp b/src/net.cpp index 2d9cf6e..59bace4 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -292,105 +292,6 @@ void AddressCurrentlyConnected(const CService& addr) -void AbandonRequests(void (*fn)(void*, CDataStream&), void* param1) -{ - // If the dialog might get closed before the reply comes back, - // call this in the destructor so it doesn't get called after it's deleted. - CRITICAL_BLOCK(cs_vNodes) - { - BOOST_FOREACH(CNode* pnode, vNodes) - { - CRITICAL_BLOCK(pnode->cs_mapRequests) - { - for (map::iterator mi = pnode->mapRequests.begin(); mi != pnode->mapRequests.end();) - { - CRequestTracker& tracker = (*mi).second; - if (tracker.fn == fn && tracker.param1 == param1) - pnode->mapRequests.erase(mi++); - else - mi++; - } - } - } - } -} - - - - - - - -// -// Subscription methods for the broadcast and subscription system. -// Channel numbers are message numbers, i.e. MSG_TABLE and MSG_PRODUCT. -// -// The subscription system uses a meet-in-the-middle strategy. -// With 100,000 nodes, if senders broadcast to 1000 random nodes and receivers -// subscribe to 1000 random nodes, 99.995% (1 - 0.99^1000) of messages will get through. -// - -bool AnySubscribed(unsigned int nChannel) -{ - if (pnodeLocalHost->IsSubscribed(nChannel)) - return true; - CRITICAL_BLOCK(cs_vNodes) - BOOST_FOREACH(CNode* pnode, vNodes) - if (pnode->IsSubscribed(nChannel)) - return true; - return false; -} - -bool CNode::IsSubscribed(unsigned int nChannel) -{ - if (nChannel >= vfSubscribe.size()) - return false; - return vfSubscribe[nChannel]; -} - -void CNode::Subscribe(unsigned int nChannel, unsigned int nHops) -{ - if (nChannel >= vfSubscribe.size()) - return; - - if (!AnySubscribed(nChannel)) - { - // Relay subscribe - CRITICAL_BLOCK(cs_vNodes) - BOOST_FOREACH(CNode* pnode, vNodes) - if (pnode != this) - pnode->PushMessage("subscribe", nChannel, nHops); - } - - vfSubscribe[nChannel] = true; -} - -void CNode::CancelSubscribe(unsigned int nChannel) -{ - if (nChannel >= vfSubscribe.size()) - return; - - // Prevent from relaying cancel if wasn't subscribed - if (!vfSubscribe[nChannel]) - return; - vfSubscribe[nChannel] = false; - - if (!AnySubscribed(nChannel)) - { - // Relay subscription cancel - CRITICAL_BLOCK(cs_vNodes) - BOOST_FOREACH(CNode* pnode, vNodes) - if (pnode != this) - pnode->PushMessage("sub-cancel", nChannel); - } -} - - - - - - - CNode* FindNode(const CNetAddr& ip) @@ -491,13 +392,6 @@ void CNode::CloseSocketDisconnect() void CNode::Cleanup() { - // All of a nodes broadcasts and subscriptions are automatically torn down - // when it goes down, so a node has to stay up to keep its broadcast going. - - // Cancel subscriptions - for (unsigned int nChannel = 0; nChannel < vfSubscribe.size(); nChannel++) - if (vfSubscribe[nChannel]) - CancelSubscribe(nChannel); } diff --git a/src/net.h b/src/net.h index ed9954b..cd707e7 100644 --- a/src/net.h +++ b/src/net.h @@ -29,7 +29,6 @@ extern int nBestHeight; inline unsigned int ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 10*1000); } inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 10*1000); } -static const unsigned int PUBLISH_HOPS = 5; bool RecvLine(SOCKET hSocket, std::string& strLine); bool GetMyExternalIP(CNetAddr& ipRet); @@ -37,8 +36,6 @@ void AddressCurrentlyConnected(const CService& addr); CNode* FindNode(const CNetAddr& ip); CNode* FindNode(const CService& ip); CNode* ConnectNode(CAddress addrConnect, int64 nTimeout=0); -void AbandonRequests(void (*fn)(void*, CDataStream&), void* param1); -bool AnySubscribed(unsigned int nChannel); void MapPort(bool fMapPort); bool BindListenPort(std::string& strError=REF(std::string())); void StartNode(void* parg); @@ -160,9 +157,6 @@ public: CCriticalSection cs_inventory; std::multimap mapAskFor; - // publish and subscription - std::vector vfSubscribe; - CNode(SOCKET hSocketIn, CAddress addrIn, bool fInboundIn=false) { nServices = 0; @@ -192,7 +186,6 @@ public: hashLastGetBlocksEnd = 0; nStartingHeight = -1; fGetAddr = false; - vfSubscribe.assign(256, false); nMisbehavior = 0; setInventoryKnown.max_size(SendBufferSize() / 1000); @@ -634,58 +627,4 @@ inline void RelayMessage<>(const CInv& inv, const CDataStream& ss) } - - - - - - -// -// Templates for the publish and subscription system. -// The object being published as T& obj needs to have: -// a set setSources member -// specializations of AdvertInsert and AdvertErase -// Currently implemented for CTable and CProduct. -// - -template -void AdvertStartPublish(CNode* pfrom, unsigned int nChannel, unsigned int nHops, T& obj) -{ - // Add to sources - obj.setSources.insert(pfrom->addr.ip); - - if (!AdvertInsert(obj)) - return; - - // Relay - CRITICAL_BLOCK(cs_vNodes) - BOOST_FOREACH(CNode* pnode, vNodes) - if (pnode != pfrom && (nHops < PUBLISH_HOPS || pnode->IsSubscribed(nChannel))) - pnode->PushMessage("publish", nChannel, nHops, obj); -} - -template -void AdvertStopPublish(CNode* pfrom, unsigned int nChannel, unsigned int nHops, T& obj) -{ - uint256 hash = obj.GetHash(); - - CRITICAL_BLOCK(cs_vNodes) - BOOST_FOREACH(CNode* pnode, vNodes) - if (pnode != pfrom && (nHops < PUBLISH_HOPS || pnode->IsSubscribed(nChannel))) - pnode->PushMessage("pub-cancel", nChannel, nHops, hash); - - AdvertErase(obj); -} - -template -void AdvertRemoveSource(CNode* pfrom, unsigned int nChannel, unsigned int nHops, T& obj) -{ - // Remove a source - obj.setSources.erase(pfrom->addr.ip); - - // If no longer supported by any sources, cancel it - if (obj.setSources.empty()) - AdvertStopPublish(pfrom, nChannel, nHops, obj); -} - #endif diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index 8f2bba2..e631a65 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -1,5 +1,5 @@ - + res/icons/bitcoin.png res/icons/address-book.png res/icons/quit.png diff --git a/src/qt/forms/messagepage.ui b/src/qt/forms/messagepage.ui index 131e15b..8bd6d8b 100644 --- a/src/qt/forms/messagepage.ui +++ b/src/qt/forms/messagepage.ui @@ -35,7 +35,7 @@ - The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L) + The address to sign the message with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L) 34 diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index d59536e..8180aad 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -6,15 +6,8 @@ #include "init.h" // for pwalletMain #include "bitcoinrpc.h" -// #include -// #include -// #include #include -// #ifdef USE_SSL -// #include -// typedef boost::asio::ssl::stream SSLStream; -// #endif -// #include + #include "json/json_spirit_reader_template.h" #include "json/json_spirit_writer_template.h" #include "json/json_spirit_utils.h" diff --git a/src/util.cpp b/src/util.cpp index 09361ef..d55e7ae 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -33,16 +33,6 @@ bool fNoListen = false; bool fLogTimestamps = false; CMedianFilter vTimeOffsets(200,0); - - -// Workaround for "multiple definition of `_tls_used'" -// http://svn.boost.org/trac/boost/ticket/4258 -extern "C" void tss_cleanup_implemented() { } - - - - - // Init openssl library multithreading support static boost::interprocess::interprocess_mutex** ppmutexOpenSSL; void locking_callback(int mode, int i, const char* file, int line)