Merge pull request #4566 from Munkybooty/backports-0.19-pr6

Backports 0.19 pr6
This commit is contained in:
PastaPastaPasta 2021-11-30 00:44:25 -05:00 committed by GitHub
commit f00a27ec97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 190 additions and 36 deletions

View File

@ -204,6 +204,19 @@ after_success:
script:
- set -o errexit; source .travis/lint_06_script.sh
- stage: extended-lint
name: 'extended lint [runtime >= 60 seconds]'
env:
cache: false
language: python
python: '3.5'
install:
- set -o errexit; source .travis/extended_lint_04_install.sh
before_script:
- set -o errexit; source .travis/lint_05_before_script.sh
script:
- set -o errexit; source .travis/extended_lint_06_script.sh
- stage: test
name: 'ARM [GOAL: install] [no unit or functional tests]'
env: >-
@ -284,7 +297,7 @@ after_success:
RUN_FUNCTIONAL_TESTS=false
RUN_FUZZ_TESTS=true
GOAL="install"
BITCOIN_CONFIG="--disable-wallet --disable-bench --with-utils=no --with-daemon=no --with-libs=no --with-gui=no --enable-fuzz --with-sanitizers=fuzzer,address CC=clang CXX=clang++"
BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,address CC=clang CXX=clang++"
- stage: test
env: >-

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
#
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
export LC_ALL=C
CPPCHECK_VERSION=1.86
curl -s https://codeload.github.com/danmar/cppcheck/tar.gz/${CPPCHECK_VERSION} | tar -zxf - --directory /tmp/
(cd /tmp/cppcheck-${CPPCHECK_VERSION}/ && make CFGDIR=/tmp/cppcheck-${CPPCHECK_VERSION}/cfg/ > /dev/null)
export PATH="$PATH:/tmp/cppcheck-${CPPCHECK_VERSION}/"

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
#
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
export LC_ALL=C
test/lint/extended-lint-all.sh

View File

@ -28,6 +28,7 @@ if [ "$CHECK_DOC" = 1 ]; then
test/lint/check-rpc-mappings.py .
# Run all linters
test/lint/lint-all.sh
test/lint/extended-lint-all.sh
fi
ccache --max-size=$CCACHE_SIZE

View File

@ -145,7 +145,8 @@ AC_ARG_ENABLE([extended-functional-tests],
[use_extended_functional_tests=no])
AC_ARG_ENABLE([fuzz],
AS_HELP_STRING([--enable-fuzz],[enable building of fuzz targets (default no)]),
AS_HELP_STRING([--enable-fuzz],
[enable building of fuzz targets (default no). enabling this will disable all other targets]),
[enable_fuzz=$enableval],
[enable_fuzz=no])
@ -1118,6 +1119,37 @@ dnl it would break GCC's #include_next.
AC_DEFUN([SUPPRESS_WARNINGS],
[$(echo $1 |${SED} -E -e 's/(^| )-I/\1-isystem /g' -e 's;-isystem /usr/include([/ ]|$);-I/usr/include\1;g')])
dnl enable-fuzz should disable all other targets
if test "x$enable_fuzz" = "xyes"; then
AC_MSG_WARN(enable-fuzz will disable all other targets)
build_bitcoin_utils=no
build_bitcoin_cli=no
build_bitcoin_tx=no
build_bitcoin_wallet=no
build_bitcoind=no
build_bitcoin_libs=no
bitcoin_enable_qt=no
bitcoin_enable_qt_test=no
bitcoin_enable_qt_dbus=no
enable_wallet=no
use_bench=no
use_upnp=no
use_zmq=no
else
BITCOIN_QT_INIT
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
BITCOIN_QT_CONFIGURE([5.5.1])
dnl Keep a copy of the original $QT_INCLUDES and use it when invoking qt's moc
QT_INCLUDES_UNSUPPRESSED=$QT_INCLUDES
if test x$suppress_external_warnings != xno ; then
QT_INCLUDES=SUPPRESS_WARNINGS($QT_INCLUDES)
QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES)
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
fi
fi
if test x$enable_wallet != xno; then
dnl Check for libdb_cxx only if wallet enabled
BITCOIN_FIND_BDB48
@ -1155,19 +1187,6 @@ if test x$have_miniupnpc != xno; then
fi
fi
BITCOIN_QT_INIT
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
BITCOIN_QT_CONFIGURE([5.5.1])
dnl Keep a copy of the original $QT_INCLUDES and use it when invoking qt's moc
QT_INCLUDES_UNSUPPRESSED=$QT_INCLUDES
if test x$suppress_external_warnings != xno ; then
QT_INCLUDES=SUPPRESS_WARNINGS($QT_INCLUDES)
QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES)
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
fi
if test x$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnonononononono; then
use_boost=no
else

