diff options
-rw-r--r-- | .gitignore | 23 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | build-aux/m4/ax_boost_base.m4 (renamed from src/m4/ax_boost_base.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_boost_chrono.m4 (renamed from src/m4/ax_boost_chrono.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_boost_filesystem.m4 (renamed from src/m4/ax_boost_filesystem.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_boost_program_options.m4 (renamed from src/m4/ax_boost_program_options.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_boost_system.m4 (renamed from src/m4/ax_boost_system.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_boost_thread.m4 (renamed from src/m4/ax_boost_thread.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_boost_unit_test_framework.m4 (renamed from src/m4/ax_boost_unit_test_framework.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_check_compile_flag.m4 (renamed from src/m4/ax_check_compile_flag.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_check_link_flag.m4 (renamed from src/m4/ax_check_link_flag.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_check_preproc_flag.m4 (renamed from src/m4/ax_check_preproc_flag.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/ax_pthread.m4 (renamed from src/m4/ax_pthread.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/bitcoin_find_bdb48.m4 (renamed from src/m4/bitcoin_find_bdb48.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/bitcoin_qt.m4 (renamed from src/m4/bitcoin_qt.m4) | 0 | ||||
-rw-r--r-- | build-aux/m4/bitcoin_subdir_to_include.m4 (renamed from src/m4/bitcoin_subdir_to_include.m4) | 0 | ||||
-rw-r--r-- | configure.ac | 52 | ||||
-rw-r--r-- | contrib/init/README.md | 10 | ||||
-rw-r--r-- | contrib/init/bitcoind.conf | 65 | ||||
-rw-r--r-- | contrib/init/bitcoind.openrc | 86 | ||||
-rw-r--r-- | contrib/init/bitcoind.openrcconf | 27 | ||||
-rw-r--r-- | contrib/init/bitcoind.service (renamed from contrib/systemd/bitcoind.service) | 11 | ||||
-rw-r--r-- | doc/README.md | 2 | ||||
-rw-r--r-- | doc/init.md | 92 | ||||
-rw-r--r-- | doc/systemd.md | 47 | ||||
-rw-r--r-- | src/main.cpp | 34 | ||||
-rw-r--r-- | src/qt/forms/addressbookpage.ui | 15 | ||||
-rw-r--r-- | src/qt/forms/coincontroldialog.ui | 3 | ||||
-rw-r--r-- | src/qt/forms/openuridialog.ui | 6 | ||||
-rw-r--r-- | src/qt/forms/optionsdialog.ui | 6 | ||||
-rw-r--r-- | src/qt/forms/receivecoinsdialog.ui | 380 | ||||
-rw-r--r-- | src/qt/forms/receiverequestdialog.ui | 9 | ||||
-rw-r--r-- | src/qt/forms/rpcconsole.ui | 3 | ||||
-rw-r--r-- | src/qt/forms/sendcoinsdialog.ui | 9 | ||||
-rw-r--r-- | src/qt/forms/signverifymessagedialog.ui | 3 | ||||
-rw-r--r-- | src/txmempool.cpp | 2 |
36 files changed, 592 insertions, 295 deletions
diff --git a/.gitignore b/.gitignore index 24af4cb72e..7d00051f23 100644 --- a/.gitignore +++ b/.gitignore @@ -8,25 +8,32 @@ src/bitcoin-tx src/test/test_bitcoin src/qt/test/test_bitcoin-qt +# autoreconf Makefile.in aclocal.m4 autom4te.cache/ +build-aux/config.guess +build-aux/config.sub +build-aux/depcomp +build-aux/install-sh +build-aux/ltmain.sh +build-aux/m4/libtool.m4 +build-aux/m4/lt~obsolete.m4 +build-aux/m4/ltoptions.m4 +build-aux/m4/ltsugar.m4 +build-aux/m4/ltversion.m4 +build-aux/missing +build-aux/compile +build-aux/test-driver config.log config.status configure +libtool src/config/bitcoin-config.h src/config/bitcoin-config.h.in src/config/stamp-h1 -src/build-aux/ share/setup.nsi share/qt/Info.plist -# Libtool -libtool -src/m4/libtool.m4 -src/m4/ltoptions.m4 -src/m4/ltsugar.m4 -src/m4/ltversion.m4 -src/m4/lt~obsolete.m4 src/univalue/gen diff --git a/Makefile.am b/Makefile.am index a64666a32b..fe7244edf8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -ACLOCAL_AMFLAGS = -I src/m4 +ACLOCAL_AMFLAGS = -I build-aux/m4 SUBDIRS = src .PHONY: deploy FORCE diff --git a/src/m4/ax_boost_base.m4 b/build-aux/m4/ax_boost_base.m4 index 3f24d5ddc6..3f24d5ddc6 100644 --- a/src/m4/ax_boost_base.m4 +++ b/build-aux/m4/ax_boost_base.m4 diff --git a/src/m4/ax_boost_chrono.m4 b/build-aux/m4/ax_boost_chrono.m4 index 318ecea17f..318ecea17f 100644 --- a/src/m4/ax_boost_chrono.m4 +++ b/build-aux/m4/ax_boost_chrono.m4 diff --git a/src/m4/ax_boost_filesystem.m4 b/build-aux/m4/ax_boost_filesystem.m4 index f5c9d56470..f5c9d56470 100644 --- a/src/m4/ax_boost_filesystem.m4 +++ b/build-aux/m4/ax_boost_filesystem.m4 diff --git a/src/m4/ax_boost_program_options.m4 b/build-aux/m4/ax_boost_program_options.m4 index f591441854..f591441854 100644 --- a/src/m4/ax_boost_program_options.m4 +++ b/build-aux/m4/ax_boost_program_options.m4 diff --git a/src/m4/ax_boost_system.m4 b/build-aux/m4/ax_boost_system.m4 index 9c78280fca..9c78280fca 100644 --- a/src/m4/ax_boost_system.m4 +++ b/build-aux/m4/ax_boost_system.m4 diff --git a/src/m4/ax_boost_thread.m4 b/build-aux/m4/ax_boost_thread.m4 index 9f0bd0b23c..9f0bd0b23c 100644 --- a/src/m4/ax_boost_thread.m4 +++ b/build-aux/m4/ax_boost_thread.m4 diff --git a/src/m4/ax_boost_unit_test_framework.m4 b/build-aux/m4/ax_boost_unit_test_framework.m4 index 4efd1e2f18..4efd1e2f18 100644 --- a/src/m4/ax_boost_unit_test_framework.m4 +++ b/build-aux/m4/ax_boost_unit_test_framework.m4 diff --git a/src/m4/ax_check_compile_flag.m4 b/build-aux/m4/ax_check_compile_flag.m4 index c3a8d695a1..c3a8d695a1 100644 --- a/src/m4/ax_check_compile_flag.m4 +++ b/build-aux/m4/ax_check_compile_flag.m4 diff --git a/src/m4/ax_check_link_flag.m4 b/build-aux/m4/ax_check_link_flag.m4 index e2d0d363e4..e2d0d363e4 100644 --- a/src/m4/ax_check_link_flag.m4 +++ b/build-aux/m4/ax_check_link_flag.m4 diff --git a/src/m4/ax_check_preproc_flag.m4 b/build-aux/m4/ax_check_preproc_flag.m4 index b1cfef6b86..b1cfef6b86 100644 --- a/src/m4/ax_check_preproc_flag.m4 +++ b/build-aux/m4/ax_check_preproc_flag.m4 diff --git a/src/m4/ax_pthread.m4 b/build-aux/m4/ax_pthread.m4 index d383ad5c6d..d383ad5c6d 100644 --- a/src/m4/ax_pthread.m4 +++ b/build-aux/m4/ax_pthread.m4 diff --git a/src/m4/bitcoin_find_bdb48.m4 b/build-aux/m4/bitcoin_find_bdb48.m4 index 5223163fe5..5223163fe5 100644 --- a/src/m4/bitcoin_find_bdb48.m4 +++ b/build-aux/m4/bitcoin_find_bdb48.m4 diff --git a/src/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index e141033b19..e141033b19 100644 --- a/src/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 diff --git a/src/m4/bitcoin_subdir_to_include.m4 b/build-aux/m4/bitcoin_subdir_to_include.m4 index 66f106c7d4..66f106c7d4 100644 --- a/src/m4/bitcoin_subdir_to_include.m4 +++ b/build-aux/m4/bitcoin_subdir_to_include.m4 diff --git a/configure.ac b/configure.ac index 6dc71292df..7d525f8251 100644 --- a/configure.ac +++ b/configure.ac @@ -7,8 +7,8 @@ define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, false) define(_COPYRIGHT_YEAR, 2014) AC_INIT([Bitcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitcoin.org],[bitcoin]) -AC_CONFIG_AUX_DIR([src/build-aux]) -AC_CONFIG_MACRO_DIR([src/m4]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([build-aux/m4]) LT_INIT([disable-shared]) AC_CANONICAL_HOST AH_TOP([#ifndef BITCOIN_CONFIG_H]) @@ -44,6 +44,30 @@ AM_MAINTAINER_MODE([enable]) dnl make the compilation flags quiet unless V=1 is used m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +dnl Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CXXCPP +AC_PROG_INSTALL +AC_PROG_OBJC +AC_PROG_LN_S +m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX]) +AC_PROG_MKDIR_P +AC_PROG_SED +AC_PATH_TOOL(AR, ar) +AC_PATH_TOOL(RANLIB, ranlib) +AC_PATH_TOOL(STRIP, strip) +AC_PATH_TOOL(GCOV, gcov) +AC_PATH_PROG(LCOV, lcov) +AC_PATH_PROG(JAVA, java) +AC_PATH_PROG(GENHTML, genhtml) +AC_PATH_PROG([GIT], [git]) +AC_PATH_PROG(CCACHE,ccache) +AC_PATH_PROG(XGETTEXT,xgettext) +AC_PATH_PROG(HEXDUMP,hexdump) +PKG_PROG_PKG_CONFIG + # Enable wallet AC_ARG_ENABLE([wallet], [AS_HELP_STRING([--enable-wallet], @@ -120,30 +144,6 @@ AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[spec AC_CONFIG_SRCDIR([src]) AC_CONFIG_HEADERS([src/config/bitcoin-config.h]) -dnl Checks for programs. -AC_PROG_CXX -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CXXCPP -AC_PROG_INSTALL -AC_PROG_OBJC -AC_PROG_LN_S -m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX]) -AC_PROG_MKDIR_P -AC_PROG_SED -AC_PATH_TOOL(AR, ar) -AC_PATH_TOOL(RANLIB, ranlib) -AC_PATH_TOOL(STRIP, strip) -AC_PATH_TOOL(GCOV, gcov) -AC_PATH_PROG(LCOV, lcov) -AC_PATH_PROG(JAVA, java) -AC_PATH_PROG(GENHTML, genhtml) -AC_PATH_PROG([GIT], [git]) -AC_PATH_PROG(CCACHE,ccache) -AC_PATH_PROG(XGETTEXT,xgettext) -AC_PATH_PROG(HEXDUMP,hexdump) -PKG_PROG_PKG_CONFIG - # Enable debug AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], diff --git a/contrib/init/README.md b/contrib/init/README.md new file mode 100644 index 0000000000..d3fa966583 --- /dev/null +++ b/contrib/init/README.md @@ -0,0 +1,10 @@ +Sample configuration files for: + +SystemD: bitcoind.service +Upstart: bitcoind.conf +OpenRC: bitcoind.openrc + bitcoind.openrcconf + +have been made available to assist packagers in creating node packages here. + +See doc/init.md for more information. diff --git a/contrib/init/bitcoind.conf b/contrib/init/bitcoind.conf new file mode 100644 index 0000000000..f9554eecde --- /dev/null +++ b/contrib/init/bitcoind.conf @@ -0,0 +1,65 @@ +description "Bitcoin Core Daemon" + +start on runlevel [2345] +stop on starting rc RUNLEVEL=[016] + +env BITCOIND_BIN="/usr/bin/bitcoind" +env BITCOIND_USER="bitcoin" +env BITCOIND_GROUP="bitcoin" +env BITCOIND_PIDDIR="/var/run/bitcoind" +# upstart can't handle variables constructed with other variables +env BITCOIND_PIDFILE="/var/run/bitcoind/bitcoind.pid" +env BITCOIND_CONFIGFILE="/etc/bitcoin/bitcoin.conf" +env BITCOIND_DATADIR="/var/lib/bitcoind" + +expect fork + +respawn +respawn limit 5 120 +kill timeout 60 + +pre-start script + # this will catch non-existent config files + # bitcoind will check and exit with this very warning, but it can do so + # long after forking, leaving upstart to think everything started fine. + # since this is a commonly encountered case on install, just check and + # warn here. + if ! grep -qs '^rpcpassword=' "$BITCOIND_CONFIGFILE" ; then + echo "ERROR: You must set a secure rpcpassword to run bitcoind." + echo "The setting must appear in $BITCOIND_CONFIGFILE" + echo + echo "This password is security critical to securing wallets " + echo "and must not be the same as the rpcuser setting." + echo "You can generate a suitable random password using the following" + echo "command from the shell:" + echo + echo "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'" + echo + echo "It is also recommended that you also set alertnotify so you are " + echo "notified of problems:" + echo + echo "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \ + "admin@foo.com" + echo + exit 1 + fi + + mkdir -p "$BITCOIND_PIDDIR" + chmod 0755 "$BITCOIND_PIDDIR" + chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_PIDDIR" + chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_CONFIGFILE" + chmod 0660 "$BITCOIND_CONFIGFILE" +end script + +exec start-stop-daemon \ + --start \ + --pidfile "$BITCOIND_PIDFILE" \ + --chuid $BITCOIND_USER:$BITCOIND_GROUP \ + --exec "$BITCOIND_BIN" \ + -- \ + -pid="$BITCOIND_PIDFILE" \ + -conf="$BITCOIND_CONFIGFILE" \ + -datadir="$BITCOIND_DATADIR" \ + -disablewallet \ + -daemon + diff --git a/contrib/init/bitcoind.openrc b/contrib/init/bitcoind.openrc new file mode 100644 index 0000000000..1f7758c920 --- /dev/null +++ b/contrib/init/bitcoind.openrc @@ -0,0 +1,86 @@ +#!/sbin/runscript + +# backward compatibility for existing gentoo layout +# +if [ -d "/var/lib/bitcoin/.bitcoin" ]; then + BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoin/.bitcoin" +else + BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoind" +fi + +BITCOIND_CONFIGFILE=${BITCOIND_CONFIGFILE:-/etc/bitcoin/bitcoin.conf} +BITCOIND_PIDDIR=${BITCOIND_PIDDIR:-/var/run/bitcoind} +BITCOIND_PIDFILE=${BITCOIND_PIDFILE:-${BITCOIND_PIDDIR}/bitcoind.pid} +BITCOIND_DATADIR=${BITCOIND_DATADIR:-${BITCOIND_DEFAULT_DATADIR}} +BITCOIND_USER=${BITCOIND_USER:-bitcoin} +BITCOIND_GROUP=${BITCOIND_GROUP:-bitcoin} +BITCOIND_BIN=${BITCOIND_BIN:-/usr/bin/bitcoind} + +name="Bitcoin Core Daemon" +description="Bitcoin crypto-currency p2p network daemon" + +command="/usr/bin/bitcoind" +command_args="-pid=\"${BITCOIND_PIDFILE}\" \ + -conf=\"${BITCOIND_CONFIGFILE}\" \ + -datadir=\"${BITCOIND_DATADIR}\" \ + -daemon \ + ${BITCOIND_OPTS}" + +required_files="${BITCOIND_CONFIGFILE}" +start_stop_daemon_args="-u ${BITCOIND_USER} \ + -N ${BITCOIND_NICE:-0} -w 2000" +pidfile="${BITCOIND_PIDFILE}" +retry=60 + +depend() { + need localmount net +} + +# verify +# 1) that the datadir exists and is writable (or create it) +# 2) that a directory for the pid exists and is writable +# 3) ownership and permissions on the config file +start_pre() { + checkpath \ + -d \ + --mode 0750 \ + --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \ + "${BITCOIND_DATADIR}" + + checkpath \ + -d \ + --mode 0755 \ + --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \ + "${BITCOIND_PIDDIR}" + + checkpath -f \ + -o ${BITCOIND_USER}:${BITCOIND_GROUP} \ + -m 0660 \ + ${BITCOIND_CONFIGFILE} + + checkconfig || return 1 +} + +checkconfig() +{ + if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then + eerror "" + eerror "ERROR: You must set a secure rpcpassword to run bitcoind." + eerror "The setting must appear in ${BITCOIND_CONFIGFILE}" + eerror "" + eerror "This password is security critical to securing wallets " + eerror "and must not be the same as the rpcuser setting." + eerror "You can generate a suitable random password using the following" + eerror "command from the shell:" + eerror "" + eerror "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'" + eerror "" + eerror "It is also recommended that you also set alertnotify so you are " + eerror "notified of problems:" + eerror "" + eerror "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \ + "admin@foo.com" + eerror "" + return 1 + fi +} diff --git a/contrib/init/bitcoind.openrcconf b/contrib/init/bitcoind.openrcconf new file mode 100644 index 0000000000..d8d7f58337 --- /dev/null +++ b/contrib/init/bitcoind.openrcconf @@ -0,0 +1,27 @@ +# /etc/conf.d/bitcoind: config file for /etc/init.d/bitcoind + +# Config file location +#BITCOIND_CONFIGFILE="/etc/bitcoin/bitcoin.conf" + +# What directory to write pidfile to? (created and owned by $BITCOIND_USER) +#BITCOIND_PIDDIR="/var/run/bitcoind" + +# What filename to give the pidfile +#BITCOIND_PIDFILE="${BITCOIND_PIDDIR}/bitcoind.pid" + +# Where to write bitcoind data (be mindful that the blockchain is large) +#BITCOIND_DATADIR="/var/lib/bitcoind" + +# User and group to own bitcoind process +#BITCOIND_USER="bitcoin" +#BITCOIND_GROUP="bitcoin" + +# Path to bitcoind executable +#BITCOIND_BIN="/usr/bin/bitcoind" + +# Nice value to run bitcoind under +#BITCOIND_NICE=0 + +# Additional options (avoid -conf and -datadir, use flags above) +BITCOIND_OPTS="-disablewallet" + diff --git a/contrib/systemd/bitcoind.service b/contrib/init/bitcoind.service index edc81cc763..9132957c38 100644 --- a/contrib/systemd/bitcoind.service +++ b/contrib/init/bitcoind.service @@ -3,15 +3,20 @@ Description=Bitcoin's distributed currency daemon After=network.target [Service] -User=bitcoind -Group=bitcoind +User=bitcoin +Group=bitcoin Type=forking PIDFile=/var/lib/bitcoind/bitcoind.pid -ExecStart=/usr/bin/bitcoind -daemon -pid=/var/lib/bitcoind/bitcoind.pid -conf=/etc/bitcoind.conf -datadir=/var/lib/bitcoind +ExecStart=/usr/bin/bitcoind -daemon -pid=/var/lib/bitcoind/bitcoind.pid \ +-conf=/etc/bitcoin/bitcoin.conf -datadir=/var/lib/bitcoind -disablewallet Restart=always PrivateTmp=true +TimeoutStopSec=60s +TimeoutStartSec=2s +StartLimitInterval=120s +StartLimitBurst=5 [Install] WantedBy=multi-user.target diff --git a/doc/README.md b/doc/README.md index 10c9ad1799..d5d61738e8 100644 --- a/doc/README.md +++ b/doc/README.md @@ -67,7 +67,7 @@ The Bitcoin repo's [root README](https://github.com/bitcoin/bitcoin/blob/master/ - [Assets Attribution](assets-attribution.md) - [Files](files.md) - [Tor Support](tor.md) -- [Systemd](systemd.md) +- [Init Scripts (systemd/upstart/openrc)](init.md) License --------------------- diff --git a/doc/init.md b/doc/init.md new file mode 100644 index 0000000000..3d14025ab4 --- /dev/null +++ b/doc/init.md @@ -0,0 +1,92 @@ +Sample init scripts and service configuration for bitcoind +========================================================== + +Sample scripts and configuration files for systemd, Upstart and OpenRC +can be found in the contrib/init folder. + +contrib/init/bitcoind.service: systemd service unit configuration +contrib/init/bitcoind.openrc: OpenRC compatible SysV style init script +contrib/init/bitcoind.openrcconf: OpenRC conf.d file +contrib/init/bitcoind.conf: Upstart service configuration file + +1. Service User +--------------------------------- + +All three startup configurations assume the existence of a "bitcoin" user +and group. They must be created before attempting to use these scripts. + +2. Configuration +--------------------------------- + +At a bare minimum, bitcoind requires that the rpcpassword setting be set +when running as a daemon. If the configuration file does not exist or this +setting is not set, bitcoind will shutdown promptly after startup. + +This password does not have to be remembered or typed as it is mostly used +as a fixed token that bitcoind and client programs read from the configuration +file, however it is recommended that a strong and secure password be used +as this password is security critical to securing the wallet should the +wallet be enabled. + +If bitcoind is run with "-daemon" flag, and no rpcpassword is set, it will +print a randomly generated suitable password to stderr. You can also +generate one from the shell yourself like this: + +bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo' + +Once you have a password in hand, set rpcpassword= in /etc/bitcoin/bitcoin.conf + +For an example configuration file that describes the configuration settings, +see contrib/debian/examples/bitcoin.conf. + +3. Paths +--------------------------------- + +All three configurations assume several paths that might need to be adjusted. + +Binary: /usr/bin/bitcoind +Configuration file: /etc/bitcoin/bitcoin.conf +Data directory: /var/lib/bitcoind +PID file: /var/run/bitcoind/bitcoind.pid (OpenRC and Upstart) + /var/lib/bitcoind/bitcoind.pid (systemd) + +The configuration file, PID directory (if applicable) and data directory +should all be owned by the bitcoin user and group. It is advised for security +reasons to make the configuration file and data directory only readable by the +bitcoin user and group. Access to bitcoin-cli and other bitcoind rpc clients +can then be controlled by group membership. + +4. Installing Service Configuration +----------------------------------- + +4a) systemd + +Installing this .service file consists on just copying it to +/usr/lib/systemd/system directory, followed by the command +"systemctl daemon-reload" in order to update running systemd configuration. + +To test, run "systemctl start bitcoind" and to enable for system startup run +"systemctl enable bitcoind" + +4b) OpenRC + +Rename bitcoind.openrc to bitcoind and drop it in /etc/init.d. Double +check ownership and permissions and make it executable. Test it with +"/etc/init.d/bitcoind start" and configure it to run on startup with +"rc-update add bitcoind" + +4c) Upstart (for Debian/Ubuntu based distributions) + +Drop bitcoind.conf in /etc/init. Test by running "service bitcoind start" +it will automatically start on reboot. + +NOTE: This script is incompatible with CentOS 5 and Amazon Linux 2014 as they +use old versions of Upstart and do not supply the start-stop-daemon uitility. + +5. Auto-respawn +----------------------------------- + +Auto respawning is currently only configured for Upstart and systemd. +Reasonable defaults have been chosen but YMMV. + + diff --git a/doc/systemd.md b/doc/systemd.md deleted file mode 100644 index 96202c1532..0000000000 --- a/doc/systemd.md +++ /dev/null @@ -1,47 +0,0 @@ -SYSTEMD SUPPORT IN BITCOIN -========================== - -Packagers can find a .service file in this repo in order to integrate bitcoin's -daemon into systemd based distributions. - -bitcoind.service file is located in contrib/systemd/ folder. - -1. Users ---------------------------------- - -This .service file assumes bitcoind user and group exist in the system, so packager -should make sure they are created on installation. - -2. Files ---------------------------------- - -The .service file assumes several paths that might need to be adjusted according -to packager's needs. - -Daemon's config file is assumed to be located at /etc/bitcoind.conf (you can -use contrib/debian/examples/bitcoin.conf as an example). Once installed, users -must edit the file in order to update at least these two -values: rpcuser and rpcpassword . Failing to do so will make the daemon fail -to boot. However, the message written to /var/lib/bitcoind/debug.log file is -very helpful and no default values should be set: - - YYYY-MM-DD HH:MM:DD Error: To use the "-server" option, you must set a rpcpassword in the configuration file: - /etc/bitcoind.conf - It is recommended you use the following random password: - rpcuser=bitcoinrpc - rpcpassword=HdYZ5HGtAF7mx8aTw6uCATtD2maMAK4E12Ysp4YNZQcX - (you do not need to remember this password) - The username and password MUST NOT be the same. - If the file does not exist, create it with owner-readable-only file permissions. - It is also recommended to set alertnotify so you are notified of problems; - for example: alertnotify=echo %s | mail -s "Bitcoin Alert" admin@foo.com - -Daemon's data and pid files will be stored in /var/lib/bitcoind directory, so it -should be created on installation and make bitcoind user/group it's owner. - -3. Installing .service file ---------------------------------- - -Installing this .service file consists on just copying it to /usr/lib/systemd/system -directory, followed by the command "systemctl daemon-reload" in order to update -running systemd configuration. diff --git a/src/main.cpp b/src/main.cpp index 90f4e48af0..766553d948 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3791,15 +3791,16 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, bool fMissingInputs = false; CValidationState state; + + mapAlreadyAskedFor.erase(inv); + if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs)) { mempool.check(pcoinsTip); RelayTransaction(tx); - mapAlreadyAskedFor.erase(inv); vWorkQueue.push_back(inv.hash); vEraseQueue.push_back(inv.hash); - LogPrint("mempool", "AcceptToMemoryPool: peer=%d %s : accepted %s (poolsz %u)\n", pfrom->id, pfrom->cleanSubVer, tx.GetHash().ToString(), @@ -3833,7 +3834,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, { LogPrint("mempool", " accepted orphan tx %s\n", orphanHash.ToString()); RelayTransaction(orphanTx); - mapAlreadyAskedFor.erase(CInv(MSG_TX, orphanHash)); vWorkQueue.push_back(orphanHash); } else if (!fMissingInputs2) @@ -4111,21 +4111,25 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, else if (strCommand == "reject") { - if (fDebug) - { - string strMsg; unsigned char ccode; string strReason; - vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, 111); + if (fDebug) { + try { + string strMsg; unsigned char ccode; string strReason; + vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, 111); - ostringstream ss; - ss << strMsg << " code " << itostr(ccode) << ": " << strReason; + ostringstream ss; + ss << strMsg << " code " << itostr(ccode) << ": " << strReason; - if (strMsg == "block" || strMsg == "tx") - { - uint256 hash; - vRecv >> hash; - ss << ": hash " << hash.ToString(); + if (strMsg == "block" || strMsg == "tx") + { + uint256 hash; + vRecv >> hash; + ss << ": hash " << hash.ToString(); + } + LogPrint("net", "Reject %s\n", SanitizeString(ss.str())); + } catch (std::ios_base::failure& e) { + // Avoid feedback loops by preventing reject messages from triggering a new reject message. + LogPrint("net", "Unparseable reject message received\n"); } - LogPrint("net", "Reject %s\n", SanitizeString(ss.str())); } } diff --git a/src/qt/forms/addressbookpage.ui b/src/qt/forms/addressbookpage.ui index f40c446050..52fdc6ef06 100644 --- a/src/qt/forms/addressbookpage.ui +++ b/src/qt/forms/addressbookpage.ui @@ -63,6 +63,9 @@ <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/add</normaloff>:/icons/add</iconset> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> @@ -77,6 +80,9 @@ <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/editcopy</normaloff>:/icons/editcopy</iconset> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> @@ -91,6 +97,9 @@ <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> @@ -118,6 +127,9 @@ <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/export</normaloff>:/icons/export</iconset> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> @@ -131,6 +143,9 @@ <property name="text"> <string>C&lose</string> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> </layout> diff --git a/src/qt/forms/coincontroldialog.ui b/src/qt/forms/coincontroldialog.ui index 67ea3a9d8c..cbe58fec65 100644 --- a/src/qt/forms/coincontroldialog.ui +++ b/src/qt/forms/coincontroldialog.ui @@ -363,6 +363,9 @@ <property name="text"> <string>(un)select all</string> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> diff --git a/src/qt/forms/openuridialog.ui b/src/qt/forms/openuridialog.ui index cd09ed0246..7fce858bd2 100644 --- a/src/qt/forms/openuridialog.ui +++ b/src/qt/forms/openuridialog.ui @@ -31,8 +31,7 @@ </widget> </item> <item> - <widget class="QValidatedLineEdit" name="uriEdit"> - </widget> + <widget class="QValidatedLineEdit" name="uriEdit"/> </item> <item> <widget class="QPushButton" name="selectFileButton"> @@ -42,6 +41,9 @@ <property name="text"> <string notr="true">…</string> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> </layout> diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 47ed4c8bc6..9d094c1a73 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -609,6 +609,12 @@ <property name="text"> <string>&OK</string> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> </widget> </item> <item> diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui index e1a0a28f81..03fcb2fb50 100644 --- a/src/qt/forms/receivecoinsdialog.ui +++ b/src/qt/forms/receivecoinsdialog.ui @@ -12,192 +12,189 @@ </property> <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1"> <item> - <widget class="QFrame" name="frame2"> - <property name="sizePolicy"> + <widget class="QFrame" name="frame2"> + <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> + <horstretch>0</horstretch> + <verstretch>0</verstretch> </sizepolicy> - </property> - <property name="frameShape"> + </property> + <property name="frameShape"> <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> + </property> + <property name="frameShadow"> <enum>QFrame::Sunken</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="7" column="2"> - <widget class="QCheckBox" name="reuseAddress"> - <property name="toolTip"> - <string>Reuse one of the previously used receiving addresses. Reusing addresses has security and privacy issues. Do not use this unless re-generating a payment request made before.</string> - </property> - <property name="text"> - <string>R&euse an existing receiving address (not recommended)</string> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_3"> - <property name="toolTip"> - <string>An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Bitcoin network.</string> - </property> - <property name="text"> - <string>&Message:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>reqMessage</cstring> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QLineEdit" name="reqLabel"> - <property name="toolTip"> - <string>An optional label to associate with the new receiving address.</string> - </property> - </widget> - </item> - <item row="6" column="2"> - <widget class="QLineEdit" name="reqMessage"> - <property name="toolTip"> - <string>An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Bitcoin network.</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Use this form to request payments. All fields are <b>optional</b>.</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_2"> - <property name="toolTip"> - <string>An optional label to associate with the new receiving address.</string> - </property> - <property name="text"> - <string>&Label:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>reqLabel</cstring> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label"> - <property name="toolTip"> - <string>An optional amount to request. Leave this empty or zero to not request a specific amount.</string> - </property> - <property name="text"> - <string>&Amount:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="buddy"> - <cstring>reqAmount</cstring> - </property> - </widget> - </item> - <item row="5" column="2"> - <widget class="BitcoinAmountField" name="reqAmount"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>An optional amount to request. Leave this empty or zero to not request a specific amount.</string> - </property> - </widget> - </item> - <item row="8" column="2"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="receiveButton"> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>&Request payment</string> - </property> - <property name="icon"> - <iconset resource="../bitcoin.qrc"> - <normaloff>:/icons/receiving_addresses</normaloff>:/icons/receiving_addresses</iconset> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="clearButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Clear all fields of the form.</string> - </property> - <property name="text"> - <string>Clear</string> - </property> - <property name="icon"> - <iconset resource="../bitcoin.qrc"> - <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> - </property> - <property name="autoRepeatDelay"> - <number>300</number> - </property> - <property name="autoDefault"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="8" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="7" column="2"> + <widget class="QCheckBox" name="reuseAddress"> + <property name="toolTip"> + <string>Reuse one of the previously used receiving addresses. Reusing addresses has security and privacy issues. Do not use this unless re-generating a payment request made before.</string> + </property> + <property name="text"> + <string>R&euse an existing receiving address (not recommended)</string> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_3"> + <property name="toolTip"> + <string>An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Bitcoin network.</string> + </property> + <property name="text"> + <string>&Message:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>reqMessage</cstring> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QLineEdit" name="reqLabel"> + <property name="toolTip"> + <string>An optional label to associate with the new receiving address.</string> + </property> + </widget> + </item> + <item row="6" column="2"> + <widget class="QLineEdit" name="reqMessage"> + <property name="toolTip"> + <string>An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Bitcoin network.</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Use this form to request payments. All fields are <b>optional</b>.</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_2"> + <property name="toolTip"> + <string>An optional label to associate with the new receiving address.</string> + </property> + <property name="text"> + <string>&Label:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>reqLabel</cstring> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label"> + <property name="toolTip"> + <string>An optional amount to request. Leave this empty or zero to not request a specific amount.</string> + </property> + <property name="text"> + <string>&Amount:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="buddy"> + <cstring>reqAmount</cstring> + </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="BitcoinAmountField" name="reqAmount"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>An optional amount to request. Leave this empty or zero to not request a specific amount.</string> + </property> + </widget> + </item> + <item row="8" column="2"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QPushButton" name="receiveButton"> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>&Request payment</string> + </property> + <property name="icon"> + <iconset resource="../bitcoin.qrc"> + <normaloff>:/icons/receiving_addresses</normaloff>:/icons/receiving_addresses</iconset> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="clearButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Clear all fields of the form.</string> + </property> + <property name="text"> + <string>Clear</string> + </property> + <property name="icon"> + <iconset resource="../bitcoin.qrc"> + <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="8" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> </item> <item> <spacer name="verticalSpacer_2"> @@ -257,36 +254,42 @@ <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QPushButton" name="showRequestButton"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="toolTip"> <string>Show the selected request (does the same as double clicking an entry)</string> </property> <property name="text"> <string>Show</string> </property> - <property name="enabled"> - <bool>false</bool> - </property> <property name="icon"> <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/edit</normaloff>:/icons/edit</iconset> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> <widget class="QPushButton" name="removeRequestButton"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="toolTip"> <string>Remove the selected entries from the list</string> </property> <property name="text"> <string>Remove</string> </property> - <property name="enabled"> - <bool>false</bool> - </property> <property name="icon"> <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> @@ -314,6 +317,7 @@ <class>BitcoinAmountField</class> <extends>QLineEdit</extends> <header>bitcoinamountfield.h</header> + <container>1</container> </customwidget> </customwidgets> <tabstops> diff --git a/src/qt/forms/receiverequestdialog.ui b/src/qt/forms/receiverequestdialog.ui index 85928c9be5..1e484dd9a0 100644 --- a/src/qt/forms/receiverequestdialog.ui +++ b/src/qt/forms/receiverequestdialog.ui @@ -74,6 +74,9 @@ <property name="text"> <string>Copy &URI</string> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> @@ -81,6 +84,9 @@ <property name="text"> <string>Copy &Address</string> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> @@ -88,6 +94,9 @@ <property name="text"> <string>&Save Image...</string> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index b9b90aa846..7f28209c9a 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -484,6 +484,9 @@ <property name="text"> <string>&Clear</string> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> </layout> diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index a631b04670..dce7f4ce4c 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -109,6 +109,9 @@ <property name="text"> <string>Inputs...</string> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> </widget> </item> <item> @@ -674,6 +677,9 @@ <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/send</normaloff>:/icons/send</iconset> </property> + <property name="autoDefault"> + <bool>false</bool> + </property> <property name="default"> <bool>true</bool> </property> @@ -697,9 +703,6 @@ <iconset resource="../bitcoin.qrc"> <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> </property> - <property name="autoRepeatDelay"> - <number>300</number> - </property> <property name="autoDefault"> <bool>false</bool> </property> diff --git a/src/qt/forms/signverifymessagedialog.ui b/src/qt/forms/signverifymessagedialog.ui index 53573ec821..40b2da3228 100644 --- a/src/qt/forms/signverifymessagedialog.ui +++ b/src/qt/forms/signverifymessagedialog.ui @@ -19,6 +19,9 @@ <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> <widget class="QWidget" name="tabSignMessage"> <attribute name="title"> <string>&Sign Message</string> diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 404cca2373..52d07bf6a0 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -13,7 +13,7 @@ using namespace std; CTxMemPoolEntry::CTxMemPoolEntry(): - nFee(0), nTxSize(0), nTime(0), dPriority(0.0) + nFee(0), nTxSize(0), nModSize(0), nTime(0), dPriority(0.0) { nHeight = MEMPOOL_HEIGHT; } |