Skip to content

Commit

Permalink
Separate protocol versioning from clientversion
Browse files Browse the repository at this point in the history
  • Loading branch information
theuni committed Oct 29, 2014
1 parent 723c752 commit 71697f9
Show file tree
Hide file tree
Showing 25 changed files with 52 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
@@ -1 +1 @@
src/version.cpp export-subst
src/clientversion.cpp export-subst
2 changes: 1 addition & 1 deletion Makefile.am
Expand Up @@ -36,7 +36,7 @@ COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \
dist-hook:
-$(MAKE) -C $(top_distdir)/src/leveldb clean
-$(MAKE) -C $(top_distdir)/src/secp256k1 distclean
-$(GIT) archive --format=tar HEAD -- src/version.cpp | $(AMTAR) -C $(top_distdir) -xf -
-$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf -

distcheck-hook:
$(MKDIR_P) $(top_distdir)/_build/src/leveldb
Expand Down
6 changes: 3 additions & 3 deletions src/Makefile.am
Expand Up @@ -146,7 +146,7 @@ obj/build.h: FORCE
@$(MKDIR_P) $(builddir)/obj
@$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
$(abs_top_srcdir)
libbitcoin_util_a-version.$(OBJEXT): obj/build.h
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h

# server: shared between bitcoind and bitcoin-qt
libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS)
Expand Down Expand Up @@ -241,6 +241,7 @@ libbitcoin_util_a_SOURCES = \
compat/glibc_sanity.cpp \
compat/glibcxx_sanity.cpp \
chainparamsbase.cpp \
clientversion.cpp \
random.cpp \
rpcprotocol.cpp \
sync.cpp \
Expand All @@ -249,7 +250,6 @@ libbitcoin_util_a_SOURCES = \
utilstrencodings.cpp \
utilmoneystr.cpp \
utiltime.cpp \
version.cpp \
$(BITCOIN_CORE_H)

if GLIBC_BACK_COMPAT
Expand Down Expand Up @@ -354,7 +354,7 @@ clean-local:

.rc.o:
@test -f $(WINDRES)
$(AM_V_GEN) $(WINDRES) -i $< -o $@
$(AM_V_GEN) $(WINDRES) -DWINDRES_PREPROC -i $< -o $@

.mm.o:
$(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
Expand Down
1 change: 1 addition & 0 deletions src/alert.cpp
Expand Up @@ -6,6 +6,7 @@
#include "alert.h"

#include "chainparams.h"
#include "clientversion.h"
#include "key.h"
#include "net.h"
#include "timedata.h"
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoin-cli.cpp
Expand Up @@ -4,12 +4,12 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "chainparamsbase.h"
#include "clientversion.h"
#include "init.h"
#include "rpcclient.h"
#include "rpcprotocol.h"
#include "util.h"
#include "utilstrencodings.h"
#include "version.h"

#include <boost/filesystem/operations.hpp>

Expand Down
1 change: 1 addition & 0 deletions src/bitcoin-tx.cpp
Expand Up @@ -3,6 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "base58.h"
#include "clientversion.h"
#include "core/transaction.h"
#include "core_io.h"
#include "keystore.h"
Expand Down
1 change: 1 addition & 0 deletions src/bitcoind.cpp
Expand Up @@ -3,6 +3,7 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "clientversion.h"
#include "rpcserver.h"
#include "init.h"
#include "main.h"
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp → src/clientversion.cpp
Expand Up @@ -2,7 +2,7 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "version.h"
#include "clientversion.h"

#include "tinyformat.h"

Expand Down
27 changes: 27 additions & 0 deletions src/clientversion.h
Expand Up @@ -35,4 +35,31 @@
// Copyright string used in Windows .rc files
#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers"

/*
bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
WINDRES_PREPROC is defined to indicate that its pre-processor is running.
Anything other than a define should be guarded below.
*/

#if !defined(WINDRES_PREPROC)

#include <string>
#include <vector>

static const int CLIENT_VERSION =
1000000 * CLIENT_VERSION_MAJOR
+ 10000 * CLIENT_VERSION_MINOR
+ 100 * CLIENT_VERSION_REVISION
+ 1 * CLIENT_VERSION_BUILD;

extern const std::string CLIENT_NAME;
extern const std::string CLIENT_BUILD;
extern const std::string CLIENT_DATE;


std::string FormatFullVersion();
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments);

#endif // WINDRES_PREPROC

#endif // CLIENTVERSION_H
1 change: 1 addition & 0 deletions src/db.h
Expand Up @@ -6,6 +6,7 @@
#ifndef BITCOIN_DB_H
#define BITCOIN_DB_H

#include "clientversion.h"
#include "serialize.h"
#include "streams.h"
#include "sync.h"
Expand Down
1 change: 1 addition & 0 deletions src/leveldbwrapper.h
Expand Up @@ -5,6 +5,7 @@
#ifndef BITCOIN_LEVELDBWRAPPER_H
#define BITCOIN_LEVELDBWRAPPER_H

