diff --git a/configure.ac b/configure.ac index 971e824549..64ad1b2489 100644 --- a/configure.ac +++ b/configure.ac @@ -644,7 +644,7 @@ case $host in AC_MSG_ERROR("windres not found") fi - CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB" + CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -D_WIN32_WINNT=0x0601" if test "x$CXXFLAGS_overridden" = "xno"; then CXXFLAGS="$CXXFLAGS -w" fi diff --git a/contrib/devtools/gen-manpages.sh b/contrib/devtools/gen-manpages.sh index cc2b956dad..0f6afd6153 100755 --- a/contrib/devtools/gen-manpages.sh +++ b/contrib/devtools/gen-manpages.sh @@ -10,6 +10,7 @@ MANDIR=${MANDIR:-$TOPDIR/doc/man} BITCOIND=${BITCOIND:-$BINDIR/dashd} BITCOINCLI=${BITCOINCLI:-$BINDIR/dash-cli} BITCOINTX=${BITCOINTX:-$BINDIR/dash-tx} +WALLET_TOOL=${WALLET_TOOL:-$BINDIR/dash-wallet} BITCOINQT=${BITCOINQT:-$BINDIR/qt/dash-qt} [ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1 @@ -23,7 +24,7 @@ read -r -a BTCVER <<< "$($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ prin echo "[COPYRIGHT]" > footer.h2m $BITCOIND --version | sed -n '1!p' >> footer.h2m -for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $BITCOINQT; do +for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINQT; do cmdname="${cmd##*/}" help2man -N --version-string=${BTCVER[0]} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd} sed -i "s/\\\-${BTCVER[1]}//g" ${MANDIR}/${cmdname}.1 diff --git a/doc/man/dash-tx.1 b/doc/man/dash-tx.1 index ee37f4a043..509918f271 100644 --- a/doc/man/dash-tx.1 +++ b/doc/man/dash-tx.1 @@ -89,7 +89,7 @@ sign=SIGHASH\-FLAGS .IP Add zero or more signatures to transaction. This command requires JSON registers:prevtxs=JSON object, privatekeys=JSON object. See -signrawtransaction docs for format of sighash flags, JSON +signrawtransactionwithkey docs for format of sighash flags, JSON objects. .PP Register Commands: diff --git a/doc/man/dash-wallet.1 b/doc/man/dash-wallet.1 new file mode 100644 index 0000000000..40c8163b1d --- /dev/null +++ b/doc/man/dash-wallet.1 @@ -0,0 +1,68 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH DASH-WALLET "1" "February 2019" "dash-wallet v0.17.99.0" "User Commands" +.SH NAME +dash-wallet \- manual page for dash-wallet v0.17.99.0 +.SH DESCRIPTION +DASH Core dash\-wallet version v0.17.99.0 +.PP +wallet\-tool is an offline tool for creating and interacting with Dash Core wallet files. +By default wallet\-tool will act on wallets in the default mainnet wallet directory in the datadir. +To change the target wallet, use the \fB\-datadir\fR, \fB\-wallet\fR and \fB\-testnet\fR/\-regtest arguments. +.SS "Usage:" +.IP +dash\-wallet [options] +.SH OPTIONS +.HP +\-? +.IP +This help message +.HP +\fB\-datadir=\fR +.IP +Specify data directory +.HP +\fB\-wallet=\fR +.IP +Specify wallet name +.PP +Debugging/Testing options: +.HP +\fB\-debug=\fR +.IP +Output debugging information (default: 0). +.HP +\fB\-printtoconsole\fR +.IP +Send trace/debug info to console (default: 1 when no \fB\-debug\fR is true, 0 +otherwise. +.PP +Chain selection options: +.HP +\fB\-testnet\fR +.IP +Use the test chain +.PP +Commands: +.IP +create +.IP +Create new wallet file +.IP +info +.IP +Get wallet info +.SH COPYRIGHT +Copyright (C) 2014-2021 The Dash Core developers +Copyright (C) 2009-2019 The Bitcoin Core developers + +Please contribute if you find Bitcoin Core useful. Visit + for further information about the software. +The source code is available from . + +This is experimental software. +Distributed under the MIT software license, see the accompanying file COPYING +or + +This product includes software developed by the OpenSSL Project for use in the +OpenSSL Toolkit and cryptographic software written by +Eric Young and UPnP software written by Thomas Bernard. diff --git a/doc/man/dashd.1 b/doc/man/dashd.1 index 945359a132..560e092542 100644 --- a/doc/man/dashd.1 +++ b/doc/man/dashd.1 @@ -57,7 +57,7 @@ Specify data directory .HP \fB\-dbcache=\fR .IP -Set database cache size in megabytes (4 to 16384, default: 300) +Set database cache size in MiB (4 to 16384, default: 300) .HP \fB\-debuglogfile=\fR .IP @@ -741,7 +741,7 @@ relaying, mining and transaction creation (default: 0.00001) \fB\-whitelistforcerelay\fR .IP Force relay of transactions from whitelisted peers even if they violate -local relay policy (default: 1) +local relay policy (default: 0) .HP \fB\-whitelistrelay\fR .IP diff --git a/src/compat.h b/src/compat.h index 813e0babb1..b22bed897d 100644 --- a/src/compat.h +++ b/src/compat.h @@ -11,10 +11,6 @@ #endif #ifdef WIN32 -#ifdef _WIN32_WINNT -#undef _WIN32_WINNT -#endif -#define _WIN32_WINNT 0x0501 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif diff --git a/src/init.cpp b/src/init.cpp index 43e8c26376..29c32895b6 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1231,16 +1231,7 @@ bool AppInitBasicSetup() #endif #ifdef WIN32 // Enable Data Execution Prevention (DEP) - // Minimum supported OS versions: WinXP SP3, WinVista >= SP1, Win Server 2008 - // A failure is non-critical and needs no further attention! -#ifndef PROCESS_DEP_ENABLE - // We define this here, because GCCs winbase.h limits this to _WIN32_WINNT >= 0x0601 (Windows 7), - // which is not correct. Can be removed, when GCCs winbase.h is fixed! -#define PROCESS_DEP_ENABLE 0x00000001 -#endif - typedef BOOL (WINAPI *PSETPROCDEPPOL)(DWORD); - PSETPROCDEPPOL setProcDEPPol = (PSETPROCDEPPOL)GetProcAddress(GetModuleHandleA("Kernel32.dll"), "SetProcessDEPPolicy"); - if (setProcDEPPol != nullptr) setProcDEPPol(PROCESS_DEP_ENABLE); + SetProcessDEPPolicy(PROCESS_DEP_ENABLE); #endif if (!SetupNetworking()) diff --git a/src/miner.cpp b/src/miner.cpp index 09a3a8b729..04b97b942b 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -10,16 +10,16 @@ #include #include #include -#include #include +#include #include #include #include #include #include #include -#include #include +#include #include #include @@ -33,14 +33,6 @@ #include #include -// Unconfirmed transactions in the memory pool often depend on other -// transactions in the memory pool. When we select transactions from the -// pool, we select by highest fee rate of a transaction combined with all -// its ancestors. - -uint64_t nLastBlockTx = 0; -uint64_t nLastBlockSize = 0; - int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev) { int64_t nOldTime = pblock->nTime; @@ -100,6 +92,9 @@ void BlockAssembler::resetBlock() nFees = 0; } +Optional BlockAssembler::m_last_block_num_txs{nullopt}; +Optional BlockAssembler::m_last_block_size{nullopt}; + std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn) { int64_t nTimeStart = GetTimeMicros(); @@ -160,8 +155,8 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc int64_t nTime1 = GetTimeMicros(); - nLastBlockTx = nBlockTx; - nLastBlockSize = nBlockSize; + m_last_block_num_txs = nBlockTx; + m_last_block_size = nBlockSize; LogPrintf("CreateNewBlock(): total size %u txs: %u fees: %ld sigops %d\n", nBlockSize, nBlockTx, nFees, nBlockSigOps); // Create coinbase transaction. diff --git a/src/miner.h b/src/miner.h index 942063f66d..7d6a674443 100644 --- a/src/miner.h +++ b/src/miner.h @@ -1,17 +1,19 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2015 The Bitcoin Core developers +// Copyright (c) 2009-2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_MINER_H #define BITCOIN_MINER_H +#include #include #include #include -#include #include +#include + #include #include @@ -159,6 +161,9 @@ public: /** Construct a new block template with coinbase to scriptPubKeyIn */ std::unique_ptr CreateNewBlock(const CScript& scriptPubKeyIn); + static Optional m_last_block_num_txs; + static Optional m_last_block_size; + private: // utility functions /** Clear the block's state and prepare for assembling a new block */ diff --git a/src/net.cpp b/src/net.cpp index 59f21346b5..6ddf6ce1f3 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -71,17 +71,6 @@ static constexpr int DNSSEEDS_TO_QUERY_AT_ONCE = 3; #define MSG_DONTWAIT 0 #endif -// Fix for ancient MinGW versions, that don't have defined these in ws2tcpip.h. -// Todo: Can be removed when our pull-tester is upgraded to a modern MinGW version. -#ifdef WIN32 -#ifndef PROTECTION_LEVEL_UNRESTRICTED -#define PROTECTION_LEVEL_UNRESTRICTED 10 -#endif -#ifndef IPV6_PROTECTION_LEVEL -#define IPV6_PROTECTION_LEVEL 23 -#endif -#endif - /** Used to pass flags to the Bind() function */ enum BindFlags { BF_NONE = 0, diff --git a/src/netbase.cpp b/src/netbase.cpp index 3a040251fd..e73d47955d 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -86,9 +86,6 @@ bool static LookupIntern(const char *pszName, std::vector& vIP, unsign aiHint.ai_protocol = IPPROTO_TCP; // We don't care which address family (IPv4 or IPv6) is returned aiHint.ai_family = AF_UNSPEC; -#ifdef WIN32 - aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST; -#else // If we allow lookups of hostnames, use the AI_ADDRCONFIG flag to only // return addresses whose family we have an address configured for. // @@ -96,7 +93,6 @@ bool static LookupIntern(const char *pszName, std::vector& vIP, unsign // getaddrinfo to only decode numerical network addresses and suppress // hostname lookups. aiHint.ai_flags = fAllowLookup ? AI_ADDRCONFIG : AI_NUMERICHOST; -#endif struct addrinfo *aiRes = nullptr; int nErr = getaddrinfo(pszName, nullptr, &aiHint, &aiRes); if (nErr) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index afcb58f37f..6e6916b7b0 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -26,10 +26,6 @@ #include #ifdef WIN32 -#ifdef _WIN32_WINNT -#undef _WIN32_WINNT -#endif -#define _WIN32_WINNT 0x0501 #ifdef _WIN32_IE #undef _WIN32_IE #endif diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 03f52c7ea5..0918a53db4 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -199,36 +199,36 @@ static UniValue generatetoaddress(const JSONRPCRequest& request) static UniValue getmininginfo(const JSONRPCRequest& request) { - if (request.fHelp || request.params.size() != 0) + if (request.fHelp || request.params.size() != 0) { throw std::runtime_error( RPCHelpMan{"getmininginfo", "\nReturns a json object containing mining-related information.", {}, RPCResult{ - "{\n" - " \"blocks\": nnn, (numeric) The current block\n" - " \"currentblocksize\": nnn, (numeric) The last block size\n" - " \"currentblocktx\": nnn, (numeric) The last block transaction\n" - " \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" - " \"networkhashps\": nnn, (numeric) The network hashes per second\n" - " \"pooledtx\": n (numeric) The size of the mempool\n" - " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n" - " \"warnings\": \"...\" (string) any network and blockchain warnings\n" - "}\n" + "{\n" + " \"blocks\": nnn, (numeric) The current block\n" + " \"currentblocksize\": nnn, (numeric, optional) The block size of the last assembled block (only present if a block was ever assembled)\n" + " \"currentblocktx\": nnn, (numeric, optional) The number of block transactions of the last assembled block (only present if a block was ever assembled)\n" + " \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" + " \"networkhashps\": nnn, (numeric) The network hashes per second\n" + " \"pooledtx\": n (numeric) The size of the mempool\n" + " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n" + " \"warnings\": \"...\" (string) any network and blockchain warnings\n" + "}\n" }, RPCExamples{ HelpExampleCli("getmininginfo", "") + HelpExampleRpc("getmininginfo", "") }, }.ToString()); - + } LOCK(cs_main); UniValue obj(UniValue::VOBJ); obj.pushKV("blocks", (int)::ChainActive().Height()); - obj.pushKV("currentblocksize", (uint64_t)nLastBlockSize); - obj.pushKV("currentblocktx", (uint64_t)nLastBlockTx); + if (BlockAssembler::m_last_block_size) obj.pushKV("currentblocksize", *BlockAssembler::m_last_block_size); + if (BlockAssembler::m_last_block_num_txs) obj.pushKV("currentblocktx", *BlockAssembler::m_last_block_num_txs); obj.pushKV("difficulty", (double)GetDifficulty(::ChainActive().Tip())); obj.pushKV("networkhashps", getnetworkhashps(request)); obj.pushKV("pooledtx", (uint64_t)mempool.size()); diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 6c8fcd324b..09860cf7c4 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -113,13 +113,17 @@ static UniValue getrawtransaction(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) throw std::runtime_error( - RPCHelpMan{"getrawtransaction", + RPCHelpMan{ + "getrawtransaction", + "\nReturn the raw transaction data.\n" + "\nBy default this function only works for mempool transactions. When called with a blockhash\n" "argument, getrawtransaction will return the transaction if the specified block is available and\n" "the transaction is found in that block. When called without a blockhash argument, getrawtransaction\n" "will return the transaction if it is in the mempool, or if -txindex is enabled and the transaction\n" "is in a block in the blockchain.\n" - "\nReturn the raw transaction data.\n" + "\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n" + "Or use gettransaction for wallet transactions.\n" "\nIf verbose is 'true', returns an Object with information about 'txid'.\n" "If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n", { diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp index b1fed6c9b2..57f5327715 100644 --- a/src/support/lockedpool.cpp +++ b/src/support/lockedpool.cpp @@ -10,10 +10,6 @@ #endif #ifdef WIN32 -#ifdef _WIN32_WINNT -#undef _WIN32_WINNT -#endif -#define _WIN32_WINNT 0x0501 #define WIN32_LEAN_AND_MEAN 1 #ifndef NOMINMAX #define NOMINMAX diff --git a/src/util/system.cpp b/src/util/system.cpp index 53ca09d26c..6c3beea0fd 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -46,11 +46,6 @@ #pragma warning(disable:4717) #endif -#ifdef _WIN32_WINNT -#undef _WIN32_WINNT -#endif -#define _WIN32_WINNT 0x0501 - #ifdef _WIN32_IE #undef _WIN32_IE #endif diff --git a/src/validation.h b/src/validation.h index f9ff6bcbff..87dd9ab0cb 100644 --- a/src/validation.h +++ b/src/validation.h @@ -15,8 +15,8 @@ #include #include // for ReadLE64 #include -#include // For CMessageHeader::MessageStartChars #include +#include // For CMessageHeader::MessageStartChars #include