Merge #13455: [0.16.2] Backports

9fd3e0001fc20eecbfa823e12f66da4054a072a7 depends: Update Qt download url (fanquake)
f7401c86b9c9c58cfe57c2a49d3b4e00f80ded4a Fix parameter count check for importpubkey. (Kristaps Kaupe)
cbd2f70b75016bbadeb212c823b5c1ece95d5241 expose CBlockIndex::nTx in getblock(header) (Gregory Sanders)
ce8aa5491f35c2cca03ba1877cd4c926b506a961 Add Windows shutdown handler (Chun Kuan Lee)
18b0c69e2fc9f9d5cd56659abab467c2c6826be2 Bugfix: Include <memory> for std::unique_ptr (Luke Dashjr)

Pull request description:

  Backports:
  * #12859 Bugfix: Include <memory> for std::unique_ptr
  * #13131 Add Windows shutdown handler
  * #13451 rpc: expose CBlockIndex::nTx in getblock(header)
  * #13507 RPC: Fix parameter count check for importpubkey
  * #13544 depends: Update Qt download url

  to the 0.16 branch.

Tree-SHA512: eeaec52d001d5c81e67dda3a2d3fee7a9445e569366e597b18e81d802c1b7f89e545afd53d094740c37c1714050304979398b9860144454d3a5cb5abc9e9eaca
This commit is contained in:
Wladimir J. van der Laan 2018-07-09 21:07:10 +02:00
commit dac5374cce
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
39 changed files with 71 additions and 2 deletions

View File

@ -1,6 +1,6 @@
PACKAGE=qt
$(package)_version=5.7.1
$(package)_download_path=http://download.qt.io/official_releases/qt/5.7/$($(package)_version)/submodules
$(package)_download_path=https://download.qt.io/archive/qt/5.7/$($(package)_version)/submodules
$(package)_suffix=opensource-src-$($(package)_version).tar.gz
$(package)_file_name=qtbase-$($(package)_suffix)
$(package)_sha256_hash=95f83e532d23b3ddbde7973f380ecae1bac13230340557276f75f2e37984e410

View File

@ -15,6 +15,7 @@
#include <util.h>
#include <utilstrencodings.h>
#include <memory>
#include <stdio.h>
#include <event2/buffer.h>

View File

@ -22,6 +22,7 @@
#include <utilmoneystr.h>
#include <utilstrencodings.h>
#include <memory>
#include <stdio.h>
#include <boost/algorithm/string.hpp>

View File

@ -11,6 +11,7 @@
#include <utilstrencodings.h>
#include <assert.h>
#include <memory>
#include <chainparamsseeds.h>

View File

@ -9,6 +9,7 @@
#include <util.h>
#include <assert.h>
#include <memory>
const std::string CBaseChainParams::MAIN = "main";
const std::string CBaseChainParams::TESTNET = "test";

View File

@ -4,6 +4,7 @@
#include <dbwrapper.h>
#include <memory>
#include <random.h>
#include <leveldb/cache.h>

View File

@ -17,6 +17,8 @@
#include <crypto/hmac_sha256.h>
#include <stdio.h>
#include <memory>
#include <boost/algorithm/string.hpp> // boost::trim
/** WWW-Authenticate to present with 401 Unauthorized response */

View File

