diff -uNr a/bitcoin/manifest b/bitcoin/manifest --- a/bitcoin/manifest b6c64c0d831b862f4f9cc6bceb8634071dacfa3922bdbf33e61c5b76a94b0168e42ba181ce1de085a094be85f099f0d4d6cf6284722dd2a9be83fe657a6da5b1 +++ b/bitcoin/manifest 2be25083c9a07b2720d9c87f7f69ad5b522767bac4a3be1a392dd6953ce385b61e884471b06be82aa008c14f6ac064c880da56373374f7480b372160d5585210 @@ -49,3 +49,4 @@ 735336 bitcoin_pushmessage_cleanup_2 jfw With PushMessage deduplicated, we can integrate BeginMessage, AbortMessage and EndMessage for major simplification. While we're here, fix those infernal torn send/receive debug messages with their redundant timestamps and no clue as to sender or recipient. 735393 bitcoin_enforce_buffer_limits jfw Finally we can move send and receive flood control logic to where the buffers get filled, so that the rest of the code can count on their not exceeding the size limits. Passing the error upstack is needed in the sending case to stop whatever was generating the output. While we're here, fix an erroneous fcntl flag bit inversion and kill a 64k stack buffer. 735393 bitcoin_posix_error_handling jfw Convert all error codes to readable strings in log and console output. Don't log numeric fork/setsid result in the error case as it's always -1 and only errno is interesting. Translate socket error handling from WinSock to better fit unix-like systems: in particular, EAGAIN may be distinct from EWOULDBLOCK; EWOULDBLOCK and EINVAL don't apply to connect; EINPROGRESS doesn't apply to send/recv; EMSGSIZE doesn't seem to apply to TCP and it's unclear that it could be handled if it did; and errno needs to be saved when there may be intervening libc calls (nAcceptErr). +735838 bitcoin_rebranding Change version string to jwrd.net; apparently even something this simple can't be done without bumping into shoddy earlier work. diff -uNr a/bitcoin/src/init.cpp b/bitcoin/src/init.cpp --- a/bitcoin/src/init.cpp 830f8ff84148b7cefa7b846e9e4fba03f60a1a68dc7066f1bb00b56dc4c4899056364dfd016869489d3567dfc6b2cc043e7581fb17b514dfd3ee08e10bb80db4 +++ b/bitcoin/src/init.cpp 98181df7de317c09aa491d95f0320cbf6afbe8fae3bf8b1bf88457a2309ff67c7e45ac9538e89e2de53a7759e311feb4b13fdba7514acf6a54768b29467d5f34 @@ -217,12 +217,12 @@ if (mapArgs.count("-setverstring")) { - CLIENT_NAME = mapArgs["-setverstring"]; + strClientVersionName = mapArgs["-setverstring"]; } if (mapArgs.count("-setvernum")) { - VERSION = atoi(mapArgs["-setvernum"]); + nClientVersionNum = atoi(mapArgs["-setvernum"]); } if (fDaemon) diff -uNr a/bitcoin/src/knobs.h b/bitcoin/src/knobs.h --- a/bitcoin/src/knobs.h 4e01d59f75dfdac897735bf28c2414ed8463e12683e1d845272772feac7706615e36c26e6e291250d245f269c2bf8b41a32cc6abb81bbc58b4831b01be0eefd8 +++ b/bitcoin/src/knobs.h false @@ -1,7 +0,0 @@ -#ifndef KNOBS_H -#define KNOBS_H - -#define DEFAULT_CLIENT_NAME "therealbitcoin.org" -#define DEFAULT_CLIENT_VERSION 99999 /* 50400 */ - -#endif diff -uNr a/bitcoin/src/main.cpp b/bitcoin/src/main.cpp --- a/bitcoin/src/main.cpp ae05983cfd5fabb8bc16e6e6ce5dfd302be9a4546302837de972ea92600f296312fe4535c84da0a991bf34fbe02ee24399201b439ee7eb33f20ed1581d7c9e34 +++ b/bitcoin/src/main.cpp 45cf30812854a51d7a4c3436b8a832c8418dbb03a70b6bc6e81fba21c90920355e93d2d62996b6d4d643b19dea997a6df11d50884567d3afc98be8782fa66685 @@ -19,7 +19,9 @@ // Global state // -int VERSION = DEFAULT_CLIENT_VERSION; +// This verbose variable naming is to rule out confusion with prior local names such as "nClientVersion". +int nClientVersionNum = 99999; // Was 50400 prior to programmable-versionstring patch. May affect network protocol, serialization, peer acceptance and such. +std::string strClientVersionName("jwrd.net"); CCriticalSection cs_setpwalletRegistered; set setpwalletRegistered; diff -uNr a/bitcoin/src/main.h b/bitcoin/src/main.h --- a/bitcoin/src/main.h d70c7dd93b2bea85ffe52d440b60d629c4cf125d9ae91afef3aa6c854981c19070663d3a8839455b700e410435634f59fb3ccaf7642595e4374c4bb323261267 +++ b/bitcoin/src/main.h aca54ef12a38a60aaa5aa4cf466cc6514d35429d041db06352175e4ed73b265bae7d1b87131225b860f7dda5e6815a02b525d555407d82c5d4c5cd2974e0f2d1 @@ -65,6 +65,10 @@ extern int fMinimizeToTray; extern int fMinimizeOnClose; extern int nCheckBlocks; +extern int nClientVersionNum; +// This didn't used to be settable; there's still many references to the all-caps form, and moreover its meaning seems rather overloaded and it may be that some really should be constant (such as internal usage in db.cpp) and others settable. +#define VERSION nClientVersionNum +extern std::string strClientVersionName; int64 GetTransactionFee(); void SetTransactionFee(int64 nFee); diff -uNr a/bitcoin/src/net.h b/bitcoin/src/net.h --- a/bitcoin/src/net.h 245392b337f179b07eb142d705f6d90e7cc376d0158c80c156eb6b7aee8adcf90e58eca4982266a7ebcae458a27e02da0e8ef54b279dcf2b1856b29b15e2222e +++ b/bitcoin/src/net.h 11a23408b4a7562a897755a96485957c61d11633a9ee5783fa950c0f6653ee69f1e7cc338963c1e694a994fa8f9f9dd07ad414512f3d607389a5770567141235 @@ -61,6 +61,10 @@ extern int fUseProxy; extern CAddress addrProxy; +// Duplicated from main.h, stupid code-in-header-files. +extern int nClientVersionNum; +extern std::string strClientVersionName; + class peer_disconnected_error : public std::runtime_error { public: @@ -256,13 +260,13 @@ CAddress addrMe = (fUseProxy || !addrLocalHost.IsRoutable() ? CAddress("0.0.0.0") : addrLocalHost); RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce)); PushMessage("version", SendingStream() - << VERSION + << nClientVersionNum << nLocalServices << nTime << addrYou << addrMe << nLocalHostNonce - << FormatSubVersion(CLIENT_NAME, VERSION) + << FormatSubVersion(strClientVersionName, nClientVersionNum) << nBestHeight); } diff -uNr a/bitcoin/src/serialize.h b/bitcoin/src/serialize.h --- a/bitcoin/src/serialize.h 72b2dc097c54ad0e89545676d555c92da97ee6d86b6a7fd9c2b063ad629b027704f791e0b4168a0d33766f8203b7297f95d274627c89be974c749143949c86ef +++ b/bitcoin/src/serialize.h 2f6f83b35121f6bd33b405265497c5e5737e7bce3f842992e580ffbcd98f0acf3e07e5a0ffd7612996b73e8a05f9f3314cce1e3596921210711870d18472a9f6 @@ -25,8 +25,6 @@ #include #include -#include "knobs.h" - /* This comes from limits.h if it's not defined there set a sane default */ #ifndef PAGESIZE #include @@ -44,7 +42,9 @@ class CAutoFile; static const unsigned int MAX_SIZE = 0x02000000; -extern int VERSION; +// Duplicated from main.h, what can you do. +extern int nClientVersionNum; +#define VERSION nClientVersionNum // Used to bypass the rule against non-const reference to temporary // where it makes sense with wrappers such as CFlatData or CTxDB diff -uNr a/bitcoin/src/util.cpp b/bitcoin/src/util.cpp --- a/bitcoin/src/util.cpp 15b46344c80e58143a11b215de7c883167142ff65136bb90df78ccdb01ca3a2a1fb1ebc61f78fea88c17c504b209f87eba7b42b2ae8d3a67652bfd133a97a850 +++ b/bitcoin/src/util.cpp 7c70391a712c509983ac2a57e259ea8e834e54d81de1abc599dd9ef315373ce5c1dbcb242bcafd817ff2527f5a4ba98891145dcc1c47fbb4d6556061b2eb50d1 @@ -2,7 +2,6 @@ // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. -#include "knobs.h" #include "headers.h" #include "strlcpy.h" #include @@ -37,8 +36,6 @@ bool fDisableSafeMode = false; bool fPermissive = false; -std::string CLIENT_NAME(DEFAULT_CLIENT_NAME); - // Workaround for "multiple definition of `_tls_used'" // http://svn.boost.org/trac/boost/ticket/4258 @@ -884,7 +881,7 @@ -string FormatVersion(int nVersion) +static std::string FormatVersion(int nVersion) { if (nVersion%100 == 0) return strprintf("%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100); @@ -892,17 +889,18 @@ return strprintf("%d.%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100, nVersion%100); } -string FormatFullVersion() +std::string FormatFullVersion() { - string s = FormatVersion(VERSION); - return s; + // Displayed in JSON-RPC headers, help, and log output. Formerly appended local version suffixes like "-beta". + return FormatVersion(nClientVersionNum); } -std::string FormatSubVersion(const std::string& name, int nClientVersion) +std::string FormatSubVersion(const std::string& strName, int nVersion) { + // Sent in the "version" handshake. The "Sub" naming seems to reflect the origins of that field as a default-empty "pszSubVer" before being recast as a user-agent string with this slashified format. std::ostringstream ss; ss << "/"; - ss << name << ":" << FormatVersion(nClientVersion); + ss << strName << ":" << FormatVersion(nVersion); ss << "/"; return ss.str(); } diff -uNr a/bitcoin/src/util.h b/bitcoin/src/util.h --- a/bitcoin/src/util.h bab7740fd689486507200267b17cb0db5e4e082ccdbd6057915f723b778a8880443af98cd610e1d0094d944e6634c31431cb701ed87e16cb694938c7bd4f5020 +++ b/bitcoin/src/util.h 69eabb88785ef1d9be04a591fc11fd8055f2e805ca93a8f9c37768101b3b548a3034c7606207215e6d508747f6a6528b09632e2dd22c2f399e14d02c4ee8885f @@ -108,7 +108,6 @@ extern std::string strMiscWarning; extern bool fNoListen; extern bool fLogTimestamps; -extern std::string CLIENT_NAME; extern bool fLowS; extern bool fHighS; extern bool fTestSafeMode; @@ -154,7 +153,7 @@ int64 GetAdjustedTime(); void AddTimeData(unsigned int ip, int64 nTime); std::string FormatFullVersion(); -std::string FormatSubVersion(const std::string& name, int nClientVersion); +std::string FormatSubVersion(const std::string& strName, int nVersion); std::string StringError(int nErr);