Browse Source

Merge #13455: [0.16.2] Backports

9fd3e0001f depends: Update Qt download url (fanquake)
f7401c86b9 Fix parameter count check for importpubkey. (Kristaps Kaupe)
cbd2f70b75 expose CBlockIndex::nTx in getblock(header) (Gregory Sanders)
ce8aa5491f Add Windows shutdown handler (Chun Kuan Lee)
18b0c69e2f 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
0.16
Wladimir J. van der Laan 7 years ago
parent
commit
dac5374cce
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
  1. 2
      depends/packages/qt.mk
  2. 1
      src/bitcoin-cli.cpp
  3. 1
      src/bitcoin-tx.cpp
  4. 1
      src/chainparams.cpp
  5. 1
      src/chainparamsbase.cpp
  6. 1
      src/dbwrapper.cpp
  7. 2
      src/httprpc.cpp
  8. 1
      src/httpserver.cpp
  9. 11
      src/init.cpp
  10. 1
      src/memusage.h
  11. 1
      src/miner.cpp
  12. 1
      src/net.cpp
  13. 2
      src/net_processing.cpp
  14. 1
      src/policy/fees.h
  15. 2
      src/qt/bantablemodel.h
  16. 1
      src/qt/bitcoin.cpp
  17. 1
      src/qt/paymentserver.cpp
  18. 2
      src/qt/peertablemodel.h
  19. 2
      src/qt/test/wallettests.cpp
  20. 2
      src/qt/walletmodeltransaction.h
  21. 5
      src/rpc/blockchain.cpp
  22. 1
      src/support/lockedpool.cpp
  23. 1
      src/sync.cpp
  24. 2
      src/test/allocator_tests.cpp
  25. 2
      src/test/dbwrapper_tests.cpp
  26. 2
      src/test/net_tests.cpp
  27. 2
      src/test/test_bitcoin.h
  28. 1
      src/test/test_bitcoin_fuzzy.cpp
  29. 2
      src/test/test_bitcoin_main.cpp
  30. 1
      src/txdb.h
  31. 1
      src/util.h
  32. 1
      src/validation.h
  33. 1
      src/wallet/db.h
  34. 2
      src/wallet/rpcdump.cpp
  35. 2
      src/wallet/test/wallet_test_fixture.h
  36. 1
      src/wallet/test/wallet_tests.cpp
  37. 1
      src/wallet/wallet.h
  38. 7
      test/functional/feature_pruning.py
  39. 1
      test/functional/rpc_blockchain.py

2
depends/packages/qt.mk

@ -1,6 +1,6 @@ @@ -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

1
src/bitcoin-cli.cpp

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

1
src/bitcoin-tx.cpp

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

1
src/chainparams.cpp

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

1
src/chainparamsbase.cpp

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

1
src/dbwrapper.cpp

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

2
src/httprpc.cpp

@ -17,6 +17,8 @@ @@ -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 */

1
src/httpserver.cpp

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

11
src/init.cpp

@ -283,6 +283,7 @@ void Shutdown() @@ -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) @@ -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() @@ -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);

1
src/memusage.h

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

1
src/miner.cpp

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

1
src/net.cpp

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

2
src/net_processing.cpp

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

1
src/policy/fees.h

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

2
src/qt/bantablemodel.h

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

1
src/qt/bitcoin.cpp

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

1
src/qt/paymentserver.cpp

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

2
src/qt/peertablemodel.h

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

2
src/qt/test/wallettests.cpp

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

2
src/qt/walletmodeltransaction.h

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

5
src/rpc/blockchain.cpp

@ -33,6 +33,7 @@ @@ -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) @@ -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 @@ -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) @@ -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) @@ -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"

1
src/support/lockedpool.cpp

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

1
src/sync.cpp

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

2
src/test/allocator_tests.cpp

@ -7,6 +7,8 @@ @@ -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)

2
src/test/dbwrapper_tests.cpp

@ -7,6 +7,8 @@ @@ -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

2
src/test/net_tests.cpp

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

2
src/test/test_bitcoin.h

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

1
src/test/test_bitcoin_fuzzy.cpp

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

2
src/test/test_bitcoin_main.cpp

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

1
src/txdb.h

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

1
src/util.h

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

1
src/validation.h

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

1
src/wallet/db.h

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

2
src/wallet/rpcdump.cpp

@ -432,7 +432,7 @@ UniValue importpubkey(const JSONRPCRequest& request) @@ -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"

2
src/wallet/test/wallet_test_fixture.h

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

1
src/wallet/test/wallet_tests.cpp

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

1
src/wallet/wallet.h

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

7
test/functional/feature_pruning.py

@ -260,10 +260,17 @@ class PruneTest(BitcoinTestFramework): @@ -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)

1
test/functional/rpc_blockchain.py

@ -185,6 +185,7 @@ class BlockchainTest(BitcoinTestFramework): @@ -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'])

Loading…
Cancel
Save