mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge pull request #5499 from vijaydasmp/bp22_4
backport: Merge bitcoin #20530,20221,20556,19832
This commit is contained in:
commit
59e85b8bd7
@ -21,11 +21,7 @@
|
||||
#undef FD_SETSIZE // prevent redefinition compiler warning
|
||||
#endif
|
||||
#define FD_SETSIZE 1024 // max number of fds in fd_set
|
||||
|
||||
#include <winsock2.h> // Must be included before mswsock.h and windows.h
|
||||
|
||||
#include <mswsock.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <stdint.h>
|
||||
#else
|
||||
|
@ -29,13 +29,6 @@
|
||||
|
||||
#include <support/events.h>
|
||||
|
||||
#ifdef EVENT__HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#ifdef _XOPEN_SOURCE_EXTENDED
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
|
||||
|
@ -40,11 +40,6 @@
|
||||
#include <optional>
|
||||
#include <queue>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#define USE_WAKEUP_PIPE
|
||||
#endif
|
||||
|
@ -4387,7 +4387,7 @@ bool PeerManagerImpl::MaybeDiscourageAndDisconnect(CNode& pnode)
|
||||
}
|
||||
|
||||
// Disconnect and discourage all nodes sharing the address
|
||||
LogPrintf("Disconnecting and discouraging peer %d!\n", peer_id);
|
||||
LogPrint(BCLog::NET, "Disconnecting and discouraging peer %d!\n", peer_id);
|
||||
if (m_banman) {
|
||||
m_banman->Discourage(pnode.addr);
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public:
|
||||
MasternodeSyncImpl m_masternodeSync;
|
||||
CoinJoinOptionsImpl m_coinjoin;
|
||||
|
||||
NodeImpl(NodeContext* context) { setContext(context); }
|
||||
explicit NodeImpl(NodeContext* context) { setContext(context); }
|
||||
void initError(const bilingual_str& message) override { InitError(message); }
|
||||
bool parseParameters(int argc, const char* const argv[], std::string& error) override
|
||||
{
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#define SEND_CONFIRM_DELAY 3
|
||||
|
||||
static const std::array<int, 9> confTargets = { {2, 4, 6, 12, 24, 48, 144, 504, 1008} };
|
||||
static constexpr std::array confTargets{2, 4, 6, 12, 24, 48, 144, 504, 1008};
|
||||
int getConfTargetForIndex(int index) {
|
||||
if (index+1 > static_cast<int>(confTargets.size())) {
|
||||
return confTargets.back();
|
||||
|
@ -15,7 +15,7 @@ class Node;
|
||||
class AddressBookTests : public QObject
|
||||
{
|
||||
public:
|
||||
AddressBookTests(interfaces::Node& node) : m_node(node) {}
|
||||
explicit AddressBookTests(interfaces::Node& node) : m_node(node) {}
|
||||
interfaces::Node& m_node;
|
||||
|
||||
Q_OBJECT
|
||||
|
@ -15,7 +15,7 @@ class Node;
|
||||
class RPCNestedTests : public QObject
|
||||
{
|
||||
public:
|
||||
RPCNestedTests(interfaces::Node& node) : m_node(node) {}
|
||||
explicit RPCNestedTests(interfaces::Node& node) : m_node(node) {}
|
||||
interfaces::Node& m_node;
|
||||
|
||||
Q_OBJECT
|
||||
|
@ -15,7 +15,7 @@ class Node;
|
||||
class WalletTests : public QObject
|
||||
{
|
||||
public:
|
||||
WalletTests(interfaces::Node& node) : m_node(node) {}
|
||||
explicit WalletTests(interfaces::Node& node) : m_node(node) {}
|
||||
interfaces::Node& m_node;
|
||||
|
||||
Q_OBJECT
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
std::string peerAddr;
|
||||
const CoreContext& context;
|
||||
|
||||
JSONRPCRequest(const CoreContext& context) : id(NullUniValue), params(NullUniValue), fHelp(false), context(context) {}
|
||||
explicit JSONRPCRequest(const CoreContext& context) : id(NullUniValue), params(NullUniValue), fHelp(false), context(context) {}
|
||||
|
||||
//! Initializes request information from another request object and the
|
||||
//! given context. The implementation should be updated if any members are
|
||||
|
@ -157,7 +157,7 @@ protected:
|
||||
uint32_t m_expr_index;
|
||||
|
||||
public:
|
||||
PubkeyProvider(uint32_t exp_index) : m_expr_index(exp_index) {}
|
||||
explicit PubkeyProvider(uint32_t exp_index) : m_expr_index(exp_index) {}
|
||||
|
||||
virtual ~PubkeyProvider() = default;
|
||||
|
||||
|
@ -23,7 +23,7 @@ class FuzzedSignatureChecker : public BaseSignatureChecker
|
||||
FuzzedDataProvider& m_fuzzed_data_provider;
|
||||
|
||||
public:
|
||||
FuzzedSignatureChecker(FuzzedDataProvider& fuzzed_data_provider) : m_fuzzed_data_provider(fuzzed_data_provider)
|
||||
explicit FuzzedSignatureChecker(FuzzedDataProvider& fuzzed_data_provider) : m_fuzzed_data_provider(fuzzed_data_provider)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class DebugLogHelper
|
||||
void check_found();
|
||||
|
||||
public:
|
||||
DebugLogHelper(std::string message, MatchFn match = [](const std::string*){ return true; });
|
||||
explicit DebugLogHelper(std::string message, MatchFn match = [](const std::string*){ return true; });
|
||||
~DebugLogHelper() { check_found(); }
|
||||
};
|
||||
|
||||
|
@ -239,7 +239,7 @@ public:
|
||||
std::optional<std::vector<std::string>> list_value;
|
||||
const char* error = nullptr;
|
||||
|
||||
Expect(util::SettingsValue s) : setting(std::move(s)) {}
|
||||
explicit Expect(util::SettingsValue s) : setting(std::move(s)) {}
|
||||
Expect& DefaultString() { default_string = true; return *this; }
|
||||
Expect& DefaultInt() { default_int = true; return *this; }
|
||||
Expect& DefaultBool() { default_bool = true; return *this; }
|
||||
|
@ -514,7 +514,7 @@ class FormatArg
|
||||
{ }
|
||||
|
||||
template<typename T>
|
||||
FormatArg(const T& value)
|
||||
explicit FormatArg(const T& value)
|
||||
: m_value(static_cast<const void*>(&value)),
|
||||
m_formatImpl(&formatImpl<T>),
|
||||
m_toIntImpl(&toIntImpl<T>)
|
||||
@ -970,7 +970,7 @@ class FormatListN : public FormatList
|
||||
public:
|
||||
#ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES
|
||||
template<typename... Args>
|
||||
FormatListN(const Args&... args)
|
||||
explicit FormatListN(const Args&... args)
|
||||
: FormatList(&m_formatterStore[0], N),
|
||||
m_formatterStore { FormatArg(args)... }
|
||||
{ static_assert(sizeof...(args) == N, "Number of args must be N"); }
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <chainparamsbase.h>
|
||||
#include <compat.h>
|
||||
#include <crypto/hmac_sha256.h>
|
||||
#include <net.h>
|
||||
#include <netaddress.h>
|
||||
|
@ -840,7 +840,7 @@ public:
|
||||
class EpochGuard {
|
||||
const CTxMemPool& pool;
|
||||
public:
|
||||
EpochGuard(const CTxMemPool& in);
|
||||
explicit EpochGuard(const CTxMemPool& in);
|
||||
~EpochGuard();
|
||||
};
|
||||
// N.B. GetFreshEpoch modifies mutable state via the EpochGuard construction
|
||||
|
@ -13,7 +13,7 @@ protected:
|
||||
|
||||
public:
|
||||
BaseHash() : m_hash() {}
|
||||
BaseHash(const HashType& in) : m_hash(in) {}
|
||||
explicit BaseHash(const HashType& in) : m_hash(in) {}
|
||||
|
||||
unsigned char* begin()
|
||||
{
|
||||
|
@ -566,7 +566,7 @@ private:
|
||||
// All the intermediate state that gets passed between the various levels
|
||||
// of checking a given transaction.
|
||||
struct Workspace {
|
||||
Workspace(const CTransactionRef& ptx) : m_ptx(ptx), m_hash(ptx->GetHash()) {}
|
||||
explicit Workspace(const CTransactionRef& ptx) : m_ptx(ptx), m_hash(ptx->GetHash()) {}
|
||||
CTxMemPool::setEntries m_ancestors;
|
||||
std::unique_ptr<CTxMemPoolEntry> m_entry;
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
std::unordered_map<std::string, WalletDatabaseFileId> m_fileids;
|
||||
std::condition_variable_any m_db_in_use;
|
||||
|
||||
BerkeleyEnvironment(const fs::path& env_directory);
|
||||
explicit BerkeleyEnvironment(const fs::path& env_directory);
|
||||
BerkeleyEnvironment();
|
||||
~BerkeleyEnvironment();
|
||||
void Reset();
|
||||
|
@ -148,7 +148,7 @@ protected:
|
||||
WalletStorage& m_storage;
|
||||
|
||||
public:
|
||||
ScriptPubKeyMan(WalletStorage& storage) : m_storage(storage) {}
|
||||
explicit ScriptPubKeyMan(WalletStorage& storage) : m_storage(storage) {}
|
||||
|
||||
virtual ~ScriptPubKeyMan() {};
|
||||
virtual bool GetNewDestination(CTxDestination& dest, std::string& error) { return false; }
|
||||
@ -486,7 +486,7 @@ class LegacySigningProvider : public SigningProvider
|
||||
private:
|
||||
const LegacyScriptPubKeyMan& m_spk_man;
|
||||
public:
|
||||
LegacySigningProvider(const LegacyScriptPubKeyMan& spk_man) : m_spk_man(spk_man) {}
|
||||
explicit LegacySigningProvider(const LegacyScriptPubKeyMan& spk_man) : m_spk_man(spk_man) {}
|
||||
|
||||
bool GetCScript(const CScriptID &scriptid, CScript& script) const override { return m_spk_man.GetCScript(scriptid, script); }
|
||||
bool HaveCScript(const CScriptID &scriptid) const override { return m_spk_man.HaveCScript(scriptid); }
|
||||
|
@ -30,6 +30,7 @@ IGNORED_WARNINGS=(
|
||||
"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:.* Struct 'UniValueType' 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."
|
||||
@ -42,6 +43,11 @@ IGNORED_WARNINGS=(
|
||||
"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/span.h:.* Class 'Span < const CRPCCommand >' has a constructor with 1 argument that is not explicit."
|
||||
"src/span.h:.* Class 'Span < const char >' has a constructor with 1 argument that is not explicit."
|
||||
"src/span.h:.* Class 'Span < const std :: vector <unsigned char > >' has a constructor with 1 argument that is not explicit."
|
||||
"src/span.h:.* Class 'Span < const uint8_t >' has a constructor with 1 argument that is not explicit."
|
||||
"src/span.h:.* Class 'Span' 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."
|
||||
@ -49,6 +55,9 @@ IGNORED_WARNINGS=(
|
||||
"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/test/fuzz/util.h:.* Class 'FuzzedFileProvider' has a constructor with 1 argument that is not explicit."
|
||||
"src/test/fuzz/util.h:.* Class 'FuzzedAutoFileProvider' has a constructor with 1 argument that is not explicit."
|
||||
"src/util/ref.h:.* Class 'Ref' 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."
|
||||
)
|
||||
|
||||
@ -66,7 +75,7 @@ function join_array {
|
||||
ENABLED_CHECKS_REGEXP=$(join_array "|" "${ENABLED_CHECKS[@]}")
|
||||
IGNORED_WARNINGS_REGEXP=$(join_array "|" "${IGNORED_WARNINGS[@]}")
|
||||
WARNINGS=$(git ls-files -- "*.cpp" "*.h" ":(exclude)src/dashbls/" ":(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 -DCOPYRIGHT_YEAR -DDEBUG -I src/ -q 2>&1 | sort -u | \
|
||||
xargs cppcheck --enable=all -j "$(getconf _NPROCESSORS_ONLN)" --language=c++ --std=c++17 --template=gcc -D__cplusplus -DCLIENT_VERSION_BUILD -DCLIENT_VERSION_IS_RELEASE -DCLIENT_VERSION_MAJOR -DCLIENT_VERSION_MINOR -DCOPYRIGHT_YEAR -DDEBUG -I src/ -q 2>&1 | sort -u | \
|
||||
grep -E "${ENABLED_CHECKS_REGEXP}" | \
|
||||
grep -vE "${IGNORED_WARNINGS_REGEXP}")
|
||||
if [[ ${WARNINGS} != "" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user