View File

@ -1,11 +1,11 @@
package=expat
$(package)_version=2.2.6
$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_2_2_6/
$(package)_version=2.2.7
$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_2_2_7/
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
$(package)_sha256_hash=17b43c2716d521369f82fc2dc70f359860e90fa440bea65b3b85f0b246ea81f2
$(package)_sha256_hash=cbc9102f4a31a8dafd42d642e9a3aa31e79a0aedaa1f6efd2795ebc83174ec18
define $(package)_set_vars
$(package)_config_opts=--disable-static --without-docbook
$(package)_config_opts=--disable-static --without-docbook --without-tests --without-examples
endef
define $(package)_config_cmds

View File

@ -52,7 +52,7 @@ For macOS you may need to ignore x86 compilation checks when running `make`:
To build Dash Core using AFL instrumentation (this assumes that the
`AFLPATH` was set as above):
```
./configure --disable-ccache --disable-shared --enable-tests --enable-fuzz --disable-wallet --disable-bench --with-utils=no --with-daemon=no --with-libs=no --with-gui=no CC=${AFLPATH}/afl-gcc CXX=${AFLPATH}/afl-g++
./configure --disable-ccache --disable-shared --enable-tests --enable-fuzz CC=${AFLPATH}/afl-gcc CXX=${AFLPATH}/afl-g++
export AFL_HARDEN=1
make
```
@ -102,7 +102,7 @@ libFuzzer is needed (all found in the `compiler-rt` runtime libraries package).
To build all fuzz targets with libFuzzer, run
```
./configure --disable-ccache --disable-wallet --disable-bench --with-utils=no --with-daemon=no --with-libs=no --with-gui=no --enable-fuzz --with-sanitizers=fuzzer,address CC=clang CXX=clang++
./configure --disable-ccache --enable-fuzz --with-sanitizers=fuzzer,address CC=clang CXX=clang++
make
```

View File