@ -13,6 +13,7 @@
#include <sync.h>
#include <ui_interface.h>
#include <memory>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -283,6 +283,7 @@ void Shutdown()
* The execution context the handler is invoked in is not guaranteed,
* so we restrict handler operations to just touching variables:
*/
#ifndef WIN32
static void HandleSIGTERM(int)
{
fRequestShutdown = true;
@ -292,6 +293,14 @@ static void HandleSIGHUP(int)
{
fReopenDebugLog = true;
}
#else
static BOOL WINAPI consoleCtrlHandler(DWORD dwCtrlType)
{
fRequestShutdown = true;
Sleep(INFINITE);
return true;
}
#endif
#ifndef WIN32
static void registerSignalHandler(int signal, void(*handler)(int))
@ -880,6 +889,8 @@ bool AppInitBasicSetup()
// Ignore SIGPIPE, otherwise it will bring the daemon down if the client closes unexpectedly
signal(SIGPIPE, SIG_IGN);
#else
SetConsoleCtrlHandler(consoleCtrlHandler, true);
#endif
std::set_new_handler(new_handler_terminate);

View File

@ -10,6 +10,7 @@
#include <stdlib.h>
#include <map>
#include <memory>
#include <set>
#include <vector>
#include <unordered_map>

View File

@ -27,6 +27,7 @@
#include <validationinterface.h>
#include <algorithm>
#include <memory>
#include <queue>
#include <utility>

View File

@ -20,6 +20,7 @@
#include <ui_interface.h>
#include <utilstrencodings.h>
#include <memory>
#ifdef WIN32
#include <string.h>
#else

View File

@ -30,6 +30,8 @@
#include <utilmoneystr.h>
#include <utilstrencodings.h>
#include <memory>
#if defined(NDEBUG)
# error "Bitcoin cannot be compiled without assertions."
#endif

View File

@ -12,6 +12,7 @@
#include <sync.h>
#include <map>
#include <memory>
#include <string>
#include <vector>

View File

@ -7,6 +7,8 @@
#include <net.h>
#include <memory>
#include <QAbstractTableModel>
#include <QStringList>

View File

@ -36,6 +36,7 @@
#include <wallet/wallet.h>
#endif
#include <memory>
#include <stdint.h>
#include <boost/thread.hpp>

View File

@ -16,6 +16,7 @@
#include <wallet/wallet.h>
#include <cstdlib>
#include <memory>
#include <openssl/x509_vfy.h>

View File

@ -8,6 +8,8 @@
#include <net_processing.h> // For CNodeStateStats
#include <net.h>
#include <memory>
#include <QAbstractTableModel>
#include <QStringList>

View File

@ -18,6 +18,8 @@
#include <qt/recentrequeststablemodel.h>
#include <qt/receiverequestdialog.h>
#include <memory>
#include <QAbstractButton>
#include <QAction>
#include <QApplication>

View File

@ -7,6 +7,8 @@
#include <qt/walletmodel.h>
#include <memory>
#include <QObject>
class SendCoinsRecipient;

View File

@ -33,6 +33,7 @@
#include <boost/thread/thread.hpp> // boost::thread::interrupt
#include <memory>
#include <mutex>
#include <condition_variable>
@ -104,6 +105,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits)));
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
result.push_back(Pair("nTx", (uint64_t)blockindex->nTx));
if (blockindex->pprev)
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
@ -149,6 +151,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
result.push_back(Pair("bits", strprintf("%08x", block.nBits)));
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
result.push_back(Pair("nTx", (uint64_t)blockindex->nTx));
if (blockindex->pprev)
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
@ -678,6 +681,7 @@ UniValue getblockheader(const JSONRPCRequest& request)
" \"bits\" : \"1d00ffff\", (string) The bits\n"
" \"difficulty\" : x.xxx, (numeric) The difficulty\n"
" \"chainwork\" : \"0000...1f3\" (string) Expected number of hashes required to produce the current chain (in hex)\n"
" \"nTx\" : n, (numeric) The number of transactions in the block.\n"
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
" \"nextblockhash\" : \"hash\", (string) The hash of the next block\n"
"}\n"
@ -747,6 +751,7 @@ UniValue getblock(const JSONRPCRequest& request)
" \"bits\" : \"1d00ffff\", (string) The bits\n"
" \"difficulty\" : x.xxx, (numeric) The difficulty\n"
" \"chainwork\" : \"xxxx\", (string) Expected number of hashes required to produce the chain up to this block (in hex)\n"
" \"nTx\" : n, (numeric) The number of transactions in the block.\n"
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
" \"nextblockhash\" : \"hash\" (string) The hash of the next block\n"
"}\n"

View File