#include "clientversion.h"
#include "serialize.h"
#include "streams.h"
#include "util.h"
Expand Down
1 change: 1 addition & 0 deletions src/net.cpp
Expand Up @@ -11,6 +11,7 @@

#include "addrman.h"
#include "chainparams.h"
#include "clientversion.h"
#include "core/transaction.h"
#include "ui_interface.h"

Expand Down
1 change: 1 addition & 0 deletions src/qt/clientmodel.cpp
Expand Up @@ -10,6 +10,7 @@
#include "alert.h"
#include "chainparams.h"
#include "checkpoints.h"
#include "clientversion.h"
#include "main.h"
#include "net.h"
#include "ui_interface.h"
Expand Down
1 change: 1 addition & 0 deletions src/qt/recentrequeststablemodel.cpp
Expand Up @@ -5,6 +5,7 @@
#include "recentrequeststablemodel.h"

#include "bitcoinunits.h"
#include "clientversion.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "streams.h"
Expand Down
2 changes: 1 addition & 1 deletion src/qt/utilitydialog.cpp
Expand Up @@ -10,8 +10,8 @@
#include "clientmodel.h"
#include "guiutil.h"

#include "clientversion.h"
#include "init.h"
#include "version.h"

#include <stdio.h>

Expand Down
1 change: 1 addition & 0 deletions src/rpcmisc.cpp
Expand Up @@ -4,6 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "base58.h"
#include "clientversion.h"
#include "init.h"
#include "main.h"
#include "net.h"
Expand Down
1 change: 1 addition & 0 deletions src/rpcnet.cpp
Expand Up @@ -4,6 +4,7 @@

#include "rpcserver.h"

#include "clientversion.h"
#include "main.h"
#include "net.h"
#include "netbase.h"
Expand Down
1 change: 1 addition & 0 deletions src/rpcprotocol.cpp
Expand Up @@ -5,6 +5,7 @@

#include "rpcprotocol.h"

#include "clientversion.h"
#include "tinyformat.h"
#include "util.h"
#include "utilstrencodings.h"
Expand Down
2 changes: 1 addition & 1 deletion src/test/alert_tests.cpp
Expand Up @@ -7,13 +7,13 @@
//

#include "alert.h"
#include "clientversion.h"
#include "data/alertTests.raw.h"

#include "serialize.h"
#include "streams.h"
#include "util.h"
#include "utilstrencodings.h"
#include "version.h"

#include <fstream>

Expand Down
1 change: 1 addition & 0 deletions src/test/bloom_tests.cpp
Expand Up @@ -5,6 +5,7 @@
#include "bloom.h"

#include "base58.h"
#include "clientversion.h"
#include "key.h"
#include "main.h"
#include "serialize.h"
Expand Down
1 change: 1 addition & 0 deletions src/test/checkblock_tests.cpp
Expand Up @@ -8,6 +8,7 @@



#include "clientversion.h"
#include "main.h"
#include "utiltime.h"

Expand Down
1 change: 1 addition & 0 deletions src/test/transaction_tests.cpp
Expand Up @@ -5,6 +5,7 @@
#include "data/tx_invalid.json.h"
#include "data/tx_valid.json.h"

#include "clientversion.h"
#include "key.h"
#include "keystore.h"
#include "main.h"
Expand Down
2 changes: 1 addition & 1 deletion src/test/util_tests.cpp
Expand Up @@ -4,12 +4,12 @@

#include "util.h"

#include "clientversion.h"
#include "core/transaction.h"
#include "random.h"
#include "sync.h"
#include "utilstrencodings.h"
#include "utilmoneystr.h"
#include "version.h"

#include <stdint.h>
#include <vector>
Expand Down
1 change: 1 addition & 0 deletions src/txmempool.cpp
Expand Up @@ -5,6 +5,7 @@

#include "txmempool.h"

#include "clientversion.h"
#include "streams.h"
#include "util.h"
#include "utilmoneystr.h"
Expand Down
22 changes: 0 additions & 22 deletions src/version.h
Expand Up @@ -5,25 +5,6 @@
#ifndef BITCOIN_VERSION_H
#define BITCOIN_VERSION_H

#include "clientversion.h"

#include <string>
#include <vector>

//
// client versioning
//

static const int CLIENT_VERSION =
1000000 * CLIENT_VERSION_MAJOR
+ 10000 * CLIENT_VERSION_MINOR
+ 100 * CLIENT_VERSION_REVISION
+ 1 * CLIENT_VERSION_BUILD;

extern const std::string CLIENT_NAME;
extern const std::string CLIENT_BUILD;
extern const std::string CLIENT_DATE;

//
// network protocol versioning
//
Expand Down Expand Up @@ -53,7 +34,4 @@ static const int BIP0031_VERSION = 60000;
// "mempool" command, enhanced "getdata" behavior starts with this version
static const int MEMPOOL_GD_VERSION = 60002;

std::string FormatFullVersion();
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments);

#endif // BITCOIN_VERSION_H

0 comments on commit 71697f9

Please sign in to comment.