@ -58,7 +58,7 @@ struct DBHeightKey {
int height;
DBHeightKey() : height(0) {}
DBHeightKey(int height_in) : height(height_in) {}
explicit DBHeightKey(int height_in) : height(height_in) {}
template<typename Stream>
void Serialize(Stream& s) const
@ -81,7 +81,7 @@ struct DBHeightKey {
struct DBHashKey {
uint256 hash;
DBHashKey(const uint256& hash_in) : hash(hash_in) {}
explicit DBHashKey(const uint256& hash_in) : hash(hash_in) {}
SERIALIZE_METHODS(DBHashKey, obj)
{

View File

@ -243,7 +243,7 @@ public:
class RpcHandlerImpl : public Handler
{
public:
RpcHandlerImpl(const CRPCCommand& command) : m_command(command), m_wrapped_command(&command)
explicit RpcHandlerImpl(const CRPCCommand& command) : m_command(command), m_wrapped_command(&command)
{
m_command.actor = [this](const JSONRPCRequest& request, UniValue& result, bool last_handler) {
if (!m_wrapped_command) return false;

View File

@ -334,7 +334,6 @@ static std::string serviceFlagToStr(size_t bit)
case NODE_NETWORK: return "NETWORK";
case NODE_GETUTXO: return "GETUTXO";
case NODE_BLOOM: return "BLOOM";
case NODE_XTHIN: return "XTHIN";
case NODE_COMPACT_FILTERS: return "COMPACT_FILTERS";
case NODE_NETWORK_LIMITED: return "NETWORK_LIMITED";
// Not using default, so we get warned when a case is missing

View File

@ -1,5 +1,5 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Copyright (c) 2009-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -314,9 +314,6 @@ enum ServiceFlags : uint64_t {
// Dash Core nodes used to support this by default, without advertising this bit,
// but no longer do as of protocol version 70201 (= NO_BLOOM_VERSION)
NODE_BLOOM = (1 << 2),
// NODE_XTHIN means the node supports Xtreme Thinblocks
// If this is turned off then the node will not service nor make xthin requests
NODE_XTHIN = (1 << 4),
// NODE_COMPACT_FILTERS means the node will service basic block filter requests.
// See BIP157 and BIP158 for details on how this is implemented.
NODE_COMPACT_FILTERS = (1 << 6),

View File

@ -15,10 +15,10 @@
#include <base58.h>
#include <chainparams.h>
#include <primitives/transaction.h>
#include <interfaces/node.h>
#include <key_io.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <protocol.h>
#include <script/script.h>
#include <script/standard.h>
@ -884,7 +884,7 @@ fs::path static GetAutostartFilePath()
std::string chain = gArgs.GetChainName();
if (chain == CBaseChainParams::MAIN)
return GetAutostartDir() / "dashcore.desktop";
return GetAutostartDir() / strprintf("dashcore-%s.lnk", chain);
return GetAutostartDir() / strprintf("dashcore-%s.desktop", chain);
}
bool GetStartOnSystemStartup()

View File

@ -221,7 +221,7 @@ struct RPCResults {
struct RPCExamples {
const std::string m_examples;
RPCExamples(
explicit RPCExamples(
std::string examples)
: m_examples(std::move(examples))
{

View File

@ -4197,8 +4197,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
{
LOCK(cs_wallet);
if (IsLocked(true))
return false;
if (IsLocked(true)) return false;
// Top up key pool
unsigned int nTargetSize;
@ -4267,8 +4266,7 @@ bool CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool, bool fRe
{
LOCK(cs_wallet);
if (!IsLocked(true))
TopUpKeyPool();
TopUpKeyPool();
bool fReturningInternal = IsHDEnabled() && fRequestedInternal;
std::set<int64_t>& setKeyPool = fReturningInternal ? setInternalKeyPool : setExternalKeyPool;

26
test/lint/extended-lint-all.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# This script runs all contrib/devtools/extended-lint-*.sh files, and fails if
# any exit with a non-zero status code.
# This script is intentionally locale dependent by not setting "export LC_ALL=C"
# in order to allow for the executed lint scripts to opt in or opt out of locale
# dependence themselves.
set -u
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
LINTALL=$(basename "${BASH_SOURCE[0]}")
for f in "${SCRIPTDIR}"/extended-lint-*.sh; do
if [ "$(basename "$f")" != "$LINTALL" ]; then
if ! "$f"; then
echo "^---- failure generated from $f"
exit 1
fi
fi
done

View File

@ -0,0 +1,80 @@
#!/usr/bin/env bash
#
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
export LC_ALL=C
ENABLED_CHECKS=(
"Class '.*' has a constructor with 1 argument that is not explicit."
"Struct '.*' has a constructor with 1 argument that is not explicit."
)
IGNORED_WARNINGS=(
"src/arith_uint256.h:.* Class 'arith_uint256' has a constructor with 1 argument that is not explicit."
"src/arith_uint256.h:.* Class 'base_uint < 256 >' has a constructor with 1 argument that is not explicit."
"src/arith_uint256.h:.* Class 'base_uint' has a constructor with 1 argument that is not explicit."
"src/coins.h:.* Class 'CCoinsViewBacked' has a constructor with 1 argument that is not explicit."
"src/coins.h:.* Class 'CCoinsViewCache' has a constructor with 1 argument that is not explicit."
"src/coins.h:.* Class 'CCoinsViewCursor' has a constructor with 1 argument that is not explicit."
"src/net.h:.* Class 'CNetMessage' has a constructor with 1 argument that is not explicit."
"src/policy/feerate.h:.* Class 'CFeeRate' has a constructor with 1 argument that is not explicit."
"src/prevector.h:.* Class 'const_iterator' has a constructor with 1 argument that is not explicit."
"src/prevector.h:.* Class 'const_reverse_iterator' has a constructor with 1 argument that is not explicit."
"src/prevector.h:.* Class 'iterator' has a constructor with 1 argument that is not explicit."
"src/prevector.h:.* Class 'reverse_iterator' has a constructor with 1 argument that is not explicit."
"src/primitives/block.h:.* Class 'CBlock' has a constructor with 1 argument that is not explicit."
"src/primitives/transaction.h:.* Class 'CTransaction' has a constructor with 1 argument that is not explicit."
"src/protocol.h:.* Class 'CMessageHeader' has a constructor with 1 argument that is not explicit."
"src/qt/guiutil.h:.* Class 'ItemDelegate' has a constructor with 1 argument that is not explicit."
"src/rpc/util.h:.* Struct 'RPCResults' has a constructor with 1 argument that is not explicit."
"src/rpc/util.h:.* style: Struct 'UniValueType' has a constructor with 1 argument that is not explicit."
"src/script/descriptor.cpp:.* Class 'AddressDescriptor' has a constructor with 1 argument that is not explicit."
"src/script/descriptor.cpp:.* Class 'ComboDescriptor' has a constructor with 1 argument that is not explicit."
"src/script/descriptor.cpp:.* Class 'ConstPubkeyProvider' has a constructor with 1 argument that is not explicit."
"src/script/descriptor.cpp:.* Class 'PKDescriptor' has a constructor with 1 argument that is not explicit."
"src/script/descriptor.cpp:.* Class 'PKHDescriptor' has a constructor with 1 argument that is not explicit."
"src/script/descriptor.cpp:.* Class 'RawDescriptor' has a constructor with 1 argument that is not explicit."
"src/script/descriptor.cpp:.* Class 'SHDescriptor' has a constructor with 1 argument that is not explicit."
"src/script/descriptor.cpp:.* Class 'WPKHDescriptor' has a constructor with 1 argument that is not explicit."
"src/script/descriptor.cpp:.* Class 'WSHDescriptor' has a constructor with 1 argument that is not explicit."
"src/script/script.h:.* Class 'CScript' has a constructor with 1 argument that is not explicit."
"src/script/standard.h:.* Class 'CScriptID' has a constructor with 1 argument that is not explicit."
"src/support/allocators/secure.h:.* Struct 'secure_allocator < char >' has a constructor with 1 argument that is not explicit."
"src/support/allocators/secure.h:.* Struct 'secure_allocator < RNGState >' has a constructor with 1 argument that is not explicit."
"src/support/allocators/secure.h:.* Struct 'secure_allocator < unsigned char >' has a constructor with 1 argument that is not explicit."
"src/support/allocators/zeroafterfree.h:.* Struct 'zero_after_free_allocator < char >' has a constructor with 1 argument that is not explicit."
"src/test/checkqueue_tests.cpp:.* Struct 'FailingCheck' has a constructor with 1 argument that is not explicit."
"src/test/checkqueue_tests.cpp:.* Struct 'MemoryCheck' has a constructor with 1 argument that is not explicit."
"src/test/checkqueue_tests.cpp:.* Struct 'UniqueCheck' has a constructor with 1 argument that is not explicit."
"src/wallet/db.h:.* Class 'BerkeleyEnvironment' has a constructor with 1 argument that is not explicit."
)
if ! command -v cppcheck > /dev/null; then
echo "Skipping cppcheck linting since cppcheck is not installed. Install by running \"apt install cppcheck\""
exit 0
fi
function join_array {
local IFS="$1"
shift
echo "$*"
}
ENABLED_CHECKS_REGEXP=$(join_array "|" "${ENABLED_CHECKS[@]}")
IGNORED_WARNINGS_REGEXP=$(join_array "|" "${IGNORED_WARNINGS[@]}")
WARNINGS=$(git ls-files -- "*.cpp" "*.h" ":(exclude)src/leveldb/" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" | \
xargs cppcheck --enable=all -j "$(getconf _NPROCESSORS_ONLN)" --language=c++ --std=c++11 --template=gcc -D__cplusplus -DCLIENT_VERSION_BUILD -DCLIENT_VERSION_IS_RELEASE -DCLIENT_VERSION_MAJOR -DCLIENT_VERSION_MINOR -DCLIENT_VERSION_REVISION -DCOPYRIGHT_YEAR -DDEBUG -DHAVE_WORKING_BOOST_SLEEP_FOR -I src/ -q 2>&1 | sort -u | \
grep -E "${ENABLED_CHECKS_REGEXP}" | \
grep -vE "${IGNORED_WARNINGS_REGEXP}")
if [[ ${WARNINGS} != "" ]]; then
echo "${WARNINGS}"
echo
echo "Advice not applicable in this specific case? Add an exception by updating"
echo "IGNORED_WARNINGS in $0"
# Uncomment to enforce the developer note policy "By default, declare single-argument constructors `explicit`"
# exit 1
fi
exit 0