diff options
-rw-r--r-- | contrib/gitian-descriptors/deps-win32.yml | 2 | ||||
-rw-r--r-- | src/Makefile.am | 45 | ||||
-rw-r--r-- | src/Makefile.include | 4 | ||||
-rw-r--r-- | src/bitcoin-cli.cpp | 2 | ||||
-rw-r--r-- | src/bitcoind.cpp | 1 | ||||
-rw-r--r-- | src/init.cpp | 147 | ||||
-rw-r--r-- | src/init.h | 3 | ||||
-rw-r--r-- | src/key.cpp | 7 | ||||
-rw-r--r-- | src/main.cpp | 19 | ||||
-rw-r--r-- | src/qt/Makefile.am | 2 | ||||
-rw-r--r-- | src/qt/test/Makefile.am | 2 | ||||
-rw-r--r-- | src/rpcclient.cpp | 32 | ||||
-rw-r--r-- | src/rpcclient.h | 8 | ||||
-rw-r--r-- | src/test/Makefile.am | 2 | ||||
-rw-r--r-- | src/test/test_bitcoin.cpp | 1 | ||||
-rw-r--r-- | src/util.cpp | 2 | ||||
-rw-r--r-- | src/wallet.cpp | 4 |
17 files changed, 168 insertions, 115 deletions
diff --git a/contrib/gitian-descriptors/deps-win32.yml b/contrib/gitian-descriptors/deps-win32.yml index 3f4e4e27f2..addb11d726 100644 --- a/contrib/gitian-descriptors/deps-win32.yml +++ b/contrib/gitian-descriptors/deps-win32.yml @@ -29,8 +29,8 @@ script: | export HOST=i686-w64-mingw32 # Input Integrity Check echo "2a9eb3cd4e8b114eb9179c0d3884d61658e7d8e8bf4984798a5f5bd48e325ebe openssl-1.0.1c.tar.gz" | sha256sum -c - echo "b75dae26151f9b031062c8d2f577a094b08da0ae44fe8c11175d0b9ff434cc02 libpng-1.5.9.tar.gz" | sha256sum -c echo "12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz" | sha256sum -c + echo "bbd6b756e6af44b5a5b0f9b93eada3fb8922ed1d6451b7d6f184d0ae0c813994 miniupnpc-1.6.tar.gz" | sha256sum -c echo "21235e08552e6feba09ea5e8d750805b3391c62fb81c71a235c0044dc7a8a61b zlib-1.2.6.tar.gz" | sha256sum -c echo "b75dae26151f9b031062c8d2f577a094b08da0ae44fe8c11175d0b9ff434cc02 libpng-1.5.9.tar.gz" | sha256sum -c echo "03c4bc7cd9a75747c3815d509bbe061907d615764f2357923f0db948c567068f qrencode-3.2.0.tar.bz2" | sha256sum -c diff --git a/src/Makefile.am b/src/Makefile.am index 561d2ca7ae..9d3365fd60 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,7 @@ include Makefile.include AM_CPPFLAGS += -I$(top_srcdir)/src/leveldb/helpers/memenv \ -I$(builddir) -noinst_LIBRARIES = libbitcoin.a +noinst_LIBRARIES = libbitcoin_server.a libbitcoin_common.a libbitcoin_cli.a bin_PROGRAMS = bitcoind bitcoin-cli @@ -33,23 +33,40 @@ obj/build.h: FORCE $(abs_top_srcdir) version.o: obj/build.h -libbitcoin_a_SOURCES = addrman.cpp alert.cpp allocators.cpp \ - rpcclient.cpp \ - rpcprotocol.cpp \ +libbitcoin_server_a_SOURCES = addrman.cpp alert.cpp \ rpcserver.cpp \ bloom.cpp \ - chainparams.cpp checkpoints.cpp core.cpp coins.cpp crypter.cpp db.cpp hash.cpp \ - init.cpp key.cpp keystore.cpp leveldbwrapper.cpp main.cpp miner.cpp \ - netbase.cpp net.cpp noui.cpp protocol.cpp rpcblockchain.cpp rpcdump.cpp \ - rpcmining.cpp rpcnet.cpp rpcrawtransaction.cpp rpcwallet.cpp script.cpp \ - sync.cpp txdb.cpp txmempool.cpp util.cpp version.cpp wallet.cpp walletdb.cpp $(JSON_H) \ + chainparams.cpp checkpoints.cpp coins.cpp crypter.cpp db.cpp \ + init.cpp keystore.cpp leveldbwrapper.cpp main.cpp miner.cpp \ + net.cpp noui.cpp rpcblockchain.cpp rpcdump.cpp \ + rpcmining.cpp rpcnet.cpp rpcrawtransaction.cpp rpcwallet.cpp \ + txdb.cpp txmempool.cpp wallet.cpp walletdb.cpp $(JSON_H) \ + $(BITCOIN_CORE_H) + +libbitcoin_common_a_SOURCES = \ + allocators.cpp \ + chainparams.cpp \ + core.cpp \ + hash.cpp \ + key.cpp \ + netbase.cpp \ + protocol.cpp \ + rpcprotocol.cpp \ + script.cpp \ + sync.cpp \ + util.cpp \ + version.cpp \ $(BITCOIN_CORE_H) -nodist_libbitcoin_a_SOURCES = $(top_srcdir)/src/obj/build.h +libbitcoin_cli_a_SOURCES = \ + rpcclient.cpp \ + $(BITCOIN_CORE_H) + +nodist_libbitcoin_common_a_SOURCES = $(top_srcdir)/src/obj/build.h # # bitcoind binary # -bitcoind_LDADD = libbitcoin.a leveldb/libleveldb.a leveldb/libmemenv.a \ +bitcoind_LDADD = libbitcoin_server.a libbitcoin_cli.a libbitcoin_common.a leveldb/libleveldb.a leveldb/libmemenv.a \ $(BOOST_LIBS) bitcoind_SOURCES = bitcoind.cpp # @@ -62,15 +79,13 @@ AM_CPPFLAGS += $(BDB_CPPFLAGS) bitcoind_LDADD += $(BDB_LIBS) # bitcoin-cli binary # -bitcoin_cli_LDADD = libbitcoin.a leveldb/libleveldb.a leveldb/libmemenv.a \ - $(BOOST_LIBS) +bitcoin_cli_LDADD = libbitcoin_cli.a libbitcoin_common.a $(BOOST_LIBS) bitcoin_cli_SOURCES = bitcoin-cli.cpp # if TARGET_WINDOWS bitcoin_cli_SOURCES += bitcoin-cli-res.rc endif -bitcoin_cli_LDADD += $(BDB_LIBS) leveldb/libleveldb.a: leveldb/libmemenv.a @@ -79,7 +94,7 @@ leveldb/%.a: CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \ OPT="$(CXXFLAGS) $(CPPFLAGS)" -qt/bitcoinstrings.cpp: $(libbitcoin_a_SOURCES) +qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_common_a_SOURCES) $(libbitcoin_cli_a_SOURCES) @test -n $(XGETTEXT) || echo "xgettext is required for updating translations" @cd $(top_srcdir); XGETTEXT=$(XGETTEXT) share/qt/extract_strings_qt.py diff --git a/src/Makefile.include b/src/Makefile.include index 8c2274a287..2e96a6b7dc 100644 --- a/src/Makefile.include +++ b/src/Makefile.include @@ -5,7 +5,9 @@ AM_CPPFLAGS = $(INCLUDES) \ $(BOOST_INCLUDES) AM_LDFLAGS = $(PTHREAD_CFLAGS) -LIBBITCOIN=$(top_builddir)/src/libbitcoin.a +LIBBITCOIN_SERVER=$(top_builddir)/src/libbitcoin_server.a +LIBBITCOIN_COMMON=$(top_builddir)/src/libbitcoin_common.a +LIBBITCOIN_CLI=$(top_builddir)/src/libbitcoin_cli.a LIBLEVELDB=$(top_builddir)/src/leveldb/libleveldb.a LIBMEMENV=$(top_builddir)/src/leveldb/libmemenv.a LIBBITCOINQT=$(top_builddir)/src/qt/libbitcoinqt.a diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 4e65947464..04b75e7f1c 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -42,7 +42,7 @@ static bool AppInitRPC(int argc, char* argv[]) " bitcoin-cli [options] help " + _("List commands") + "\n" + " bitcoin-cli [options] help <command> " + _("Get help for a command") + "\n"; - strUsage += "\n" + HelpMessage(HMM_BITCOIN_CLI); + strUsage += "\n" + HelpMessageCli(true); fprintf(stdout, "%s", strUsage.c_str()); return false; diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index fdc66b8d65..e13d688158 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -87,6 +87,7 @@ bool AppInit(int argc, char* argv[]) " bitcoind [options] help <command> " + _("Get help for a command") + "\n"; strUsage += "\n" + HelpMessage(HMM_BITCOIND); + strUsage += "\n" + HelpMessageCli(false); fprintf(stdout, "%s", strUsage.c_str()); return false; diff --git a/src/init.cpp b/src/init.cpp index da70ef9dba..54722743e6 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -37,7 +37,6 @@ using namespace boost; std::string strWalletFile; CWallet* pwalletMain; -CClientUIInterface uiInterface; #ifdef WIN32 // Win32 LevelDB doesn't use filedescriptors, and the ones used for @@ -181,45 +180,43 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -datadir=<dir> " + _("Specify data directory") + "\n"; strUsage += " -testnet " + _("Use the test network") + "\n"; - if(hmm == HMM_BITCOIND || hmm == HMM_BITCOIN_QT) - { - strUsage += " -pid=<file> " + _("Specify pid file (default: bitcoind.pid)") + "\n"; - strUsage += " -gen " + _("Generate coins (default: 0)") + "\n"; - strUsage += " -wallet=<file> " + _("Specify wallet file (within data directory)") + "\n"; - strUsage += " -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n"; - strUsage += " -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n"; - strUsage += " -proxy=<ip:port> " + _("Connect through socks proxy") + "\n"; - strUsage += " -socks=<n> " + _("Select the version of socks proxy to use (4-5, default: 5)") + "\n"; - strUsage += " -onion=<ip:port> " + _("Use proxy to reach tor hidden services (default: same as -proxy)") + "\n"; - strUsage += " -dns " + _("Allow DNS lookups for -addnode, -seednode and -connect") + "\n"; - strUsage += " -port=<port> " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)") + "\n"; - strUsage += " -maxconnections=<n> " + _("Maintain at most <n> connections to peers (default: 125)") + "\n"; - strUsage += " -addnode=<ip> " + _("Add a node to connect to and attempt to keep the connection open") + "\n"; - strUsage += " -connect=<ip> " + _("Connect only to the specified node(s)") + "\n"; - strUsage += " -seednode=<ip> " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n"; - strUsage += " -externalip=<ip> " + _("Specify your own public address") + "\n"; - strUsage += " -onlynet=<net> " + _("Only connect to nodes in network <net> (IPv4, IPv6 or Tor)") + "\n"; - strUsage += " -discover " + _("Discover own IP address (default: 1 when listening and no -externalip)") + "\n"; - strUsage += " -checkpoints " + _("Only accept block chain matching built-in checkpoints (default: 1)") + "\n"; - strUsage += " -listen " + _("Accept connections from outside (default: 1 if no -proxy or -connect)") + "\n"; - strUsage += " -bind=<addr> " + _("Bind to given address and always listen on it. Use [host]:port notation for IPv6") + "\n"; - strUsage += " -dnsseed " + _("Find peers using DNS lookup (default: 1 unless -connect)") + "\n"; - strUsage += " -banscore=<n> " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n"; - strUsage += " -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n"; - 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 += " -pid=<file> " + _("Specify pid file (default: bitcoind.pid)") + "\n"; + strUsage += " -gen " + _("Generate coins (default: 0)") + "\n"; + strUsage += " -wallet=<file> " + _("Specify wallet file (within data directory)") + "\n"; + strUsage += " -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n"; + strUsage += " -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n"; + strUsage += " -proxy=<ip:port> " + _("Connect through socks proxy") + "\n"; + strUsage += " -socks=<n> " + _("Select the version of socks proxy to use (4-5, default: 5)") + "\n"; + strUsage += " -onion=<ip:port> " + _("Use proxy to reach tor hidden services (default: same as -proxy)") + "\n"; + strUsage += " -dns " + _("Allow DNS lookups for -addnode, -seednode and -connect") + "\n"; + strUsage += " -port=<port> " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)") + "\n"; + strUsage += " -maxconnections=<n> " + _("Maintain at most <n> connections to peers (default: 125)") + "\n"; + strUsage += " -addnode=<ip> " + _("Add a node to connect to and attempt to keep the connection open") + "\n"; + strUsage += " -connect=<ip> " + _("Connect only to the specified node(s)") + "\n"; + strUsage += " -seednode=<ip> " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n"; + strUsage += " -externalip=<ip> " + _("Specify your own public address") + "\n"; + strUsage += " -onlynet=<net> " + _("Only connect to nodes in network <net> (IPv4, IPv6 or Tor)") + "\n"; + strUsage += " -discover " + _("Discover own IP address (default: 1 when listening and no -externalip)") + "\n"; + strUsage += " -checkpoints " + _("Only accept block chain matching built-in checkpoints (default: 1)") + "\n"; + strUsage += " -listen " + _("Accept connections from outside (default: 1 if no -proxy or -connect)") + "\n"; + strUsage += " -bind=<addr> " + _("Bind to given address and always listen on it. Use [host]:port notation for IPv6") + "\n"; + strUsage += " -dnsseed " + _("Find peers using DNS lookup (default: 1 unless -connect)") + "\n"; + strUsage += " -banscore=<n> " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n"; + strUsage += " -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n"; + 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"; #ifdef USE_UPNP #if USE_UPNP - strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n"; + strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n"; #else - strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 0)") + "\n"; + strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 0)") + "\n"; #endif #endif - strUsage += " -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n"; - strUsage += " -debug=<category> " + _("Output debugging information (default: 0, supplying <category> is optional)") + "\n"; - strUsage += _("If <category> is not supplied, output all debugging information.") + "\n"; - strUsage += _("<category> can be:"); - strUsage += " addrman, alert, coindb, db, lock, rand, rpc, selectcoins, mempool, net"; // Don't translate these and qt below + strUsage += " -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n"; + strUsage += " -debug=<category> " + _("Output debugging information (default: 0, supplying <category> is optional)") + "\n"; + strUsage += _("If <category> is not supplied, output all debugging information.") + "\n"; + strUsage += _("<category> can be:"); + strUsage += " addrman, alert, coindb, db, lock, rand, rpc, selectcoins, mempool, net"; // Don't translate these and qt below if (hmm == HMM_BITCOIN_QT) { strUsage += ", qt.\n"; @@ -228,15 +225,14 @@ std::string HelpMessage(HelpMessageMode hmm) { strUsage += ".\n"; } - strUsage += " -logtimestamps " + _("Prepend debug output with timestamp (default: 1)") + "\n"; - strUsage += " -shrinkdebugfile " + _("Shrink debug.log file on client startup (default: 1 when no -debug)") + "\n"; - strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n"; - strUsage += " -regtest " + _("Enter regression test mode, which uses a special chain in which blocks can be " - "solved instantly. This is intended for regression testing tools and app development.") + "\n"; + strUsage += " -logtimestamps " + _("Prepend debug output with timestamp (default: 1)") + "\n"; + strUsage += " -shrinkdebugfile " + _("Shrink debug.log file on client startup (default: 1 when no -debug)") + "\n"; + strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n"; + strUsage += " -regtest " + _("Enter regression test mode, which uses a special chain in which blocks can be " + "solved instantly. This is intended for regression testing tools and app development.") + "\n"; #ifdef WIN32 - strUsage += " -printtodebugger " + _("Send trace/debug info to debugger") + "\n"; + strUsage += " -printtodebugger " + _("Send trace/debug info to debugger") + "\n"; #endif - } if (hmm == HMM_BITCOIN_QT) { @@ -250,53 +246,36 @@ std::string HelpMessage(HelpMessageMode hmm) #endif } - if (hmm == HMM_BITCOIND || hmm == HMM_BITCOIN_CLI) - { - strUsage += " -rpcconnect=<ip> " + _("Send commands to node running on <ip> (default: 127.0.0.1)") + "\n"; - strUsage += " -rpcwait " + _("Wait for RPC server to start") + "\n"; - } - strUsage += " -rpcuser=<user> " + _("Username for JSON-RPC connections") + "\n"; strUsage += " -rpcpassword=<pw> " + _("Password for JSON-RPC connections") + "\n"; - if (hmm == HMM_BITCOIND || hmm == HMM_BITCOIN_QT) - { - strUsage += " -rpcport=<port> " + _("Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332)") + "\n"; - } else { - strUsage += " -rpcport=<port> " + _("Connect to JSON-RPC on <port> (default: 8332 or testnet: 18332)") + "\n"; - } - - if(hmm == HMM_BITCOIND || hmm == HMM_BITCOIN_QT) - { - strUsage += " -rpcallowip=<ip> " + _("Allow JSON-RPC connections from specified IP address") + "\n"; - strUsage += " -rpcthreads=<n> " + _("Set the number of threads to service RPC calls (default: 4)") + "\n"; - strUsage += " -blocknotify=<cmd> " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n"; - strUsage += " -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n"; - strUsage += " -alertnotify=<cmd> " + _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)") + "\n"; - strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + "\n"; - strUsage += " -keypool=<n> " + _("Set key pool size to <n> (default: 100)") + "\n"; - strUsage += " -rescan " + _("Rescan the block chain for missing wallet transactions") + "\n"; - strUsage += " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + "\n"; - strUsage += " -checkblocks=<n> " + _("How many blocks to check at startup (default: 288, 0 = all)") + "\n"; - strUsage += " -checklevel=<n> " + _("How thorough the block verification is (0-4, default: 3)") + "\n"; - strUsage += " -txindex " + _("Maintain a full transaction index (default: 0)") + "\n"; - strUsage += " -loadblock=<file> " + _("Imports blocks from external blk000??.dat file") + "\n"; - strUsage += " -reindex " + _("Rebuild block chain index from current blk000??.dat files") + "\n"; - strUsage += " -par=<n> " + _("Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)") + "\n"; - - strUsage += "\n" + _("Block creation options:") + "\n"; - strUsage += " -blockminsize=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n"; - strUsage += " -blockmaxsize=<n> " + _("Set maximum block size in bytes (default: 250000)") + "\n"; - strUsage += " -blockprioritysize=<n> " + _("Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)") + "\n"; - } + strUsage += " -rpcport=<port> " + _("Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332)") + "\n"; + + strUsage += " -rpcallowip=<ip> " + _("Allow JSON-RPC connections from specified IP address") + "\n"; + strUsage += " -rpcthreads=<n> " + _("Set the number of threads to service RPC calls (default: 4)") + "\n"; + strUsage += " -blocknotify=<cmd> " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n"; + strUsage += " -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n"; + strUsage += " -alertnotify=<cmd> " + _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)") + "\n"; + strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + "\n"; + strUsage += " -keypool=<n> " + _("Set key pool size to <n> (default: 100)") + "\n"; + strUsage += " -rescan " + _("Rescan the block chain for missing wallet transactions") + "\n"; + strUsage += " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + "\n"; + strUsage += " -checkblocks=<n> " + _("How many blocks to check at startup (default: 288, 0 = all)") + "\n"; + strUsage += " -checklevel=<n> " + _("How thorough the block verification is (0-4, default: 3)") + "\n"; + strUsage += " -txindex " + _("Maintain a full transaction index (default: 0)") + "\n"; + strUsage += " -loadblock=<file> " + _("Imports blocks from external blk000??.dat file") + "\n"; + strUsage += " -reindex " + _("Rebuild block chain index from current blk000??.dat files") + "\n"; + strUsage += " -par=<n> " + _("Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)") + "\n"; + + strUsage += "\n" + _("Block creation options:") + "\n"; + strUsage += " -blockminsize=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n"; + strUsage += " -blockmaxsize=<n> " + _("Set maximum block size in bytes (default: 250000)") + "\n"; + strUsage += " -blockprioritysize=<n> " + _("Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)") + "\n"; strUsage += "\n" + _("SSL options: (see the Bitcoin Wiki for SSL setup instructions)") + "\n"; strUsage += " -rpcssl " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n"; - if (hmm == HMM_BITCOIND || hmm == HMM_BITCOIN_QT) - { - strUsage += " -rpcsslcertificatechainfile=<file.cert> " + _("Server certificate file (default: server.cert)") + "\n"; - strUsage += " -rpcsslprivatekeyfile=<file.pem> " + _("Server private key (default: server.pem)") + "\n"; - strUsage += " -rpcsslciphers=<ciphers> " + _("Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH)") + "\n"; - } + strUsage += " -rpcsslcertificatechainfile=<file.cert> " + _("Server certificate file (default: server.cert)") + "\n"; + strUsage += " -rpcsslprivatekeyfile=<file.pem> " + _("Server private key (default: server.pem)") + "\n"; + strUsage += " -rpcsslciphers=<ciphers> " + _("Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH)") + "\n"; return strUsage; } diff --git a/src/init.h b/src/init.h index 864f2f4614..018d2d5ea3 100644 --- a/src/init.h +++ b/src/init.h @@ -26,8 +26,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer); enum HelpMessageMode { HMM_BITCOIND, - HMM_BITCOIN_QT, - HMM_BITCOIN_CLI + HMM_BITCOIN_QT }; std::string HelpMessage(HelpMessageMode mode); diff --git a/src/key.cpp b/src/key.cpp index 2fd68fa56b..b57b7c506c 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -148,10 +148,13 @@ public: } void SetSecretBytes(const unsigned char vch[32]) { + bool ret; BIGNUM bn; BN_init(&bn); - assert(BN_bin2bn(vch, 32, &bn)); - assert(EC_KEY_regenerate_key(pkey, &bn)); + ret = BN_bin2bn(vch, 32, &bn); + assert(ret); + ret = EC_KEY_regenerate_key(pkey, &bn); + assert(ret); BN_clear_free(&bn); } diff --git a/src/main.cpp b/src/main.cpp index eb3af5bea6..25201c7367 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,6 +27,10 @@ using namespace std; using namespace boost; +#if defined(NDEBUG) +# error "Bitcoin cannot be compiled without assertions." +#endif + // // Global state // @@ -1266,18 +1270,21 @@ void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev) void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight, const uint256 &txhash) { + bool ret; // mark inputs spent if (!tx.IsCoinBase()) { BOOST_FOREACH(const CTxIn &txin, tx.vin) { CCoins &coins = inputs.GetCoins(txin.prevout.hash); CTxInUndo undo; - assert(coins.Spend(txin.prevout, undo)); + ret = coins.Spend(txin.prevout, undo); + assert(ret); txundo.vprevout.push_back(undo); } } // add outputs - assert(inputs.SetCoins(txhash, CCoins(tx, nHeight))); + ret = inputs.SetCoins(txhash, CCoins(tx, nHeight)); + assert(ret); } bool CScriptCheck::operator()() const { @@ -1651,7 +1658,9 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C return state.Abort(_("Failed to write transaction index")); // add this block to the view's block chain - assert(view.SetBestBlock(pindex->GetBlockHash())); + bool ret; + ret = view.SetBestBlock(pindex->GetBlockHash()); + assert(ret); // Watch for transactions paying to me for (unsigned int i = 0; i < block.vtx.size(); i++) @@ -1746,7 +1755,9 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) // Flush changes to global coin state int64_t nStart = GetTimeMicros(); int nModified = view.GetCacheSize(); - assert(view.Flush()); + bool ret; + ret = view.Flush(); + assert(ret); int64_t nTime = GetTimeMicros() - nStart; if (fBenchmark) LogPrintf("- Flush %i transactions: %.2fms (%.4fms/tx)\n", nModified, 0.001 * nTime, 0.001 * nTime / nModified); diff --git a/src/qt/Makefile.am b/src/qt/Makefile.am index 31c032ecbf..e302adc89f 100644 --- a/src/qt/Makefile.am +++ b/src/qt/Makefile.am @@ -197,7 +197,7 @@ endif bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) \ -I$(top_srcdir)/src/qt/forms bitcoin_qt_SOURCES = bitcoin.cpp -bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN) $(LIBLEVELDB) $(LIBMEMENV) \ +bitcoin_qt_LDADD = libbitcoinqt.a $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) $(LIBMEMENV) \ $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) # forms/foo.h -> forms/ui_foo.h diff --git a/src/qt/test/Makefile.am b/src/qt/test/Makefile.am index 7891c3e975..29247a79a1 100644 --- a/src/qt/test/Makefile.am +++ b/src/qt/test/Makefile.am @@ -17,7 +17,7 @@ BUILT_SOURCES = $(TEST_QT_MOC_CPP) test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(QT_INCLUDES) $(QT_TEST_INCLUDES) test_bitcoin_qt_SOURCES = test_main.cpp uritests.cpp paymentservertests.cpp $(TEST_QT_H) nodist_test_bitcoin_qt_SOURCES = $(TEST_QT_MOC_CPP) -test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN) $(LIBLEVELDB) \ +test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) \ $(LIBMEMENV) $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) \ $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp index f571ca52d6..a3168917fc 100644 --- a/src/rpcclient.cpp +++ b/src/rpcclient.cpp @@ -245,3 +245,35 @@ int CommandLineRPC(int argc, char *argv[]) } return nRet; } + +std::string HelpMessageCli(bool mainProgram) +{ + string strUsage; + if(mainProgram) + { + strUsage += _("Options:") + "\n"; + strUsage += " -? " + _("This help message") + "\n"; + strUsage += " -conf=<file> " + _("Specify configuration file (default: bitcoin.conf)") + "\n"; + strUsage += " -datadir=<dir> " + _("Specify data directory") + "\n"; + strUsage += " -testnet " + _("Use the test network") + "\n"; + strUsage += " -regtest " + _("Enter regression test mode, which uses a special chain in which blocks can be " + "solved instantly. This is intended for regression testing tools and app development.") + "\n"; + } else { + strUsage += _("RPC client options:") + "\n"; + } + + strUsage += " -rpcconnect=<ip> " + _("Send commands to node running on <ip> (default: 127.0.0.1)") + "\n"; + strUsage += " -rpcport=<port> " + _("Connect to JSON-RPC on <port> (default: 8332 or testnet: 18332)") + "\n"; + strUsage += " -rpcwait " + _("Wait for RPC server to start") + "\n"; + strUsage += " -rpcuser=<user> " + _("Username for JSON-RPC connections") + "\n"; + strUsage += " -rpcpassword=<pw> " + _("Password for JSON-RPC connections") + "\n"; + + if(mainProgram) + { + strUsage += "\n" + _("SSL options: (see the Bitcoin Wiki for SSL setup instructions)") + "\n"; + strUsage += " -rpcssl " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n"; + } + + return strUsage; +} + diff --git a/src/rpcclient.h b/src/rpcclient.h index f3ea56c25b..e101d22ec5 100644 --- a/src/rpcclient.h +++ b/src/rpcclient.h @@ -14,4 +14,12 @@ int CommandLineRPC(int argc, char *argv[]); json_spirit::Array RPCConvertValues(const std::string &strMethod, const std::vector<std::string> &strParams); +/** Show help message for bitcoin-cli. + * The mainProgram argument is used to determine whether to show this message as main program + * (and include some common options) or as sub-header of another help message. + * + * @note the argument can be removed once bitcoin-cli functionality is removed from bitcoind + */ +std::string HelpMessageCli(bool mainProgram); + #endif diff --git a/src/test/Makefile.am b/src/test/Makefile.am index 180fd7effa..39f2c6a385 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -20,7 +20,7 @@ BUILT_SOURCES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h) # test_bitcoin binary # test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(TESTDEFS) -test_bitcoin_LDADD = $(LIBBITCOIN) $(LIBLEVELDB) $(LIBMEMENV) \ +test_bitcoin_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBLEVELDB) $(LIBMEMENV) \ $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(BDB_LIBS) test_bitcoin_SOURCES = accounting_tests.cpp alert_tests.cpp \ allocator_tests.cpp base32_tests.cpp base58_tests.cpp base64_tests.cpp \ diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index f947167597..443e7735d7 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -14,7 +14,6 @@ CWallet* pwalletMain; -CClientUIInterface uiInterface; extern bool fPrintToConsole; extern void noui_connect(); diff --git a/src/util.cpp b/src/util.cpp index 65940758a1..a8c591cc7a 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -95,6 +95,7 @@ string strMiscWarning; bool fNoListen = false; bool fLogTimestamps = false; volatile bool fReopenDebugLog = false; +CClientUIInterface uiInterface; // Init OpenSSL library multithreading support static CCriticalSection** ppmutexOpenSSL; @@ -1511,3 +1512,4 @@ void RenameThread(const char* name) (void)name; #endif } + diff --git a/src/wallet.cpp b/src/wallet.cpp index b9110d1271..14d685d6e2 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1298,7 +1298,9 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend, // Reserve a new key pair from key pool CPubKey vchPubKey; - assert(reservekey.GetReservedKey(vchPubKey)); // should never fail, as we just unlocked + bool ret; + ret = reservekey.GetReservedKey(vchPubKey); + assert(ret); // should never fail, as we just unlocked scriptChange.SetDestination(vchPubKey.GetID()); } |