diff --git a/contrib/debian/dash-qt.desktop b/contrib/debian/dash-qt.desktop index 0dfebe0540be..299551648dae 100644 --- a/contrib/debian/dash-qt.desktop +++ b/contrib/debian/dash-qt.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Encoding=UTF-8 +Version=1.0 Name=Dash Core Comment=Dash P2P Cryptocurrency Comment[de]=Verbinde mit dem Dash peer-to-peer Netzwerk @@ -11,3 +11,4 @@ Type=Application Icon=dash128 MimeType=x-scheme-handler/dash; Categories=Office;Finance; +StartupWMClass=Dash-qt diff --git a/contrib/devtools/gen-manpages.sh b/contrib/devtools/gen-manpages.sh index 6682eada071b..95e23d4ecc6b 100755 --- a/contrib/devtools/gen-manpages.sh +++ b/contrib/devtools/gen-manpages.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)} SRCDIR=${SRCDIR:-$TOPDIR/src} diff --git a/contrib/macdeploy/detached-sig-create.sh b/contrib/macdeploy/detached-sig-create.sh index 93b8de8e84fa..ae72b10312f5 100755 --- a/contrib/macdeploy/detached-sig-create.sh +++ b/contrib/macdeploy/detached-sig-create.sh @@ -40,7 +40,7 @@ grep CodeResources < "${TEMPLIST}" | while read i; do RESOURCE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}" DIRNAME="`dirname "${RESOURCE}"`" mkdir -p "${DIRNAME}" - echo "Adding resource for: "${TARGETFILE}"" + echo "Adding resource for: \"${TARGETFILE}\"" cp "${i}" "${RESOURCE}" done diff --git a/contrib/tidy_datadir.sh b/contrib/tidy_datadir.sh index 101c9687a821..05acd7422bce 100755 --- a/contrib/tidy_datadir.sh +++ b/contrib/tidy_datadir.sh @@ -4,7 +4,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. if [ -d "$1" ]; then - cd "$1" + cd "$1" || exit 1 else echo "Usage: $0 " >&2 echo "Removes obsolete Dash database files" >&2 diff --git a/contrib/verify-commits/verify-commits.sh b/contrib/verify-commits/verify-commits.sh index 7194b040eb61..78320a4ce3c0 100755 --- a/contrib/verify-commits/verify-commits.sh +++ b/contrib/verify-commits/verify-commits.sh @@ -12,8 +12,6 @@ VERIFIED_ROOT=$(cat "${DIR}/trusted-git-root") VERIFIED_SHA512_ROOT=$(cat "${DIR}/trusted-sha512-root-commit") REVSIG_ALLOWED=$(cat "${DIR}/allow-revsig-commits") -HAVE_FAILED=false - HAVE_GNU_SHA512=1 [ ! -x "$(which sha512sum)" ] && HAVE_GNU_SHA512=0 @@ -35,10 +33,11 @@ fi NO_SHA1=1 PREV_COMMIT="" +INITIAL_COMMIT="${CURRENT_COMMIT}" while true; do if [ "$CURRENT_COMMIT" = $VERIFIED_ROOT ]; then - echo "There is a valid path from "$CURRENT_COMMIT" to $VERIFIED_ROOT where all commits are signed!" + echo "There is a valid path from \"$INITIAL_COMMIT\" to $VERIFIED_ROOT where all commits are signed!" exit 0 fi diff --git a/contrib/verifybinaries/verify.sh b/contrib/verifybinaries/verify.sh index 409f517c9fb2..e0266bf08afb 100755 --- a/contrib/verifybinaries/verify.sh +++ b/contrib/verifybinaries/verify.sh @@ -33,7 +33,7 @@ if [ ! -d "$WORKINGDIR" ]; then mkdir "$WORKINGDIR" fi -cd "$WORKINGDIR" +cd "$WORKINGDIR" || exit 1 #test if a version number has been passed as an argument if [ -n "$1" ]; then @@ -76,8 +76,6 @@ if [ -n "$1" ]; then BASEDIR="$BASEDIR$RCSUBDIR.$RCVERSION/" fi fi - - SIGNATUREFILE="$BASEDIR$SIGNATUREFILENAME" else echo "Error: need to specify a version on the command line" exit 2 @@ -89,7 +87,7 @@ WGETOUT=$(wget -N "$HOST1$BASEDIR$SIGNATUREFILENAME" 2>&1) #and then see if wget completed successfully if [ $? -ne 0 ]; then echo "Error: couldn't fetch signature file. Have you specified the version number in the following format?" - echo "[$VERSIONPREFIX]-[$RCVERSIONSTRING[0-9]] (example: "$VERSIONPREFIX"0.10.4-"$RCVERSIONSTRING"1)" + echo "[$VERSIONPREFIX]-[$RCVERSIONSTRING[0-9]] (example: ${VERSIONPREFIX}0.10.4-${RCVERSIONSTRING}1)" echo "wget output:" echo "$WGETOUT"|sed 's/^/\t/g' exit 2 diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk index 74bf4e9e115a..3f97221e10ee 100644 --- a/depends/packages/zeromq.mk +++ b/depends/packages/zeromq.mk @@ -29,5 +29,6 @@ define $(package)_stage_cmds endef define $(package)_postprocess_cmds + sed -i.old "s/ -lstdc++//" lib/pkgconfig/libzmq.pc && \ rm -rf bin share endef diff --git a/share/genbuild.sh b/share/genbuild.sh index 32ef2a5755aa..419e0da0fd7a 100755 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -4,7 +4,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. if [ $# -gt 1 ]; then - cd "$2" + cd "$2" || exit 1 fi if [ $# -gt 0 ]; then FILE="$1" diff --git a/src/addrdb.cpp b/src/addrdb.cpp index 5a66ccc2e6e8..cbb5a06d6b4b 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/src/addrman.cpp b/src/addrman.cpp index 35ed603952a5..2032bd6eb7ca 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -407,9 +407,9 @@ int CAddrMan::Check_() if (vRandom.size() != (size_t)(nTried + nNew)) return -7; - for (std::map::iterator it = mapInfo.begin(); it != mapInfo.end(); it++) { - int n = (*it).first; - CAddrInfo& info = (*it).second; + for (const auto& entry : mapInfo) { + int n = entry.first; + const CAddrInfo& info = entry.second; if (info.fInTried) { if (!info.nLastSuccess) return -1; diff --git a/src/addrman.h b/src/addrman.h index df6c4129a5d2..700bcf621cdd 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -319,9 +319,9 @@ class CAddrMan s << nUBuckets; std::map mapUnkIds; int nIds = 0; - for (std::map::const_iterator it = mapInfo.begin(); it != mapInfo.end(); it++) { - mapUnkIds[(*it).first] = nIds; - const CAddrInfo &info = (*it).second; + for (const auto& entry : mapInfo) { + mapUnkIds[entry.first] = nIds; + const CAddrInfo &info = entry.second; if (info.nRefCount) { assert(nIds != nNew); // this means nNew was wrong, oh ow s << info; @@ -329,8 +329,8 @@ class CAddrMan } } nIds = 0; - for (std::map::const_iterator it = mapInfo.begin(); it != mapInfo.end(); it++) { - const CAddrInfo &info = (*it).second; + for (const auto& entry : mapInfo) { + const CAddrInfo &info = entry.second; if (info.fInTried) { assert(nIds != nTried); // this means nTried was wrong, oh ow s << info; diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index e8247b31200b..192592560763 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include diff --git a/src/clientversion.cpp b/src/clientversion.cpp index d32d9b00da4b..085833cfe3b9 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -6,7 +6,6 @@ #include -#include /** * Name of client reported in the 'version' message. Report the same name diff --git a/src/coins.cpp b/src/coins.cpp index 01e52c233117..529ffd108481 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -5,11 +5,8 @@ #include #include -#include #include -#include - bool CCoinsView::GetCoin(const COutPoint &outpoint, Coin &coin) const { return false; } uint256 CCoinsView::GetBestBlock() const { return uint256(); } std::vector CCoinsView::GetHeadBlocks() const { return std::vector(); } diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index b68712547f4f..91ca568eeada 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -4,8 +4,6 @@ #include -#include -#include #include #include diff --git a/src/init.cpp b/src/init.cpp index 0094cfdd8823..7b299aff4a0f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1484,23 +1484,10 @@ bool AppInitParameterInteraction() static bool LockDataDirectory(bool probeOnly) { - std::string strDataDir = GetDataDir().string(); - // Make sure only a single Dash Core process is using the data directory. - fs::path pathLockFile = GetDataDir() / ".lock"; - FILE* file = fsbridge::fopen(pathLockFile, "a"); // empty lock file; created if it doesn't exist. - if (file) fclose(file); - - try { - static boost::interprocess::file_lock lock(pathLockFile.string().c_str()); - if (!lock.try_lock()) { - return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), strDataDir, _(PACKAGE_NAME))); - } - if (probeOnly) { - lock.unlock(); - } - } catch(const boost::interprocess::interprocess_exception& e) { - return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running.") + " %s.", strDataDir, _(PACKAGE_NAME), e.what())); + fs::path datadir = GetDataDir(); + if (!LockDirectory(datadir, ".lock", probeOnly)) { + return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), datadir.string(), _(PACKAGE_NAME))); } return true; } diff --git a/src/key.cpp b/src/key.cpp index 12f9af5722ec..ef481fcea2ce 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include diff --git a/src/keystore.cpp b/src/keystore.cpp index 426aa0173e40..d2a10c8d988c 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -5,8 +5,6 @@ #include -#include -#include #include bool CKeyStore::AddKey(const CKey &key) { @@ -79,6 +77,16 @@ bool CBasicKeyStore::HaveCScript(const CScriptID& hash) const return mapScripts.count(hash) > 0; } +std::set CBasicKeyStore::GetCScripts() const +{ + LOCK(cs_KeyStore); + std::set set_script; + for (const auto& mi : mapScripts) { + set_script.insert(mi.first); + } + return set_script; +} + bool CBasicKeyStore::GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const { LOCK(cs_KeyStore); diff --git a/src/keystore.h b/src/keystore.h index d1b65f134d26..610e3ba08444 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -37,6 +37,7 @@ class CKeyStore //! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki virtual bool AddCScript(const CScript& redeemScript) =0; virtual bool HaveCScript(const CScriptID &hash) const =0; + virtual std::set GetCScripts() const =0; virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0; //! Support for Watch-only addresses @@ -70,6 +71,7 @@ class CBasicKeyStore : public CKeyStore bool GetKey(const CKeyID &address, CKey &keyOut) const override; bool AddCScript(const CScript& redeemScript) override; bool HaveCScript(const CScriptID &hash) const override; + std::set GetCScripts() const override; bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const override; bool AddWatchOnly(const CScript &dest) override; diff --git a/src/miner.cpp b/src/miner.cpp index b05e3a670112..af80081224d5 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -23,7 +23,6 @@ #include #include