@ -27,6 +27,7 @@
#endif
#include <algorithm>
#include <memory>
LockedPoolManager* LockedPoolManager::_instance = nullptr;
std::once_flag LockedPoolManager::init_flag;

View File

@ -4,6 +4,7 @@
#include <sync.h>
#include <memory>
#include <set>
#include <util.h>
#include <utilstrencodings.h>

View File

@ -7,6 +7,8 @@
#include <support/allocators/secure.h>
#include <test/test_bitcoin.h>
#include <memory>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(allocator_tests, BasicTestingSetup)

View File

@ -7,6 +7,8 @@
#include <random.h>
#include <test/test_bitcoin.h>
#include <memory>
#include <boost/test/unit_test.hpp>
// Test if a string consists entirely of null characters

View File

@ -13,6 +13,8 @@
#include <chainparams.h>
#include <util.h>
#include <memory>
class CAddrManSerializationMock : public CAddrMan
{
public:

View File

@ -14,6 +14,8 @@
#include <txdb.h>
#include <txmempool.h>
#include <memory>
#include <boost/thread.hpp>
extern uint256 insecure_rand_seed;

View File

@ -25,6 +25,7 @@
#include <unistd.h>
#include <algorithm>
#include <memory>
#include <vector>
enum TEST_ID {

View File

@ -6,6 +6,8 @@
#include <net.h>
#include <memory>
#include <boost/test/unit_test.hpp>
std::unique_ptr<CConnman> g_connman;

View File

@ -11,6 +11,7 @@
#include <chain.h>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>

View File

@ -23,6 +23,7 @@
#include <atomic>
#include <exception>
#include <map>
#include <memory>
#include <stdint.h>
#include <string>
#include <vector>

View File

@ -22,6 +22,7 @@
#include <algorithm>
#include <exception>
#include <map>
#include <memory>
#include <set>
#include <stdint.h>
#include <string>

View File

@ -15,6 +15,7 @@
#include <atomic>
#include <map>
#include <memory>
#include <string>
#include <vector>

View File

@ -432,7 +432,7 @@ UniValue importpubkey(const JSONRPCRequest& request)
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"importpubkey \"pubkey\" ( \"label\" rescan )\n"
"\nAdds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n"

View File

@ -9,6 +9,8 @@
#include <wallet/wallet.h>
#include <memory>
/** Testing setup and teardown for wallet.
*/
struct WalletTestingSetup: public TestingSetup {

View File

@ -4,6 +4,7 @@
#include <wallet/wallet.h>
#include <memory>
#include <set>
#include <stdint.h>
#include <utility>

View File

@ -22,6 +22,7 @@
#include <algorithm>
#include <atomic>
#include <map>
#include <memory>
#include <set>
#include <stdexcept>
#include <stdint.h>

View File

@ -260,10 +260,17 @@ class PruneTest(BitcoinTestFramework):
# should not prune because chain tip of node 3 (995) < PruneAfterHeight (1000)
assert_raises_rpc_error(-1, "Blockchain is too short for pruning", node.pruneblockchain, height(500))
# Save block transaction count before pruning, assert value
block1_details = node.getblock(node.getblockhash(1))
assert_equal(block1_details["nTx"], len(block1_details["tx"]))
# mine 6 blocks so we are at height 1001 (i.e., above PruneAfterHeight)
node.generate(6)
assert_equal(node.getblockchaininfo()["blocks"], 1001)
# Pruned block should still know the number of transactions
assert_equal(node.getblockheader(node.getblockhash(1))["nTx"], block1_details["nTx"])
# negative heights should raise an exception
assert_raises_rpc_error(-8, "Negative", node.pruneblockchain, -10)

View File

@ -185,6 +185,7 @@ class BlockchainTest(BitcoinTestFramework):
assert_equal(header['confirmations'], 1)
assert_equal(header['previousblockhash'], secondbesthash)
assert_is_hex_string(header['chainwork'])
assert_equal(header['nTx'], 1)
assert_is_hash_string(header['hash'])
assert_is_hash_string(header['previousblockhash'])
assert_is_hash_string(header['merkleroot'])