From 1971f5ba04de9ac1e1a95d9f727e7bd4bc35dc88 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Sun, 30 Dec 2018 14:19:14 -0800 Subject: [PATCH 1/4] Piecewise construct to avoid invalid construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In CMainSignals::RegisterWithMempoolSignals running under Ubuntu 14.04 (QT 5.2), absent piecewise construction this fails to create the pair because the argument is a connection, which is converted into a non-copyable scoped_connection. validationinterface.cpp:80:186: required from here /usr/include/boost/signals2/connection.hpp:234:7: error: ‘boost::signals2::scoped_connection::scoped_connection(const boost::signals2::scoped_connection&)’ is private scoped_connection(const scoped_connection &other); ^ In file included from /usr/include/c++/4.8/utility:70:0, from /usr/include/c++/4.8/algorithm:60, from ./prevector.h:13, from ./script/script.h:10, from ./primitives/transaction.h:11, from ./validationinterface.h:9, from validationinterface.cpp:6: /usr/include/c++/4.8/bits/stl_pair.h:134:45: error: within this context : first(std::forward<_U1>(__x)), second(__y) { } https://travis-ci.org/bitcoin/bitcoin/jobs/473689141#L2172 --- src/validationinterface.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index 533d412888..2e13bef19e 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -77,7 +78,10 @@ size_t CMainSignals::CallbacksPending() { } void CMainSignals::RegisterWithMempoolSignals(CTxMemPool& pool) { - g_connNotifyEntryRemoved.emplace(&pool, pool.NotifyEntryRemoved.connect(std::bind(&CMainSignals::MempoolEntryRemoved, this, std::placeholders::_1, std::placeholders::_2))); + g_connNotifyEntryRemoved.emplace(std::piecewise_construct, + std::forward_as_tuple(&pool), + std::forward_as_tuple(pool.NotifyEntryRemoved.connect(std::bind(&CMainSignals::MempoolEntryRemoved, this, std::placeholders::_1, std::placeholders::_2))) + ); } void CMainSignals::UnregisterWithMempoolSignals(CTxMemPool& pool) { From 267eac00f968850c859474434570ac8e1fce29f5 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Thu, 31 Jan 2019 10:46:23 -0800 Subject: [PATCH 2/4] Prefer boost::optional#get_value_or over #value_or The latter is not defined in the earliest supported version of boost, 1.47. https://www.boost.org/doc/libs/1_47_0/libs/optional/doc/html/boost_optional/detailed_semantics.html https://travis-ci.org/bitcoin/bitcoin/jobs/486674823 --- src/interfaces/wallet.cpp | 4 ++-- src/wallet/rpcdump.cpp | 2 +- src/wallet/wallet.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 62ede0a95a..a2cae2a7a7 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -353,7 +353,7 @@ public: LOCK(m_wallet.cs_wallet); auto mi = m_wallet.mapWallet.find(txid); if (mi != m_wallet.mapWallet.end()) { - num_blocks = locked_chain->getHeight().value_or(-1); + num_blocks = locked_chain->getHeight().get_value_or(-1); in_mempool = mi->second.InMempool(); order_form = mi->second.vOrderForm; tx_status = MakeWalletTxStatus(*locked_chain, mi->second); @@ -384,7 +384,7 @@ public: return false; } balances = getBalances(); - num_blocks = locked_chain->getHeight().value_or(-1); + num_blocks = locked_chain->getHeight().get_value_or(-1); return true; } CAmount getBalance() override { return m_wallet.GetBalance(); } diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 2e62a6979f..0daaf94726 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -785,7 +785,7 @@ UniValue dumpwallet(const JSONRPCRequest& request) file << strprintf("# Wallet dump created by Bitcoin %s\n", CLIENT_BUILD); file << strprintf("# * Created on %s\n", FormatISO8601DateTime(GetTime())); const Optional tip_height = locked_chain->getHeight(); - file << strprintf("# * Best block at time of backup was %i (%s),\n", tip_height.value_or(-1), tip_height ? locked_chain->getBlockHash(*tip_height).ToString() : "(missing block hash)"); + file << strprintf("# * Best block at time of backup was %i (%s),\n", tip_height.get_value_or(-1), tip_height ? locked_chain->getBlockHash(*tip_height).ToString() : "(missing block hash)"); file << strprintf("# mined on %s\n", tip_height ? FormatISO8601DateTime(locked_chain->getBlockTime(*tip_height)) : "(missing block time)"); file << "\n"; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5c379aacd6..3805f46e1a 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1717,10 +1717,10 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc } ShowProgress(strprintf("%s " + _("Rescanning..."), GetDisplayName()), 100); // hide progress dialog in GUI if (block_height && fAbortRescan) { - WalletLogPrintf("Rescan aborted at block %d. Progress=%f\n", block_height.value_or(0), progress_current); + WalletLogPrintf("Rescan aborted at block %d. Progress=%f\n", block_height.get_value_or(0), progress_current); result.status = ScanResult::USER_ABORT; } else if (block_height && ShutdownRequested()) { - WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", block_height.value_or(0), progress_current); + WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", block_height.get_value_or(0), progress_current); result.status = ScanResult::USER_ABORT; } } @@ -2581,7 +2581,7 @@ static bool IsCurrentForAntiFeeSniping(interfaces::Chain::Lock& locked_chain) */ static uint32_t GetLocktimeForNewTransaction(interfaces::Chain::Lock& locked_chain) { - uint32_t const height = locked_chain.getHeight().value_or(-1); + uint32_t const height = locked_chain.getHeight().get_value_or(-1); uint32_t locktime; // Discourage fee sniping. // From 64f28545e373defca8ed3d0b6f2856d8433b6dba Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Wed, 30 Jan 2019 15:18:30 -0800 Subject: [PATCH 3/4] Revert "travis: Compile trusty with depends for now" Thus building against system rather than depends libs This reverts commit fa5ce3f10ea98e5cd6bdd829b5b7b8fd2736d286. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8bfe39ed8f..59b9000028 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,11 +100,12 @@ jobs: BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-fuzz --enable-glibc-back-compat --enable-reduce-exports --enable-debug CXXFLAGS=\"-g0 -O2\"" - stage: test - name: 'x86_64 Linux [GOAL: install] [trusty] [depends for now]' + name: 'x86_64 Linux [GOAL: install] [trusty] [no depends, only system libs]' env: >- HOST=x86_64-unknown-linux-gnu DOCKER_NAME_TAG=ubuntu:14.04 PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libicu-dev libpng-dev libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.1++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev" + NO_DEPENDS=1 RUN_FUNCTIONAL_TESTS=false GOAL="install" BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=no" From 119d360aabfac893cb95def9d20aae7493c933ab Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Thu, 31 Jan 2019 22:13:45 -0800 Subject: [PATCH 4/4] travis: Document whether functional tests are run in the job name --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 59b9000028..99b20dd0d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,7 +100,7 @@ jobs: BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-fuzz --enable-glibc-back-compat --enable-reduce-exports --enable-debug CXXFLAGS=\"-g0 -O2\"" - stage: test - name: 'x86_64 Linux [GOAL: install] [trusty] [no depends, only system libs]' + name: 'x86_64 Linux [GOAL: install] [trusty] [no functional tests, no depends, only system libs]' env: >- HOST=x86_64-unknown-linux-gnu DOCKER_NAME_TAG=ubuntu:14.04 @@ -140,7 +140,7 @@ jobs: BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports" - stage: test - name: 'macOS 10.10 [GOAL: deploy]' + name: 'macOS 10.10 [GOAL: deploy] [no functional tests]' env: >- HOST=x86_64-apple-darwin14 PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev python3-setuptools-git"