From 18b0c69e2fc9f9d5cd56659abab467c2c6826be2 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 2 Apr 2018 18:31:40 +0000 Subject: [PATCH 1/5] Bugfix: Include for std::unique_ptr GitHub-Pull: #12859 Rebased-From: a5bca13 --- src/bitcoin-cli.cpp | 1 + src/bitcoin-tx.cpp | 1 + src/chainparams.cpp | 1 + src/chainparamsbase.cpp | 1 + src/dbwrapper.cpp | 1 + src/httprpc.cpp | 2 ++ src/httpserver.cpp | 1 + src/memusage.h | 1 + src/miner.cpp | 1 + src/net.cpp | 1 + src/net_processing.cpp | 2 ++ src/policy/fees.h | 1 + src/qt/bantablemodel.h | 2 ++ src/qt/bitcoin.cpp | 1 + src/qt/paymentserver.cpp | 1 + src/qt/peertablemodel.h | 2 ++ src/qt/test/wallettests.cpp | 2 ++ src/qt/walletmodeltransaction.h | 2 ++ src/rpc/blockchain.cpp | 1 + src/support/lockedpool.cpp | 1 + src/sync.cpp | 1 + src/test/allocator_tests.cpp | 2 ++ src/test/dbwrapper_tests.cpp | 2 ++ src/test/net_tests.cpp | 2 ++ src/test/test_bitcoin.h | 2 ++ src/test/test_bitcoin_fuzzy.cpp | 1 + src/test/test_bitcoin_main.cpp | 2 ++ src/txdb.h | 1 + src/util.h | 1 + src/validation.h | 1 + src/wallet/db.h | 1 + src/wallet/test/wallet_test_fixture.h | 2 ++ src/wallet/test/wallet_tests.cpp | 1 + src/wallet/wallet.h | 1 + 34 files changed, 46 insertions(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index e9ef75eb7..2b42faf44 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index f1cf7c9d2..1522e6b37 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 96e9b2727..d7a2707ea 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -11,6 +11,7 @@ #include #include +#include #include diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index a03137f40..dfe720014 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -9,6 +9,7 @@ #include #include +#include const std::string CBaseChainParams::MAIN = "main"; const std::string CBaseChainParams::TESTNET = "test"; diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 4e1e403f6..ac122a354 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -4,6 +4,7 @@ #include +#include #include #include diff --git a/src/httprpc.cpp b/src/httprpc.cpp index 5e9e41974..1d0cfcc55 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -17,6 +17,8 @@ #include #include +#include + #include // boost::trim /** WWW-Authenticate to present with 401 Unauthorized response */ diff --git a/src/httpserver.cpp b/src/httpserver.cpp index f78ce1373..860ca3b8a 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/src/memusage.h b/src/memusage.h index fea7ecdf9..0b92e53b4 100644 --- a/src/memusage.h +++ b/src/memusage.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/src/miner.cpp b/src/miner.cpp index 298ea066f..85dbe9c22 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include diff --git a/src/net.cpp b/src/net.cpp index ff68b182f..83bbaafb7 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -20,6 +20,7 @@ #include #include +#include #ifdef WIN32 #include #else diff --git a/src/net_processing.cpp b/src/net_processing.cpp index f1260f3ae..eb5c25804 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -30,6 +30,8 @@ #include #include +#include + #if defined(NDEBUG) # error "Bitcoin cannot be compiled without assertions." #endif diff --git a/src/policy/fees.h b/src/policy/fees.h index 96a842b7a..f53bfbd86 100644 --- a/src/policy/fees.h +++ b/src/policy/fees.h @@ -12,6 +12,7 @@ #include #include +#include #include #include diff --git a/src/qt/bantablemodel.h b/src/qt/bantablemodel.h index a54f8793d..636ec1f3b 100644 --- a/src/qt/bantablemodel.h +++ b/src/qt/bantablemodel.h @@ -7,6 +7,8 @@ #include +#include + #include #include diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 06e1f1a37..48e618e9f 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -36,6 +36,7 @@ #include #endif +#include #include #include diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index bc69d4f94..348308a46 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -16,6 +16,7 @@ #include #include +#include #include diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h index e3c9c6e5a..11bc3ad6f 100644 --- a/src/qt/peertablemodel.h +++ b/src/qt/peertablemodel.h @@ -8,6 +8,8 @@ #include // For CNodeStateStats #include +#include + #include #include diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index cd4929213..5c4f5cfc4 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -18,6 +18,8 @@ #include #include +#include + #include #include #include diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h index cd531dba4..816b0c35a 100644 --- a/src/qt/walletmodeltransaction.h +++ b/src/qt/walletmodeltransaction.h @@ -7,6 +7,8 @@ #include +#include + #include class SendCoinsRecipient; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 14d0541cd..3f69c5642 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -33,6 +33,7 @@ #include // boost::thread::interrupt +#include #include #include diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp index d92ab02d6..eae96e142 100644 --- a/src/support/lockedpool.cpp +++ b/src/support/lockedpool.cpp @@ -27,6 +27,7 @@ #endif #include +#include LockedPoolManager* LockedPoolManager::_instance = nullptr; std::once_flag LockedPoolManager::init_flag; diff --git a/src/sync.cpp b/src/sync.cpp index ae6e72146..8b96ee680 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -4,6 +4,7 @@ #include +#include #include #include #include diff --git a/src/test/allocator_tests.cpp b/src/test/allocator_tests.cpp index c177f0bf0..24cd88c7a 100644 --- a/src/test/allocator_tests.cpp +++ b/src/test/allocator_tests.cpp @@ -7,6 +7,8 @@ #include #include +#include + #include BOOST_FIXTURE_TEST_SUITE(allocator_tests, BasicTestingSetup) diff --git a/src/test/dbwrapper_tests.cpp b/src/test/dbwrapper_tests.cpp index 754a86344..4b04653b4 100644 --- a/src/test/dbwrapper_tests.cpp +++ b/src/test/dbwrapper_tests.cpp @@ -7,6 +7,8 @@ #include #include +#include + #include // Test if a string consists entirely of null characters diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp index ca57f5890..f64f23b2d 100644 --- a/src/test/net_tests.cpp +++ b/src/test/net_tests.cpp @@ -13,6 +13,8 @@ #include #include +#include + class CAddrManSerializationMock : public CAddrMan { public: diff --git a/src/test/test_bitcoin.h b/src/test/test_bitcoin.h index 234315dbc..fe8c46874 100644 --- a/src/test/test_bitcoin.h +++ b/src/test/test_bitcoin.h @@ -14,6 +14,8 @@ #include #include +#include + #include extern uint256 insecure_rand_seed; diff --git a/src/test/test_bitcoin_fuzzy.cpp b/src/test/test_bitcoin_fuzzy.cpp index aaba2095e..69e9804c2 100644 --- a/src/test/test_bitcoin_fuzzy.cpp +++ b/src/test/test_bitcoin_fuzzy.cpp @@ -25,6 +25,7 @@ #include #include +#include #include enum TEST_ID { diff --git a/src/test/test_bitcoin_main.cpp b/src/test/test_bitcoin_main.cpp index 64408e9c5..e48c685b6 100644 --- a/src/test/test_bitcoin_main.cpp +++ b/src/test/test_bitcoin_main.cpp @@ -6,6 +6,8 @@ #include +#include + #include std::unique_ptr g_connman; diff --git a/src/txdb.h b/src/txdb.h index 3edeb4648..216a612bd 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/src/util.h b/src/util.h index c7d1600b4..288c0437b 100644 --- a/src/util.h +++ b/src/util.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/src/validation.h b/src/validation.h index 99cbfdf1e..cd243e204 100644 --- a/src/validation.h +++ b/src/validation.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/src/wallet/db.h b/src/wallet/db.h index 787135e40..067f7e6da 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -15,6 +15,7 @@ #include #include +#include #include #include diff --git a/src/wallet/test/wallet_test_fixture.h b/src/wallet/test/wallet_test_fixture.h index c03aec7f8..e694f2a56 100644 --- a/src/wallet/test/wallet_test_fixture.h +++ b/src/wallet/test/wallet_test_fixture.h @@ -9,6 +9,8 @@ #include +#include + /** Testing setup and teardown for wallet. */ struct WalletTestingSetup: public TestingSetup { diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index 863416760..c923ab9b9 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -4,6 +4,7 @@ #include +#include #include #include #include diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index a4684c293..faee047aa 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include From ce8aa5491f35c2cca03ba1877cd4c926b506a961 Mon Sep 17 00:00:00 2001 From: Chun Kuan Lee Date: Mon, 30 Apr 2018 23:31:11 +0800 Subject: [PATCH 2/5] Add Windows shutdown handler GitHub-Pull: #13131 Rebased-From: ddebde7 --- src/init.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 162c32c38..382915a63 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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); From cbd2f70b75016bbadeb212c823b5c1ece95d5241 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 12 Jun 2018 16:39:29 -0400 Subject: [PATCH 3/5] expose CBlockIndex::nTx in getblock(header) GitHub-Pull: #13451 Rebased-From: 86edf4a --- src/rpc/blockchain.cpp | 4 ++++ test/functional/feature_pruning.py | 7 +++++++ test/functional/rpc_blockchain.py | 1 + 3 files changed, 12 insertions(+) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 3f69c5642..c092790d6 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -105,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())); @@ -150,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())); @@ -679,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" @@ -748,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" diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index 16ee5e617..341d71c3c 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -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) diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py index 11acff4be..68386ca0d 100755 --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -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']) From f7401c86b9c9c58cfe57c2a49d3b4e00f80ded4a Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Wed, 20 Jun 2018 00:34:38 +0300 Subject: [PATCH 4/5] Fix parameter count check for importpubkey. Github-Pull: #13507 Rebased-From: 3f72d04 --- src/wallet/rpcdump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 03fb824e7..0468996ef 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -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" From 9fd3e0001fc20eecbfa823e12f66da4054a072a7 Mon Sep 17 00:00:00 2001 From: fanquake Date: Wed, 27 Jun 2018 23:26:25 +0800 Subject: [PATCH 5/5] depends: Update Qt download url GitHub-Pull: #13544 Rebased-From: 2fca656 --- depends/packages/qt.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 745c9e115..34b0fdc63 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -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