From 18b0c69e2fc9f9d5cd56659abab467c2c6826be2 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 2 Apr 2018 18:31:40 +0000 Subject: [PATCH 01/31] 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 02/31] 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 03/31] 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 04/31] 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 05/31] 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 From c04a4a5ae97915fce1c35dff715e373b1290a169 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 9 Jul 2018 20:06:39 -0400 Subject: [PATCH 06/31] Remove useless mapRequest tracking that just effects Qt display. I thought we had removed this a long time ago, TBH, its really confusing feedback to users that we display whether a tx was broadcast to immediate neighbor nodes, given that has little indication of whether the tx propagated very far. Github-Pull: #13622 Rebased-From: beef7ec4be725beea870a2da510d2817487601ec --- src/net_processing.cpp | 6 ----- src/qt/guiconstants.h | 2 -- src/qt/transactiondesc.cpp | 10 -------- src/qt/transactionrecord.cpp | 8 ------ src/qt/transactionrecord.h | 4 +-- src/qt/transactiontablemodel.cpp | 9 ------- src/validationinterface.cpp | 10 -------- src/validationinterface.h | 7 ------ src/wallet/wallet.cpp | 42 -------------------------------- src/wallet/wallet.h | 12 --------- 10 files changed, 1 insertion(+), 109 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index eb5c25804..842e5ce6c 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1221,9 +1221,6 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam if (!push) { vNotFound.push_back(inv); } - - // Track requests for our stuff. - GetMainSignals().Inventory(inv.hash); } } // release cs_main @@ -1908,9 +1905,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr pfrom->AskFor(inv); } } - - // Track requests for our stuff - GetMainSignals().Inventory(inv.hash); } } diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h index 1d21d8c76..ff47653fb 100644 --- a/src/qt/guiconstants.h +++ b/src/qt/guiconstants.h @@ -27,8 +27,6 @@ static const bool DEFAULT_SPLASHSCREEN = true; #define COLOR_BAREADDRESS QColor(140, 140, 140) /* Transaction list -- TX status decoration - open until date */ #define COLOR_TX_STATUS_OPENUNTILDATE QColor(64, 64, 255) -/* Transaction list -- TX status decoration - offline */ -#define COLOR_TX_STATUS_OFFLINE QColor(192, 192, 192) /* Transaction list -- TX status decoration - danger, tx needs attention */ #define COLOR_TX_STATUS_DANGER QColor(200, 100, 100) /* Transaction list -- TX status decoration - default color */ diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index c1d28be0a..42b86fd31 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -36,8 +36,6 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx) int nDepth = wtx.GetDepthInMainChain(); if (nDepth < 0) return tr("conflicted with a transaction with %1 confirmations").arg(-nDepth); - else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0) - return tr("%1/offline").arg(nDepth); else if (nDepth == 0) return tr("0/unconfirmed, %1").arg((wtx.InMempool() ? tr("in memory pool") : tr("not in memory pool"))) + (wtx.isAbandoned() ? ", "+tr("abandoned") : ""); else if (nDepth < 6) @@ -61,14 +59,6 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco CAmount nNet = nCredit - nDebit; strHTML += "" + tr("Status") + ": " + FormatTxStatus(wtx); - int nRequests = wtx.GetRequestCount(); - if (nRequests != -1) - { - if (nRequests == 0) - strHTML += tr(", has not been successfully broadcast yet"); - else if (nRequests > 0) - strHTML += tr(", broadcast through %n node(s)", "", nRequests); - } strHTML += "
"; strHTML += "" + tr("Date") + ": " + (nTime ? GUIUtil::dateTimeStr(nTime) : "") + "
"; diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index de3e885e8..c4cd8af0e 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -205,10 +205,6 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) if (wtx.IsInMainChain()) { status.matures_in = wtx.GetBlocksToMaturity(); - - // Check if the block was requested by anyone - if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0) - status.status = TransactionStatus::MaturesWarning; } else { @@ -226,10 +222,6 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) { status.status = TransactionStatus::Conflicted; } - else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0) - { - status.status = TransactionStatus::Offline; - } else if (status.depth == 0) { status.status = TransactionStatus::Unconfirmed; diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index 29a3cd8de..377e3cba7 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -21,7 +21,7 @@ class TransactionStatus public: TransactionStatus(): countsForBalance(false), sortKey(""), - matures_in(0), status(Offline), depth(0), open_for(0), cur_num_blocks(-1) + matures_in(0), status(Unconfirmed), depth(0), open_for(0), cur_num_blocks(-1) { } enum Status { @@ -29,14 +29,12 @@ public: /// Normal (sent/received) transactions OpenUntilDate, /**< Transaction not yet final, waiting for date */ OpenUntilBlock, /**< Transaction not yet final, waiting for block */ - Offline, /**< Not sent to any other nodes **/ Unconfirmed, /**< Not yet mined into a block **/ Confirming, /**< Confirmed, but waiting for the recommended number of confirmations **/ Conflicted, /**< Conflicts with other transaction or mempool **/ Abandoned, /**< Abandoned from the wallet **/ /// Generated (mined) transactions Immature, /**< Mined but waiting for maturity */ - MaturesWarning, /**< Transaction will likely not mature because no nodes have confirmed */ NotAccepted /**< Mined but not accepted */ }; diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 626d4c0bd..5272a3ef3 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -308,9 +308,6 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons case TransactionStatus::OpenUntilDate: status = tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx->status.open_for)); break; - case TransactionStatus::Offline: - status = tr("Offline"); - break; case TransactionStatus::Unconfirmed: status = tr("Unconfirmed"); break; @@ -329,9 +326,6 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons case TransactionStatus::Immature: status = tr("Immature (%1 confirmations, will be available after %2)").arg(wtx->status.depth).arg(wtx->status.depth + wtx->status.matures_in); break; - case TransactionStatus::MaturesWarning: - status = tr("This block was not received by any other nodes and will probably not be accepted!"); - break; case TransactionStatus::NotAccepted: status = tr("Generated but not accepted"); break; @@ -469,8 +463,6 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx) case TransactionStatus::OpenUntilBlock: case TransactionStatus::OpenUntilDate: return COLOR_TX_STATUS_OPENUNTILDATE; - case TransactionStatus::Offline: - return COLOR_TX_STATUS_OFFLINE; case TransactionStatus::Unconfirmed: return QIcon(":/icons/transaction_0"); case TransactionStatus::Abandoned: @@ -493,7 +485,6 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx) int part = (wtx->status.depth * 4 / total) + 1; return QIcon(QString(":/icons/transaction_%1").arg(part)); } - case TransactionStatus::MaturesWarning: case TransactionStatus::NotAccepted: return QIcon(":/icons/transaction_0"); default: diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index 746263f11..90513bc6c 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -26,7 +26,6 @@ struct MainSignalsInstance { boost::signals2::signal &)> BlockDisconnected; boost::signals2::signal TransactionRemovedFromMempool; boost::signals2::signal SetBestChain; - boost::signals2::signal Inventory; boost::signals2::signal Broadcast; boost::signals2::signal BlockChecked; boost::signals2::signal&)> NewPoWValidBlock; @@ -81,7 +80,6 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) { g_signals.m_internals->BlockDisconnected.connect(boost::bind(&CValidationInterface::BlockDisconnected, pwalletIn, _1)); g_signals.m_internals->TransactionRemovedFromMempool.connect(boost::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, _1)); g_signals.m_internals->SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); - g_signals.m_internals->Inventory.connect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); g_signals.m_internals->Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1, _2)); g_signals.m_internals->BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); g_signals.m_internals->NewPoWValidBlock.connect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, _1, _2)); @@ -90,7 +88,6 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) { void UnregisterValidationInterface(CValidationInterface* pwalletIn) { g_signals.m_internals->BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); g_signals.m_internals->Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1, _2)); - g_signals.m_internals->Inventory.disconnect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); g_signals.m_internals->SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); g_signals.m_internals->TransactionAddedToMempool.disconnect(boost::bind(&CValidationInterface::TransactionAddedToMempool, pwalletIn, _1)); g_signals.m_internals->BlockConnected.disconnect(boost::bind(&CValidationInterface::BlockConnected, pwalletIn, _1, _2, _3)); @@ -106,7 +103,6 @@ void UnregisterAllValidationInterfaces() { } g_signals.m_internals->BlockChecked.disconnect_all_slots(); g_signals.m_internals->Broadcast.disconnect_all_slots(); - g_signals.m_internals->Inventory.disconnect_all_slots(); g_signals.m_internals->SetBestChain.disconnect_all_slots(); g_signals.m_internals->TransactionAddedToMempool.disconnect_all_slots(); g_signals.m_internals->BlockConnected.disconnect_all_slots(); @@ -172,12 +168,6 @@ void CMainSignals::SetBestChain(const CBlockLocator &locator) { }); } -void CMainSignals::Inventory(const uint256 &hash) { - m_internals->m_schedulerClient.AddToProcessQueue([hash, this] { - m_internals->Inventory(hash); - }); -} - void CMainSignals::Broadcast(int64_t nBestBlockTime, CConnman* connman) { m_internals->Broadcast(nBestBlockTime, connman); } diff --git a/src/validationinterface.h b/src/validationinterface.h index 8f71be14c..784757a28 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -101,12 +101,6 @@ protected: * Called on a background thread. */ virtual void SetBestChain(const CBlockLocator &locator) {} - /** - * Notifies listeners about an inventory item being seen on the network. - * - * Called on a background thread. - */ - virtual void Inventory(const uint256 &hash) {} /** Tells listeners to broadcast their data. */ virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman) {} /** @@ -157,7 +151,6 @@ public: void BlockConnected(const std::shared_ptr &, const CBlockIndex *pindex, const std::shared_ptr> &); void BlockDisconnected(const std::shared_ptr &); void SetBestChain(const CBlockLocator &); - void Inventory(const uint256 &); void Broadcast(int64_t nBestBlockTime, CConnman* connman); void BlockChecked(const CBlock&, const CValidationState&); void NewPoWValidBlock(const CBlockIndex *, const std::shared_ptr&); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 468d70411..b4d76e5f9 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1506,45 +1506,6 @@ int64_t CWalletTx::GetTxTime() const return n ? n : nTimeReceived; } -int CWalletTx::GetRequestCount() const -{ - // Returns -1 if it wasn't being tracked - int nRequests = -1; - { - LOCK(pwallet->cs_wallet); - if (IsCoinBase()) - { - // Generated block - if (!hashUnset()) - { - std::map::const_iterator mi = pwallet->mapRequestCount.find(hashBlock); - if (mi != pwallet->mapRequestCount.end()) - nRequests = (*mi).second; - } - } - else - { - // Did anyone request this transaction? - std::map::const_iterator mi = pwallet->mapRequestCount.find(GetHash()); - if (mi != pwallet->mapRequestCount.end()) - { - nRequests = (*mi).second; - - // How about the block it's in? - if (nRequests == 0 && !hashUnset()) - { - std::map::const_iterator _mi = pwallet->mapRequestCount.find(hashBlock); - if (_mi != pwallet->mapRequestCount.end()) - nRequests = (*_mi).second; - else - nRequests = 1; // If it's in someone else's block it must have got out - } - } - } - } - return nRequests; -} - void CWalletTx::GetAmounts(std::list& listReceived, std::list& listSent, CAmount& nFee, std::string& strSentAccount, const isminefilter& filter) const { @@ -3085,9 +3046,6 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, CCon } } - // Track how many getdata requests our transaction gets - mapRequestCount[wtxNew.GetHash()] = 0; - // Get the inserted-CWalletTx from mapWallet so that the // fInMempool flag is cached properly CWalletTx& wtx = mapWallet[wtxNew.GetHash()]; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index faee047aa..9f777b8f0 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -478,7 +478,6 @@ public: bool IsTrusted() const; int64_t GetTxTime() const; - int GetRequestCount() const; // RelayWalletTransaction may only be called if fBroadcastTransactions! bool RelayWalletTransaction(CConnman* connman); @@ -834,7 +833,6 @@ public: int64_t nOrderPosNext; uint64_t nAccountingEntryNumber; - std::map mapRequestCount; std::map mapAddressBook; @@ -1043,16 +1041,6 @@ public: const std::string& GetAccountName(const CScript& scriptPubKey) const; - void Inventory(const uint256 &hash) override - { - { - LOCK(cs_wallet); - std::map::iterator mi = mapRequestCount.find(hash); - if (mi != mapRequestCount.end()) - (*mi).second++; - } - } - void GetScriptForMining(std::shared_ptr &script); unsigned int GetKeyPoolSize() From 79c4fff9edec13ca4685abde953a320840544869 Mon Sep 17 00:00:00 2001 From: lmanners Date: Tue, 8 May 2018 22:38:44 +0200 Subject: [PATCH 07/31] [tests] Fixed intermittent failure in p2p_sendheaders.py. Added handling for the case where headers are announced over more than one message. refs #12453 Github-Pull: #13192 Rebased-From: 12d1b77f7eb2ca274890d9fb45d6c19a40ba8f74 --- test/functional/p2p_sendheaders.py | 96 ++++++++++++++++-------------- 1 file changed, 51 insertions(+), 45 deletions(-) diff --git a/test/functional/p2p_sendheaders.py b/test/functional/p2p_sendheaders.py index 8869aeaae..d338dc8d8 100755 --- a/test/functional/p2p_sendheaders.py +++ b/test/functional/p2p_sendheaders.py @@ -116,6 +116,7 @@ class BaseNode(P2PInterface): self.block_announced = False self.last_blockhash_announced = None + self.recent_headers_announced = [] def send_get_data(self, block_hashes): """Request data for a list of block hashes.""" @@ -163,40 +164,45 @@ class BaseNode(P2PInterface): def on_headers(self, message): if len(message.headers): self.block_announced = True - message.headers[-1].calc_sha256() + for x in message.headers: + x.calc_sha256() + # append because headers may be announced over multiple messages. + self.recent_headers_announced.append(x.sha256) self.last_blockhash_announced = message.headers[-1].sha256 - def clear_last_announcement(self): + def clear_block_announcements(self): with mininode_lock: self.block_announced = False self.last_message.pop("inv", None) self.last_message.pop("headers", None) + self.recent_headers_announced = [] - def check_last_announcement(self, headers=None, inv=None): - """Test whether the last announcement received had the right header or the right inv. - inv and headers should be lists of block hashes.""" + def check_last_headers_announcement(self, headers): + """Test whether the last headers announcements received are right. + Headers may be announced across more than one message.""" + test_function = lambda: (len(self.recent_headers_announced) >= len(headers)) + wait_until(test_function, timeout=60, lock=mininode_lock) + with mininode_lock: + assert_equal(self.recent_headers_announced, headers) + self.block_announced = False + self.last_message.pop("headers", None) + self.recent_headers_announced = [] + + def check_last_inv_announcement(self, inv): + """Test whether the last announcement received had the right inv. + inv should be a list of block hashes.""" test_function = lambda: self.block_announced wait_until(test_function, timeout=60, lock=mininode_lock) with mininode_lock: - self.block_announced = False - compare_inv = [] if "inv" in self.last_message: compare_inv = [x.hash for x in self.last_message["inv"].inv] - if inv is not None: - assert_equal(compare_inv, inv) - - compare_headers = [] - if "headers" in self.last_message: - compare_headers = [x.sha256 for x in self.last_message["headers"].headers] - if headers is not None: - assert_equal(compare_headers, headers) - + assert_equal(compare_inv, inv) + self.block_announced = False self.last_message.pop("inv", None) - self.last_message.pop("headers", None) class SendHeadersTest(BitcoinTestFramework): def set_test_params(self): @@ -206,8 +212,8 @@ class SendHeadersTest(BitcoinTestFramework): def mine_blocks(self, count): """Mine count blocks and return the new tip.""" - # Clear out last block announcement from each p2p listener - [x.clear_last_announcement() for x in self.nodes[0].p2ps] + # Clear out block announcements from each p2p listener + [x.clear_block_announcements() for x in self.nodes[0].p2ps] self.nodes[0].generate(count) return int(self.nodes[0].getbestblockhash(), 16) @@ -222,7 +228,7 @@ class SendHeadersTest(BitcoinTestFramework): sync_blocks(self.nodes, wait=0.1) for x in self.nodes[0].p2ps: x.wait_for_block_announcement(int(self.nodes[0].getbestblockhash(), 16)) - x.clear_last_announcement() + x.clear_block_announcements() tip_height = self.nodes[1].getblockcount() hash_to_invalidate = self.nodes[1].getblockhash(tip_height - (length - 1)) @@ -255,25 +261,25 @@ class SendHeadersTest(BitcoinTestFramework): tip = self.nodes[0].getblockheader(self.nodes[0].generate(1)[0]) tip_hash = int(tip["hash"], 16) - inv_node.check_last_announcement(inv=[tip_hash], headers=[]) - test_node.check_last_announcement(inv=[tip_hash], headers=[]) + inv_node.check_last_inv_announcement(inv=[tip_hash]) + test_node.check_last_inv_announcement(inv=[tip_hash]) self.log.info("Verify getheaders with null locator and valid hashstop returns headers.") - test_node.clear_last_announcement() + test_node.clear_block_announcements() test_node.send_get_headers(locator=[], hashstop=tip_hash) - test_node.check_last_announcement(headers=[tip_hash]) + test_node.check_last_headers_announcement(headers=[tip_hash]) self.log.info("Verify getheaders with null locator and invalid hashstop does not return headers.") block = create_block(int(tip["hash"], 16), create_coinbase(tip["height"] + 1), tip["mediantime"] + 1) block.solve() test_node.send_header_for_blocks([block]) - test_node.clear_last_announcement() + test_node.clear_block_announcements() test_node.send_get_headers(locator=[], hashstop=int(block.hash, 16)) test_node.sync_with_ping() assert_equal(test_node.block_announced, False) - inv_node.clear_last_announcement() + inv_node.clear_block_announcements() test_node.send_message(msg_block(block)) - inv_node.check_last_announcement(inv=[int(block.hash, 16)], headers=[]) + inv_node.check_last_inv_announcement(inv=[int(block.hash, 16)]) def test_nonnull_locators(self, test_node, inv_node): tip = int(self.nodes[0].getbestblockhash(), 16) @@ -284,8 +290,8 @@ class SendHeadersTest(BitcoinTestFramework): for i in range(4): old_tip = tip tip = self.mine_blocks(1) - inv_node.check_last_announcement(inv=[tip], headers=[]) - test_node.check_last_announcement(inv=[tip], headers=[]) + inv_node.check_last_inv_announcement(inv=[tip]) + test_node.check_last_inv_announcement(inv=[tip]) # Try a few different responses; none should affect next announcement if i == 0: # first request the block @@ -296,7 +302,7 @@ class SendHeadersTest(BitcoinTestFramework): test_node.send_get_headers(locator=[old_tip], hashstop=tip) test_node.send_get_data([tip]) test_node.wait_for_block(tip) - test_node.clear_last_announcement() # since we requested headers... + test_node.clear_block_announcements() # since we requested headers... elif i == 2: # this time announce own block via headers height = self.nodes[0].getblockcount() @@ -308,8 +314,8 @@ class SendHeadersTest(BitcoinTestFramework): test_node.wait_for_getdata([new_block.sha256]) test_node.send_message(msg_block(new_block)) test_node.sync_with_ping() # make sure this block is processed - inv_node.clear_last_announcement() - test_node.clear_last_announcement() + inv_node.clear_block_announcements() + test_node.clear_block_announcements() self.log.info("Part 1: success!") self.log.info("Part 2: announce blocks with headers after sendheaders message...") @@ -323,8 +329,8 @@ class SendHeadersTest(BitcoinTestFramework): # Now that we've synced headers, headers announcements should work tip = self.mine_blocks(1) - inv_node.check_last_announcement(inv=[tip], headers=[]) - test_node.check_last_announcement(headers=[tip]) + inv_node.check_last_inv_announcement(inv=[tip]) + test_node.check_last_headers_announcement(headers=[tip]) height = self.nodes[0].getblockcount() + 1 block_time += 10 # Advance far enough ahead @@ -368,8 +374,8 @@ class SendHeadersTest(BitcoinTestFramework): assert "inv" not in inv_node.last_message assert "headers" not in inv_node.last_message tip = self.mine_blocks(1) - inv_node.check_last_announcement(inv=[tip], headers=[]) - test_node.check_last_announcement(headers=[tip]) + inv_node.check_last_inv_announcement(inv=[tip]) + test_node.check_last_headers_announcement(headers=[tip]) height += 1 block_time += 1 @@ -383,16 +389,16 @@ class SendHeadersTest(BitcoinTestFramework): # First try mining a reorg that can propagate with header announcement new_block_hashes = self.mine_reorg(length=7) tip = new_block_hashes[-1] - inv_node.check_last_announcement(inv=[tip], headers=[]) - test_node.check_last_announcement(headers=new_block_hashes) + inv_node.check_last_inv_announcement(inv=[tip]) + test_node.check_last_headers_announcement(headers=new_block_hashes) block_time += 8 # Mine a too-large reorg, which should be announced with a single inv new_block_hashes = self.mine_reorg(length=8) tip = new_block_hashes[-1] - inv_node.check_last_announcement(inv=[tip], headers=[]) - test_node.check_last_announcement(inv=[tip], headers=[]) + inv_node.check_last_inv_announcement(inv=[tip]) + test_node.check_last_inv_announcement(inv=[tip]) block_time += 9 @@ -401,15 +407,15 @@ class SendHeadersTest(BitcoinTestFramework): # Use getblocks/getdata test_node.send_getblocks(locator=[fork_point]) - test_node.check_last_announcement(inv=new_block_hashes, headers=[]) + test_node.check_last_inv_announcement(inv=new_block_hashes) test_node.send_get_data(new_block_hashes) test_node.wait_for_block(new_block_hashes[-1]) for i in range(3): # Mine another block, still should get only an inv tip = self.mine_blocks(1) - inv_node.check_last_announcement(inv=[tip], headers=[]) - test_node.check_last_announcement(inv=[tip], headers=[]) + inv_node.check_last_inv_announcement(inv=[tip]) + test_node.check_last_inv_announcement(inv=[tip]) if i == 0: # Just get the data -- shouldn't cause headers announcements to resume test_node.send_get_data([tip]) @@ -434,8 +440,8 @@ class SendHeadersTest(BitcoinTestFramework): test_node.sync_with_ping() # New blocks should now be announced with header tip = self.mine_blocks(1) - inv_node.check_last_announcement(inv=[tip], headers=[]) - test_node.check_last_announcement(headers=[tip]) + inv_node.check_last_inv_announcement(inv=[tip]) + test_node.check_last_headers_announcement(headers=[tip]) self.log.info("Part 3: success!") From cbdabef35e25d84206006b5dddbf6f8376157d5e Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 22 May 2018 17:07:19 -0400 Subject: [PATCH 08/31] qa: Fix wallet_listreceivedby race Github-Pull: #13304 Rebased-From: fa865efa4a21ae08be8b4c390b7661182e0b415b --- test/functional/wallet_listreceivedby.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/functional/wallet_listreceivedby.py b/test/functional/wallet_listreceivedby.py index 1f2b3c8aa..dd17ac122 100755 --- a/test/functional/wallet_listreceivedby.py +++ b/test/functional/wallet_listreceivedby.py @@ -6,10 +6,13 @@ from decimal import Decimal from test_framework.test_framework import BitcoinTestFramework -from test_framework.util import (assert_array_result, - assert_equal, - assert_raises_rpc_error, - ) +from test_framework.util import ( + assert_array_result, + assert_equal, + assert_raises_rpc_error, + sync_blocks, +) + class ReceivedByTest(BitcoinTestFramework): def set_test_params(self): @@ -18,6 +21,7 @@ class ReceivedByTest(BitcoinTestFramework): def run_test(self): # Generate block to get out of IBD self.nodes[0].generate(1) + sync_blocks(self.nodes) self.log.info("listreceivedbyaddress Test") From cf6feb783764bd37647548c4013a1dde605dcc54 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 26 Mar 2018 15:13:33 -0400 Subject: [PATCH 09/31] qt: Avoid resetting on resetguisettigs=0 Github-Pull: #12793 Rebased-From: 342fb8034640d4393771899dc132c9e3b170b369 --- src/qt/bitcoin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 48e618e9f..90a7cbec8 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -689,7 +689,7 @@ int main(int argc, char *argv[]) // Allow parameter interaction before we create the options model app.parameterSetup(); // Load GUI settings from QSettings - app.createOptionsModel(gArgs.IsArgSet("-resetguisettings")); + app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false)); // Subscribe to global signals from core uiInterface.InitMessage.connect(InitMessage); From 2291774bd5a4cd7692db27de09728c98298db599 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Wed, 4 Apr 2018 15:52:18 -0400 Subject: [PATCH 10/31] [trivial] Add newlines to end of log messages. Log messages should terminate with a '\n', or the following log will be written to the same line without a timestamp. Fix a couple of cases where the message is not terminated with a \n. Github-Pull: #12887 Rebased-From: 5b10ab0116245ee73b493e2248ad2f8bb8e34f21 --- src/init.cpp | 2 +- src/wallet/wallet.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 382915a63..68933b0d3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -684,7 +684,7 @@ void ThreadImport(std::vector vImportFiles) // scan for better chains in the block chain database, that are not yet connected in the active best chain CValidationState state; if (!ActivateBestChain(state, chainparams)) { - LogPrintf("Failed to connect best block"); + LogPrintf("Failed to connect best block\n"); StartShutdown(); return; } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index b4d76e5f9..92a3c4e91 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -891,7 +891,7 @@ bool CWallet::MarkReplaced(const uint256& originalHash, const uint256& newHash) bool success = true; if (!walletdb.WriteTx(wtx)) { - LogPrintf("%s: Updating walletdb tx %s failed", __func__, wtx.GetHash().ToString()); + LogPrintf("%s: Updating walletdb tx %s failed\n", __func__, wtx.GetHash().ToString()); success = false; } From bf1f1501903a2a0df4ac5fd4b2bfe086ffe88773 Mon Sep 17 00:00:00 2001 From: joemphilips Date: Fri, 30 Mar 2018 17:59:37 +0900 Subject: [PATCH 11/31] rpc: fix type mistmatch in listreceivedbyaddress Github-Pull: #12837 Rebased-From: 05c03d1249c6fe30dbfcea9f3f3a3bd02106035b --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 9364d18d3..8d8c58242 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1537,7 +1537,7 @@ UniValue listreceivedbyaddress(const JSONRPCRequest& request) " \"confirmations\" : n, (numeric) The number of confirmations of the most recent transaction included\n" " \"label\" : \"label\", (string) A comment for the address/transaction, if any\n" " \"txids\": [\n" - " n, (numeric) The ids of transactions received with the address \n" + " \"txid\", (string) The ids of transactions received with the address \n" " ...\n" " ]\n" " }\n" From cfc6f7413bfa486aed9811fcef177cd80568f2db Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Fri, 6 Apr 2018 11:54:52 -0400 Subject: [PATCH 12/31] [rpcwallet] Clamp walletpassphrase value at 100M seconds Larger values seem to trigger a bug on macos+libevent (resulting in the rpc server stopping). Github-Pull: #12905 Rebased-From: 662d19ff7217d0e6c7975ca311933f640955a53e --- src/wallet/rpcwallet.cpp | 10 +++++----- test/functional/wallet_encryption.py | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 8d8c58242..a86f38cf7 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2322,8 +2322,7 @@ UniValue walletpassphrase(const JSONRPCRequest& request) "This is needed prior to performing transactions related to private keys such as sending bitcoins\n" "\nArguments:\n" "1. \"passphrase\" (string, required) The wallet passphrase\n" - "2. timeout (numeric, required) The time to keep the decryption key in seconds. Limited to at most 1073741824 (2^30) seconds.\n" - " Any value greater than 1073741824 seconds will be set to 1073741824 seconds.\n" + "2. timeout (numeric, required) The time to keep the decryption key in seconds; capped at 100000000 (~3 years).\n" "\nNote:\n" "Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n" "time that overrides the old one.\n" @@ -2358,9 +2357,10 @@ UniValue walletpassphrase(const JSONRPCRequest& request) if (nSleepTime < 0) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Timeout cannot be negative."); } - // Clamp timeout to 2^30 seconds - if (nSleepTime > (int64_t)1 << 30) { - nSleepTime = (int64_t)1 << 30; + // Clamp timeout + constexpr int64_t MAX_SLEEP_TIME = 100000000; // larger values trigger a macos/libevent bug? + if (nSleepTime > MAX_SLEEP_TIME) { + nSleepTime = MAX_SLEEP_TIME; } if (strWalletPass.length() > 0) diff --git a/test/functional/wallet_encryption.py b/test/functional/wallet_encryption.py index 3c927ee48..64ee67874 100755 --- a/test/functional/wallet_encryption.py +++ b/test/functional/wallet_encryption.py @@ -64,14 +64,15 @@ class WalletEncryptionTest(BitcoinTestFramework): assert_raises_rpc_error(-8, "Timeout cannot be negative.", self.nodes[0].walletpassphrase, passphrase2, -10) # Check the timeout # Check a time less than the limit - expected_time = int(time.time()) + (1 << 30) - 600 - self.nodes[0].walletpassphrase(passphrase2, (1 << 30) - 600) + MAX_VALUE = 100000000 + expected_time = int(time.time()) + MAX_VALUE - 600 + self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE - 600) actual_time = self.nodes[0].getwalletinfo()['unlocked_until'] assert_greater_than_or_equal(actual_time, expected_time) assert_greater_than(expected_time + 5, actual_time) # 5 second buffer # Check a time greater than the limit - expected_time = int(time.time()) + (1 << 30) - 1 - self.nodes[0].walletpassphrase(passphrase2, (1 << 33)) + expected_time = int(time.time()) + MAX_VALUE - 1 + self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE + 1000) actual_time = self.nodes[0].getwalletinfo()['unlocked_until'] assert_greater_than_or_equal(actual_time, expected_time) assert_greater_than(expected_time + 5, actual_time) # 5 second buffer From 170b3099814c96c9af39fb2405502b0a85a33b5d Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Mon, 23 Apr 2018 23:57:21 +0200 Subject: [PATCH 13/31] Make tests pass after 2020 also test that 64 bit integers are properly handled Github-Pull: #13061 Rebased-From: 3ee4be10500710fc8e9b03acf974fd81224c05c4 --- src/test/rpc_tests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index ed86413b2..1365227fa 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -256,14 +256,14 @@ BOOST_AUTO_TEST_CASE(rpc_ban) ar = r.get_array(); BOOST_CHECK_EQUAL(ar.size(), 0); - BOOST_CHECK_NO_THROW(r = CallRPC(std::string("setban 127.0.0.0/24 add 1607731200 true"))); + BOOST_CHECK_NO_THROW(r = CallRPC(std::string("setban 127.0.0.0/24 add 9907731200 true"))); BOOST_CHECK_NO_THROW(r = CallRPC(std::string("listbanned"))); ar = r.get_array(); o1 = ar[0].get_obj(); adr = find_value(o1, "address"); UniValue banned_until = find_value(o1, "banned_until"); BOOST_CHECK_EQUAL(adr.get_str(), "127.0.0.0/24"); - BOOST_CHECK_EQUAL(banned_until.get_int64(), 1607731200); // absolute time check + BOOST_CHECK_EQUAL(banned_until.get_int64(), 9907731200); // absolute time check BOOST_CHECK_NO_THROW(CallRPC(std::string("clearbanned"))); From 10621995edaa8237b5846f81a1d731648af4d017 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 27 Jun 2018 16:59:23 +0200 Subject: [PATCH 14/31] Fix incorrect tests Github-Pull: #13545 Rebased-From: c6fd0df4efcd9f75c43ff527fd57fe43bc47a474 --- src/test/streams_tests.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp index 1108dab58..6f71f71ab 100644 --- a/src/test/streams_tests.cpp +++ b/src/test/streams_tests.cpp @@ -80,14 +80,17 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor) // Degenerate case - key += '\x00','\x00'; + key += '\x00'; + key += '\x00'; ds.Xor(key); BOOST_CHECK_EQUAL( std::string(expected_xor.begin(), expected_xor.end()), std::string(ds.begin(), ds.end())); - in += '\x0f','\xf0'; - expected_xor += '\xf0','\x0f'; + in += '\x0f'; + in += '\xf0'; + expected_xor += '\xf0'; + expected_xor += '\x0f'; // Single character key @@ -105,14 +108,17 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor) in.clear(); expected_xor.clear(); - in += '\xf0','\x0f'; - expected_xor += '\x0f','\x00'; + in += '\xf0'; + in += '\x0f'; + expected_xor += '\x0f'; + expected_xor += '\x00'; ds.clear(); ds.insert(ds.begin(), in.begin(), in.end()); key.clear(); - key += '\xff','\x0f'; + key += '\xff'; + key += '\x0f'; ds.Xor(key); BOOST_CHECK_EQUAL( From e15e3a9ddd17e1d46b3548cd475bcd6b1795c378 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 27 Jun 2018 17:45:18 +0200 Subject: [PATCH 15/31] Remove boost dependency (boost/assign/std/vector.hpp) Github-Pull: #13545 Rebased-From: 962d8eed5bdbe62b9926f01cb85bdce9d435d3d6 --- src/test/streams_tests.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp index 6f71f71ab..abd4a29d9 100644 --- a/src/test/streams_tests.cpp +++ b/src/test/streams_tests.cpp @@ -6,11 +6,8 @@ #include #include -#include // for 'operator+=()' #include -using namespace boost::assign; // bring 'operator+=()' into scope - BOOST_FIXTURE_TEST_SUITE(streams_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(streams_vector_writer) @@ -80,17 +77,17 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor) // Degenerate case - key += '\x00'; - key += '\x00'; + key.push_back('\x00'); + key.push_back('\x00'); ds.Xor(key); BOOST_CHECK_EQUAL( std::string(expected_xor.begin(), expected_xor.end()), std::string(ds.begin(), ds.end())); - in += '\x0f'; - in += '\xf0'; - expected_xor += '\xf0'; - expected_xor += '\x0f'; + in.push_back('\x0f'); + in.push_back('\xf0'); + expected_xor.push_back('\xf0'); + expected_xor.push_back('\x0f'); // Single character key @@ -98,7 +95,7 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor) ds.insert(ds.begin(), in.begin(), in.end()); key.clear(); - key += '\xff'; + key.push_back('\xff'); ds.Xor(key); BOOST_CHECK_EQUAL( std::string(expected_xor.begin(), expected_xor.end()), @@ -108,17 +105,17 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor) in.clear(); expected_xor.clear(); - in += '\xf0'; - in += '\x0f'; - expected_xor += '\x0f'; - expected_xor += '\x00'; + in.push_back('\xf0'); + in.push_back('\x0f'); + expected_xor.push_back('\x0f'); + expected_xor.push_back('\x00'); ds.clear(); ds.insert(ds.begin(), in.begin(), in.end()); key.clear(); - key += '\xff'; - key += '\x0f'; + key.push_back('\xff'); + key.push_back('\x0f'); ds.Xor(key); BOOST_CHECK_EQUAL( From ed82e7176d6f7c3e5f53363102dd1e7d558b1f92 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 11 Jun 2018 14:09:16 -0400 Subject: [PATCH 16/31] wallet: Erase wtxOrderd wtx pointer on removeprunedfunds Github-Pull: #13437 Rebased-From: faa18ca046e9043b2cf68cb1bd17cc8c60fe26d9 --- src/wallet/wallet.cpp | 19 ++++++++++++------- src/wallet/wallet.h | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 92a3c4e91..fc1d2076b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -913,11 +913,10 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose) CWalletTx& wtx = (*ret.first).second; wtx.BindWallet(this); bool fInsertedNew = ret.second; - if (fInsertedNew) - { + if (fInsertedNew) { wtx.nTimeReceived = GetAdjustedTime(); wtx.nOrderPos = IncOrderPosNext(&walletdb); - wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr))); + wtx.m_it_wtxOrdered = wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr))); wtx.nTimeSmart = ComputeTimeSmart(wtx); AddToSpends(hash); } @@ -987,9 +986,12 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose) bool CWallet::LoadToWallet(const CWalletTx& wtxIn) { uint256 hash = wtxIn.GetHash(); - CWalletTx& wtx = mapWallet.emplace(hash, wtxIn).first->second; + const auto& ins = mapWallet.emplace(hash, wtxIn); + CWalletTx& wtx = ins.first->second; wtx.BindWallet(this); - wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr))); + if (/* insertion took place */ ins.second) { + wtx.m_it_wtxOrdered = wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr))); + } AddToSpends(hash); for (const CTxIn& txin : wtx.tx->vin) { auto it = mapWallet.find(txin.prevout.hash); @@ -3123,8 +3125,11 @@ DBErrors CWallet::ZapSelectTx(std::vector& vHashIn, std::vectorsecond.m_it_wtxOrdered); + mapWallet.erase(it); + } if (nZapSelectTxRet == DB_NEED_REWRITE) { diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 9f777b8f0..0630840f6 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -327,6 +327,7 @@ public: char fFromMe; std::string strFromAccount; int64_t nOrderPos; //!< position in ordered transaction list + std::multimap>::const_iterator m_it_wtxOrdered; // memory only mutable bool fDebitCached; From 6b9dc8ceaed597d9c539ba6b09c171b258b66ca3 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 12 Jun 2018 17:10:21 -0400 Subject: [PATCH 17/31] have verifytxoutproof check the number of txns in proof structure Github-Pull: #13452 Rebased-From: ed82f1700006830b6fe34572b66245c1487ccd29 --- src/merkleblock.h | 6 ++++++ src/rpc/rawtransaction.cpp | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/merkleblock.h b/src/merkleblock.h index 0976e21c3..984e33a96 100644 --- a/src/merkleblock.h +++ b/src/merkleblock.h @@ -115,6 +115,12 @@ public: * returns the merkle root, or 0 in case of failure */ uint256 ExtractMatches(std::vector &vMatch, std::vector &vnIndex); + + /** Get number of transactions the merkle proof is indicating for cross-reference with + * local blockchain knowledge. + */ + unsigned int GetNumTransactions() const { return nTransactions; }; + }; diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 8dea988d5..5e0ce9e01 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -290,7 +290,7 @@ UniValue verifytxoutproof(const JSONRPCRequest& request) "\nArguments:\n" "1. \"proof\" (string, required) The hex-encoded proof generated by gettxoutproof\n" "\nResult:\n" - "[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof is invalid\n" + "[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof can not be validated.\n" ); CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS); @@ -306,11 +306,16 @@ UniValue verifytxoutproof(const JSONRPCRequest& request) LOCK(cs_main); - if (!mapBlockIndex.count(merkleBlock.header.GetHash()) || !chainActive.Contains(mapBlockIndex[merkleBlock.header.GetHash()])) + if (!mapBlockIndex.count(merkleBlock.header.GetHash()) || !chainActive.Contains(mapBlockIndex[merkleBlock.header.GetHash()]) || mapBlockIndex[merkleBlock.header.GetHash()]->nTx == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found in chain"); - for (const uint256& hash : vMatch) - res.push_back(hash.GetHex()); + // Check if proof is valid, only add results if so + if (mapBlockIndex[merkleBlock.header.GetHash()]->nTx == merkleBlock.txn.GetNumTransactions()) { + for (const uint256& hash : vMatch) { + res.push_back(hash.GetHex()); + } + } + return res; } From b72c0bd4c9cf36163fdef6ce0c60970d112d1100 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Wed, 20 Jun 2018 16:03:25 -0400 Subject: [PATCH 18/31] [qa] Add a test for merkle proof malleation Github-Pull: #13452 Rebased-From: d280617bf569f84457eaea546541dc74c67cd1e4 --- test/functional/rpc_txoutproof.py | 23 +++++++++++ test/functional/test_framework/messages.py | 46 ++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/test/functional/rpc_txoutproof.py b/test/functional/rpc_txoutproof.py index 50e0371fd..d35cc2751 100755 --- a/test/functional/rpc_txoutproof.py +++ b/test/functional/rpc_txoutproof.py @@ -6,6 +6,8 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * +from test_framework.mininode import FromHex, ToHex +from test_framework.messages import CMerkleBlock class MerkleBlockTest(BitcoinTestFramework): def set_test_params(self): @@ -78,6 +80,27 @@ class MerkleBlockTest(BitcoinTestFramework): # We can't get a proof if we specify transactions from different blocks assert_raises_rpc_error(-5, "Not all transactions found in specified or retrieved block", self.nodes[2].gettxoutproof, [txid1, txid3]) + # Now we'll try tweaking a proof. + proof = self.nodes[3].gettxoutproof([txid1, txid2]) + assert txid1 in self.nodes[0].verifytxoutproof(proof) + assert txid2 in self.nodes[1].verifytxoutproof(proof) + + tweaked_proof = FromHex(CMerkleBlock(), proof) + + # Make sure that our serialization/deserialization is working + assert txid1 in self.nodes[2].verifytxoutproof(ToHex(tweaked_proof)) + + # Check to see if we can go up the merkle tree and pass this off as a + # single-transaction block + tweaked_proof.txn.nTransactions = 1 + tweaked_proof.txn.vHash = [tweaked_proof.header.hashMerkleRoot] + tweaked_proof.txn.vBits = [True] + [False]*7 + + for n in self.nodes: + assert not n.verifytxoutproof(ToHex(tweaked_proof)) + + # TODO: try more variants, eg transactions at different depths, and + # verify that the proofs are invalid if __name__ == '__main__': MerkleBlockTest().main() diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index a54a0299c..06566b812 100644 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -830,6 +830,52 @@ class BlockTransactions(): def __repr__(self): return "BlockTransactions(hash=%064x transactions=%s)" % (self.blockhash, repr(self.transactions)) +class CPartialMerkleTree(): + def __init__(self): + self.nTransactions = 0 + self.vHash = [] + self.vBits = [] + self.fBad = False + + def deserialize(self, f): + self.nTransactions = struct.unpack(" Date: Thu, 1 Mar 2018 17:20:27 +0800 Subject: [PATCH 19/31] Consensus: Fix bug when compiler do not support __builtin_clz* #ifdef is not correct since defination is defined to 0 or 1. Should change to #if Github-Pull: #12573 Rebased-From: 18307849b405f9e2067eaa8091b105838f413707 --- src/crypto/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/common.h b/src/crypto/common.h index 825b43097..6e9d6dc82 100644 --- a/src/crypto/common.h +++ b/src/crypto/common.h @@ -82,12 +82,12 @@ void static inline WriteBE64(unsigned char* ptr, uint64_t x) /** Return the smallest number n such that (x >> n) == 0 (or 64 if the highest bit in x is set. */ uint64_t static inline CountBits(uint64_t x) { -#ifdef HAVE_DECL___BUILTIN_CLZL +#if HAVE_DECL___BUILTIN_CLZL if (sizeof(unsigned long) >= sizeof(uint64_t)) { return x ? 8 * sizeof(unsigned long) - __builtin_clzl(x) : 0; } #endif -#ifdef HAVE_DECL___BUILTIN_CLZLL +#if HAVE_DECL___BUILTIN_CLZLL if (sizeof(unsigned long long) >= sizeof(uint64_t)) { return x ? 8 * sizeof(unsigned long long) - __builtin_clzll(x) : 0; } From 657dfc5bca2bd476d124f51f711e889f98f1e7d6 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 20 Mar 2018 21:04:27 -0700 Subject: [PATCH 20/31] Fix csBestBlock/cvBlockChange waiting in rpc/mining Github-Pull: #12743 Rebased-From: 45dd13503918e75a45ce33eb5c934b998790fdc8 --- src/rpc/mining.cpp | 2 +- src/validation.cpp | 7 ++++++- src/validation.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index c22d0ac37..f029be7fa 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -477,7 +477,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request) checktxtime = std::chrono::steady_clock::now() + std::chrono::minutes(1); WaitableLock lock(csBestBlock); - while (chainActive.Tip()->GetBlockHash() == hashWatchedChain && IsRPCRunning()) + while (hashBestBlock == hashWatchedChain && IsRPCRunning()) { if (cvBlockChange.wait_until(lock, checktxtime) == std::cv_status::timeout) { diff --git a/src/validation.cpp b/src/validation.cpp index 2c5b5a1a3..7795905c4 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -210,6 +210,7 @@ CChain& chainActive = g_chainstate.chainActive; CBlockIndex *pindexBestHeader = nullptr; CWaitableCriticalSection csBestBlock; CConditionVariable cvBlockChange; +uint256 hashBestBlock; int nScriptCheckThreads = 0; std::atomic_bool fImporting(false); std::atomic_bool fReindex(false); @@ -2151,7 +2152,11 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar // New best block mempool.AddTransactionsUpdated(1); - cvBlockChange.notify_all(); + { + WaitableLock lock(csBestBlock); + hashBestBlock = pindexNew->GetBlockHash(); + cvBlockChange.notify_all(); + } std::vector warningMessages; if (!IsInitialBlockDownload()) diff --git a/src/validation.h b/src/validation.h index cd243e204..e9a1eabdf 100644 --- a/src/validation.h +++ b/src/validation.h @@ -166,6 +166,7 @@ extern uint64_t nLastBlockWeight; extern const std::string strMessageMagic; extern CWaitableCriticalSection csBestBlock; extern CConditionVariable cvBlockChange; +extern uint256 hashBestBlock; extern std::atomic_bool fImporting; extern std::atomic_bool fReindex; extern int nScriptCheckThreads; From f78e7f6589eca50650ecd2010c41333b12f964b0 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Wed, 14 Feb 2018 14:23:43 +0100 Subject: [PATCH 21/31] [qt] send: Clear All also resets coin control options Github-Pull: #12432 Rebased-From: f506c0a7f8ea6bae089177884e44e38cd2bfeb23 --- src/qt/sendcoinsdialog.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 1227e340c..bd02fde30 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -375,6 +375,12 @@ void SendCoinsDialog::on_sendButton_clicked() void SendCoinsDialog::clear() { + // Clear coin control settings + CoinControlDialog::coinControl()->UnSelectAll(); + ui->checkBoxCoinControlChange->setChecked(false); + ui->lineEditCoinControlChange->clear(); + coinControlUpdateLabels(); + // Remove entries until only one left while(ui->entries->count()) { From 21dd5127a423f38712dcdcef4002e714e8276bd2 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 6 Mar 2018 16:39:45 +0100 Subject: [PATCH 22/31] gui: Show messages as text not html Currently, error messages (such as InitError) are displayed as-is, which means Qt does auto detection on the format. This means that it's possible to inject HTML from the command line though e.g. specifying a wallet name with HTML in it. This isn't a direct security risk because fetching content from internet is disabled (and as far as I know we never report strings received from the network this way). However, it can be confusing. So explicitly force the format as text. Github-Pull: #12617 Rebased-From: 6fbc0986fa2d49a1cb65b60eca71c25c84842a54 --- src/qt/bitcoingui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 09ae8b1c6..14ea9d75e 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -923,6 +923,7 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned showNormalIfMinimized(); QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this); + mBox.setTextFormat(Qt::PlainText); int r = mBox.exec(); if (ret != nullptr) *ret = r == QMessageBox::Ok; From d9c563095d71055ff054d3a27e11a12d3d1ec92f Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 21 May 2018 21:35:47 -0400 Subject: [PATCH 23/31] qa: Initialize lockstack to prevent null pointer deref Github-Pull: #13300 Rebased-From: fa9da85b7cc759d06bc24854be2bad0ea87b6006 --- src/sync.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/sync.cpp b/src/sync.cpp index 8b96ee680..0ec00b6f6 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -73,7 +73,7 @@ struct LockData { std::mutex dd_mutex; } static lockdata; -static thread_local std::unique_ptr lockstack; +static thread_local LockStack g_lockstack; static void potential_deadlock_detected(const std::pair& mismatch, const LockStack& s1, const LockStack& s2) { @@ -103,21 +103,18 @@ static void potential_deadlock_detected(const std::pair& mismatch, static void push_lock(void* c, const CLockLocation& locklocation) { - if (!lockstack) - lockstack.reset(new LockStack); - std::lock_guard lock(lockdata.dd_mutex); - lockstack->push_back(std::make_pair(c, locklocation)); + g_lockstack.push_back(std::make_pair(c, locklocation)); - for (const std::pair & i : (*lockstack)) { + for (const std::pair& i : g_lockstack) { if (i.first == c) break; std::pair p1 = std::make_pair(i.first, c); if (lockdata.lockorders.count(p1)) continue; - lockdata.lockorders[p1] = (*lockstack); + lockdata.lockorders[p1] = g_lockstack; std::pair p2 = std::make_pair(c, i.first); lockdata.invlockorders.insert(p2); @@ -128,7 +125,7 @@ static void push_lock(void* c, const CLockLocation& locklocation) static void pop_lock() { - (*lockstack).pop_back(); + g_lockstack.pop_back(); } void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry) @@ -144,14 +141,14 @@ void LeaveCritical() std::string LocksHeld() { std::string result; - for (const std::pair & i : *lockstack) + for (const std::pair& i : g_lockstack) result += i.second.ToString() + std::string("\n"); return result; } void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) { - for (const std::pair & i : *lockstack) + for (const std::pair& i : g_lockstack) if (i.first == cs) return; fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld().c_str()); @@ -160,7 +157,7 @@ void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) { - for (const std::pair& i : *lockstack) { + for (const std::pair& i : g_lockstack) { if (i.first == cs) { fprintf(stderr, "Assertion failed: lock %s held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld().c_str()); abort(); From 20461fc272516253ea077c5a80e4f600ce5c3542 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Thu, 12 Jul 2018 17:19:00 -0400 Subject: [PATCH 24/31] Fix that CWallet::AbandonTransaction would only traverse one level Prior to this change, it would mark only the first layer of child transactions abandoned, due to always following the input hashTx rather than the current now tx. Github-Pull: #13652 Rebased-From: 89e70f9d7fe384ef9de4fa3828d4c80523290186 Tree-SHA512: 403da0cc400a807e5a30038bd505881a68208c3f9e96ad5a7755e763666982bc3c19564ac13a5757612c8b6efc331fb2ad0edbaf7e830993b84bc64624423e54 --- src/wallet/wallet.cpp | 2 +- test/functional/wallet_abandonconflict.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index fc1d2076b..09ed4be3e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1124,7 +1124,7 @@ bool CWallet::AbandonTransaction(const uint256& hashTx) walletdb.WriteTx(wtx); NotifyTransactionChanged(this, wtx.GetHash(), CT_UPDATED); // Iterate over all its outputs, and mark transactions in the wallet that spend them abandoned too - TxSpends::const_iterator iter = mapTxSpends.lower_bound(COutPoint(hashTx, 0)); + TxSpends::const_iterator iter = mapTxSpends.lower_bound(COutPoint(now, 0)); while (iter != mapTxSpends.end() && iter->first.hash == now) { if (!done.count(iter->second)) { todo.insert(iter->second); diff --git a/test/functional/wallet_abandonconflict.py b/test/functional/wallet_abandonconflict.py index 14964438a..924708366 100755 --- a/test/functional/wallet_abandonconflict.py +++ b/test/functional/wallet_abandonconflict.py @@ -64,9 +64,17 @@ class AbandonConflictTest(BitcoinTestFramework): signed2 = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs)) txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"]) + # Create a child tx spending ABC2 + signed3_change = Decimal("24.999") + inputs = [ {"txid":txABC2, "vout":0} ] + outputs = { self.nodes[0].getnewaddress(): signed3_change } + signed3 = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs)) + # note tx is never directly referenced, only abandoned as a child of the above + self.nodes[0].sendrawtransaction(signed3["hex"]) + # In mempool txs from self should increase balance from change newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance - Decimal("30") + Decimal("24.9996")) + assert_equal(newbalance, balance - Decimal("30") + signed3_change) balance = newbalance # Restart the node with a higher min relay fee so the parent tx is no longer in mempool @@ -81,7 +89,7 @@ class AbandonConflictTest(BitcoinTestFramework): # Not in mempool txs from self should only reduce balance # inputs are still spent, but change not received newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance - Decimal("24.9996")) + assert_equal(newbalance, balance - signed3_change) # Unconfirmed received funds that are not in mempool, also shouldn't show # up in unconfirmed balance unconfbalance = self.nodes[0].getunconfirmedbalance() + self.nodes[0].getbalance() From 63daa10015e3afad7d6560ec6bea689af4f8b471 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 16 Jul 2018 15:49:59 +0200 Subject: [PATCH 25/31] doc: Clean out release notes for 0.16.2 --- doc/release-notes.md | 96 +++++--------------------------------------- 1 file changed, 9 insertions(+), 87 deletions(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index 672b22a11..083bceec3 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -1,9 +1,9 @@ -Bitcoin Core version 0.16.1 is now available from: +Bitcoin Core version 0.16.2 is now available from: - + -This is a new major version release, including new features, various bugfixes -and performance improvements, as well as updated translations. +This is a new minor version release, with various bugfixes +as well as updated translations. Please report bugs using the issue tracker at GitHub: @@ -49,97 +49,19 @@ frequently tested on them. Notable changes =============== -Miner block size removed ------------------------- +to be filled in -The `-blockmaxsize` option for miners to limit their blocks' sizes was -deprecated in version 0.15.1, and has now been removed. Miners should use the -`-blockmaxweight` option if they want to limit the weight of their blocks' -weights. - -0.16.1 change log +0.16.2 change log ------------------ -### Policy -- #11423 `d353dd1` [Policy] Several transaction standardness rules (jl2012) - -### Mining -- #12756 `e802c22` [config] Remove blockmaxsize option (jnewbery) - -### Block and transaction handling -- #13199 `c71e535` Bugfix: ensure consistency of m_failed_blocks after reconsiderblock (sdaftuar) -- #13023 `bb79aaf` Fix some concurrency issues in ActivateBestChain() (skeees) - -### P2P protocol and network code -- #12626 `f60e84d` Limit the number of IPs addrman learns from each DNS seeder (EthanHeilman) - -### Wallet -- #13265 `5d8de76` Exit SyncMetaData if there are no transactions to sync (laanwj) -- #13030 `5ff571e` Fix zapwallettxes/multiwallet interaction. (jnewbery) - -### GUI -- #12999 `1720eb3` Show the Window when double clicking the taskbar icon (ken2812221) -- #12650 `f118a7a` Fix issue: "default port not shown correctly in settings dialog" (251Labs) -- #13251 `ea487f9` Rephrase Bech32 checkbox texts, and enable it with legacy address default (fanquake) - -### Build system -- #12474 `b0f692f` Allow depends system to support armv7l (hkjn) -- #12585 `72a3290` depends: Switch to downloading expat from GitHub (fanquake) -- #12648 `46ca8f3` test: Update trusted git root (MarcoFalke) -- #11995 `686cb86` depends: Fix Qt build with Xcode 9 (fanquake) -- #12636 `845838c` backport: #11995 Fix Qt build with Xcode 9 (fanquake) -- #12946 `e055bc0` depends: Fix Qt build with XCode 9.3 (fanquake) -- #12998 `7847b92` Default to defining endian-conversion DECLs in compat w/o config (TheBlueMatt) - -### Tests and QA -- #12447 `01f931b` Add missing signal.h header (laanwj) -- #12545 `1286f3e` Use wait_until to ensure ping goes out (Empact) -- #12804 `4bdb0ce` Fix intermittent rpc_net.py failure. (jnewbery) -- #12553 `0e98f96` Prefer wait_until over polling with time.sleep (Empact) -- #12486 `cfebd40` Round target fee to 8 decimals in assert_fee_amount (kallewoof) -- #12843 `df38b13` Test starting bitcoind with -h and -version (jnewbery) -- #12475 `41c29f6` Fix python TypeError in script.py (MarcoFalke) -- #12638 `0a76ed2` Cache only chain and wallet for regtest datadir (MarcoFalke) -- #12902 `7460945` Handle potential cookie race when starting node (sdaftuar) -- #12904 `6c26df0` Ensure bitcoind processes are cleaned up when tests end (sdaftuar) -- #13049 `9ea62a3` Backports (MarcoFalke) -- #13201 `b8aacd6` Handle disconnect_node race (sdaftuar) - -### Miscellaneous -- #12518 `a17fecf` Bump leveldb subtree (MarcoFalke) -- #12442 `f3b8d85` devtools: Exclude patches from lint-whitespace (MarcoFalke) -- #12988 `acdf433` Hold cs_main while calling UpdatedBlockTip() signal (skeees) -- #12985 `0684cf9` Windows: Avoid launching as admin when NSIS installer ends. (JeremyRand) - -### Documentation -- #12637 `60086dd` backport: #12556 fix version typo in getpeerinfo RPC call help (fanquake) -- #13184 `4087dd0` RPC Docs: `gettxout*`: clarify bestblock and unspent counts (harding) -- #13246 `6de7543` Bump to Ubuntu Bionic 18.04 in build-windows.md (ken2812221) -- #12556 `e730b82` Fix version typo in getpeerinfo RPC call help (tamasblummer) +to be filled in + Credits ======= Thanks to everyone who directly contributed to this release: -- 251 -- Ben Woosley -- Chun Kuan Lee -- David A. Harding -- e0 -- fanquake -- Henrik Jonsson -- JeremyRand -- Jesse Cohen -- John Newbery -- Johnson Lau -- Karl-Johan Alm -- Luke Dashjr -- MarcoFalke -- Matt Corallo -- Pieter Wuille -- Suhas Daftuar -- Tamas Blummer -- Wladimir J. van der Laan +to be filled in As well as everyone that helped translating on [Transifex](https://www.transifex.com/projects/p/bitcoin/). From 4244dbddc4a92d869542a0b5c9f60b34ce905398 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Mon, 16 Jul 2018 12:53:21 -0400 Subject: [PATCH 26/31] build: Bump version to 0.16.2 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 46a9ac105..5803af553 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 16) -define(_CLIENT_VERSION_REVISION, 1) +define(_CLIENT_VERSION_REVISION, 2) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2018) From 08ca3144104aa61237ad6b30f8ed86628f493a2b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 18 Jul 2018 15:36:10 +0200 Subject: [PATCH 27/31] doc: Fill in changelog and credits in release notes Tree-SHA512: cb2a7cd91447b6e4ad13055e97b542c6984309e28cd33898f3c4bbe92141c6cb65cc472821b34e63f94aa675553d8d68709c431255ccc17e0fc0c54c0c3836bc --- doc/release-notes.md | 65 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 8 deletions(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index 083bceec3..d549748d2 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -46,22 +46,71 @@ the Linux kernel, macOS 10.8+, and Windows Vista and later. Windows XP is not su Bitcoin Core should also work on most other Unix-like systems but is not frequently tested on them. -Notable changes -=============== - -to be filled in - 0.16.2 change log ------------------ -to be filled in - +### Wallet +- #13622 `c04a4a5` Remove mapRequest tracking that just effects Qt display. (TheBlueMatt) +- #12905 `cfc6f74` [rpcwallet] Clamp walletpassphrase value at 100M seconds (sdaftuar) +- #13437 `ed82e71` wallet: Erase wtxOrderd wtx pointer on removeprunedfunds (MarcoFalke) + +### RPC and other APIs +- #13451 `cbd2f70` rpc: expose CBlockIndex::nTx in getblock(header) (instagibbs) +- #13507 `f7401c8` RPC: Fix parameter count check for importpubkey (kristapsk) +- #13452 `6b9dc8c` rpc: have verifytxoutproof check the number of txns in proof structure (instagibbs) +- #12837 `bf1f150` rpc: fix type mistmatch in `listreceivedbyaddress` (joemphilips) +- #12743 `657dfc5` Fix csBestBlock/cvBlockChange waiting in rpc/mining (sipa) + +### GUI +- #12432 `f78e7f6` [qt] send: Clear All also resets coin control options (Sjors) +- #12617 `21dd512` gui: Show messages as text not html (laanwj) +- #12793 `cf6feb7` qt: Avoid reseting on resetguisettigs=0 (MarcoFalke) + +### Build system +- #13544 `9fd3e00` depends: Update Qt download url (fanquake) +- #12573 `88d1a64` Fix compilation when compiler do not support `__builtin_clz*` (532479301) + +### Tests and QA +- #13061 `170b309` Make tests pass after 2020 (bmwiedemann) +- #13192 `79c4fff` [tests] Fixed intermittent failure in `p2p_sendheaders.py` (lmanners) +- #13300 `d9c5630` qa: Initialize lockstack to prevent null pointer deref (MarcoFalke) +- #13545 `e15e3a9` tests: Fix test case `streams_serializedata_xor` Remove Boost dependency. (practicalswift) +- #13304 `cbdabef` qa: Fix `wallet_listreceivedby` race (MarcoFalke) + +### Miscellaneous +- #12887 `2291774` Add newlines to end of log messages (jnewbery) +- #12859 `18b0c69` Bugfix: Include for `std::unique_ptr` (luke-jr) +- #13131 `ce8aa54` Add Windows shutdown handler (ken2812221) +- #13652 `20461fc` rpc: Fix that CWallet::AbandonTransaction would leave the grandchildren, etc. active (Empact) Credits ======= Thanks to everyone who directly contributed to this release: -to be filled in +- 532479301 +- Ben Woosley +- Bernhard M. Wiedemann +- Chun Kuan Lee +- Cory Fields +- fanquake +- Gregory Sanders +- joemphilips +- John Newbery +- Kristaps Kaupe +- lmanners +- Luke Dashjr +- MarcoFalke +- Matt Corallo +- Pieter Wuille +- practicalswift +- Sjors Provoost +- Suhas Daftuar +- Wladimir J. van der Laan + +And to those that reported security issues: + +- Braydon Fuller +- Himanshu Mehta As well as everyone that helped translating on [Transifex](https://www.transifex.com/projects/p/bitcoin/). From 0296b9c85e942686df7ef40333e07e9b1802b892 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 18 Jul 2018 13:38:06 -0400 Subject: [PATCH 28/31] 0.16.2: Bump manpages --- doc/man/bitcoin-cli.1 | 6 +++--- doc/man/bitcoin-qt.1 | 11 +++-------- doc/man/bitcoin-tx.1 | 6 +++--- doc/man/bitcoind.1 | 11 +++-------- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/doc/man/bitcoin-cli.1 b/doc/man/bitcoin-cli.1 index a7f9e1459..a84fe4220 100644 --- a/doc/man/bitcoin-cli.1 +++ b/doc/man/bitcoin-cli.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIN-CLI "1" "January 2018" "bitcoin-cli v0.16.0.0" "User Commands" +.TH BITCOIN-CLI "1" "July 2018" "bitcoin-cli v0.16.2.0" "User Commands" .SH NAME -bitcoin-cli \- manual page for bitcoin-cli v0.16.0.0 +bitcoin-cli \- manual page for bitcoin-cli v0.16.2.0 .SH DESCRIPTION -Bitcoin Core RPC client version v0.16.0.0 +Bitcoin Core RPC client version v0.16.2.0 .SS "Usage:" .TP bitcoin\-cli [options] [params] diff --git a/doc/man/bitcoin-qt.1 b/doc/man/bitcoin-qt.1 index 36f729f3c..41302ac78 100644 --- a/doc/man/bitcoin-qt.1 +++ b/doc/man/bitcoin-qt.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIN-QT "1" "January 2018" "bitcoin-qt v0.16.0.0" "User Commands" +.TH BITCOIN-QT "1" "July 2018" "bitcoin-qt v0.16.2.0" "User Commands" .SH NAME -bitcoin-qt \- manual page for bitcoin-qt v0.16.0.0 +bitcoin-qt \- manual page for bitcoin-qt v0.16.2.0 .SH DESCRIPTION -Bitcoin Core version v0.16.0.0 (64\-bit) +Bitcoin Core version v0.16.2.0 (64\-bit) Usage: .IP bitcoin\-qt [command\-line options] @@ -469,11 +469,6 @@ Block creation options: .IP Set maximum BIP141 block weight (default: 3996000) .HP -\fB\-blockmaxsize=\fR -.IP -Set maximum BIP141 block weight to this * 4. Deprecated, use -blockmaxweight -.HP \fB\-blockmintxfee=\fR .IP Set lowest fee rate (in BTC/kB) for transactions to be included in block diff --git a/doc/man/bitcoin-tx.1 b/doc/man/bitcoin-tx.1 index e6b4d2b38..166a3a788 100644 --- a/doc/man/bitcoin-tx.1 +++ b/doc/man/bitcoin-tx.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIN-TX "1" "January 2018" "bitcoin-tx v0.16.0.0" "User Commands" +.TH BITCOIN-TX "1" "July 2018" "bitcoin-tx v0.16.2.0" "User Commands" .SH NAME -bitcoin-tx \- manual page for bitcoin-tx v0.16.0.0 +bitcoin-tx \- manual page for bitcoin-tx v0.16.2.0 .SH DESCRIPTION -Bitcoin Core bitcoin\-tx utility version v0.16.0.0 +Bitcoin Core bitcoin\-tx utility version v0.16.2.0 .SS "Usage:" .TP bitcoin\-tx [options] [commands] diff --git a/doc/man/bitcoind.1 b/doc/man/bitcoind.1 index 4d896bba8..c91ac52c2 100644 --- a/doc/man/bitcoind.1 +++ b/doc/man/bitcoind.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIND "1" "January 2018" "bitcoind v0.16.0.0" "User Commands" +.TH BITCOIND "1" "July 2018" "bitcoind v0.16.2.0" "User Commands" .SH NAME -bitcoind \- manual page for bitcoind v0.16.0.0 +bitcoind \- manual page for bitcoind v0.16.2.0 .SH DESCRIPTION -Bitcoin Core Daemon version v0.16.0.0 +Bitcoin Core Daemon version v0.16.2.0 .SS "Usage:" .TP bitcoind [options] @@ -474,11 +474,6 @@ Block creation options: .IP Set maximum BIP141 block weight (default: 3996000) .HP -\fB\-blockmaxsize=\fR -.IP -Set maximum BIP141 block weight to this * 4. Deprecated, use -blockmaxweight -.HP \fB\-blockmintxfee=\fR .IP Set lowest fee rate (in BTC/kB) for transactions to be included in block From ccf37a45fef6dd9002b8cef245a22d2c7dea7326 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Mon, 23 Jul 2018 18:10:36 -0700 Subject: [PATCH 29/31] Litecoin: Fix wallet_abandonconflict test --- test/functional/wallet_abandonconflict.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/functional/wallet_abandonconflict.py b/test/functional/wallet_abandonconflict.py index ba426998c..4d8f24575 100755 --- a/test/functional/wallet_abandonconflict.py +++ b/test/functional/wallet_abandonconflict.py @@ -47,20 +47,20 @@ class AbandonConflictTest(BitcoinTestFramework): inputs.append({"txid":txB, "vout":nB}) outputs = {} - outputs[self.nodes[0].getnewaddress()] = Decimal("14.998") + outputs[self.nodes[0].getnewaddress()] = Decimal("14.99998") outputs[self.nodes[1].getnewaddress()] = Decimal("5") signed = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs)) txAB1 = self.nodes[0].sendrawtransaction(signed["hex"]) # Identify the 14.99998btc output - nAB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txAB1, 1)["vout"]) if vout["value"] == Decimal("14.998")) + nAB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txAB1, 1)["vout"]) if vout["value"] == Decimal("14.99998")) #Create a child tx spending AB1 and C inputs = [] inputs.append({"txid":txAB1, "vout":nAB}) inputs.append({"txid":txC, "vout":nC}) outputs = {} - outputs[self.nodes[0].getnewaddress()] = Decimal("24.96") + outputs[self.nodes[0].getnewaddress()] = Decimal("24.9996") signed2 = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs)) txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"]) @@ -80,7 +80,7 @@ class AbandonConflictTest(BitcoinTestFramework): # Restart the node with a higher min relay fee so the parent tx is no longer in mempool # TODO: redo with eviction self.stop_node(0) - self.start_node(0, extra_args=["-minrelaytxfee=0.01"]) + self.start_node(0, extra_args=["-minrelaytxfee=0.0001"]) # Verify txs no longer in either node's mempool assert_equal(len(self.nodes[0].getrawmempool()), 0) @@ -107,7 +107,7 @@ class AbandonConflictTest(BitcoinTestFramework): # Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned self.stop_node(0) - self.start_node(0, extra_args=["-minrelaytxfee=0.001"]) + self.start_node(0, extra_args=["-minrelaytxfee=0.00001"]) assert_equal(len(self.nodes[0].getrawmempool()), 0) assert_equal(self.nodes[0].getbalance(), balance) @@ -116,21 +116,21 @@ class AbandonConflictTest(BitcoinTestFramework): # But its child tx remains abandoned self.nodes[0].sendrawtransaction(signed["hex"]) newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance - Decimal("20") + Decimal("14.998")) + assert_equal(newbalance, balance - Decimal("20") + Decimal("14.99998")) balance = newbalance # Send child tx again so its unabandoned self.nodes[0].sendrawtransaction(signed2["hex"]) newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance - Decimal("10") - Decimal("14.998") + Decimal("24.96")) + assert_equal(newbalance, balance - Decimal("10") - Decimal("14.99998") + Decimal("24.9996")) balance = newbalance # Remove using high relay fee again self.stop_node(0) - self.start_node(0, extra_args=["-minrelaytxfee=0.01"]) + self.start_node(0, extra_args=["-minrelaytxfee=0.0001"]) assert_equal(len(self.nodes[0].getrawmempool()), 0) newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance - Decimal("24.96")) + assert_equal(newbalance, balance - Decimal("24.9996")) balance = newbalance # Create a double spend of AB1 by spending again from only A's 10 output @@ -138,7 +138,7 @@ class AbandonConflictTest(BitcoinTestFramework): inputs =[] inputs.append({"txid":txA, "vout":nA}) outputs = {} - outputs[self.nodes[1].getnewaddress()] = Decimal("9.99") + outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999") tx = self.nodes[0].createrawtransaction(inputs, outputs) signed = self.nodes[0].signrawtransaction(tx) self.nodes[1].sendrawtransaction(signed["hex"]) @@ -163,4 +163,4 @@ class AbandonConflictTest(BitcoinTestFramework): self.log.info(str(balance) + " -> " + str(newbalance) + " ?") if __name__ == '__main__': - AbandonConflictTest().main() + AbandonConflictTest().main() \ No newline at end of file From 157fe556b26decf09857be9653a4ff51d57e4ede Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Mon, 23 Jul 2018 16:54:51 -0700 Subject: [PATCH 30/31] Litecoin: Bump man pages --- doc/man/litecoin-cli.1 | 6 +++--- doc/man/litecoin-qt.1 | 10 +++++----- doc/man/litecoin-tx.1 | 6 +++--- doc/man/litecoind.1 | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/man/litecoin-cli.1 b/doc/man/litecoin-cli.1 index 2394dee41..d1cadeba4 100644 --- a/doc/man/litecoin-cli.1 +++ b/doc/man/litecoin-cli.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIN-CLI "1" "July 2018" "bitcoin-cli v0.16.2.0" "User Commands" +.TH LITECOIN-CLI "1" "July 2018" "litecoin-cli v0.16.2.0" "User Commands" .SH NAME -bitcoin-cli \- manual page for bitcoin-cli v0.16.2.0 +litecoin-cli \- manual page for litecoin-cli v0.16.2.0 .SH DESCRIPTION -Bitcoin Core RPC client version v0.16.2.0 +Litecoin Core RPC client version v0.16.2.0 .SS "Usage:" .TP litecoin\-cli [options] [params] diff --git a/doc/man/litecoin-qt.1 b/doc/man/litecoin-qt.1 index f0d6af823..e0a7049e9 100644 --- a/doc/man/litecoin-qt.1 +++ b/doc/man/litecoin-qt.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIN-QT "1" "July 2018" "bitcoin-qt v0.16.2.0" "User Commands" +.TH LITECOIN-QT "1" "July 2018" "litecoin-qt v0.16.2.0" "User Commands" .SH NAME -bitcoin-qt \- manual page for bitcoin-qt v0.16.2.0 +litecoin-qt \- manual page for litecoin-qt v0.16.2.0 .SH DESCRIPTION -Bitcoin Core version v0.16.2.0 (64\-bit) +Litecoin Core version v0.16.2.0 (64\-bit) Usage: .IP litecoin\-qt [command\-line options] @@ -32,9 +32,9 @@ block hash) If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: -59c9b9d3fec105bdc716d84caa7579503d5b05b73618d0bf2d5fa639f780a011, +66f49ad85624c33e4fd61aa45c54012509ed4a53308908dd07f56346c7939273, testnet: -a0afbded94d4be233e191525dc2d467af5c7eab3143c852c3cd549831022aad6) +1efb29c8187d5a496a33377941d1df415169c3ce5d8c05d055f25b683ec3f9a3) .HP \fB\-conf=\fR .IP diff --git a/doc/man/litecoin-tx.1 b/doc/man/litecoin-tx.1 index 23262af4e..36b3c7580 100644 --- a/doc/man/litecoin-tx.1 +++ b/doc/man/litecoin-tx.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIN-TX "1" "July 2018" "bitcoin-tx v0.16.2.0" "User Commands" +.TH LITECOIN-TX "1" "July 2018" "litecoin-tx v0.16.2.0" "User Commands" .SH NAME -bitcoin-tx \- manual page for bitcoin-tx v0.16.2.0 +litecoin-tx \- manual page for litecoin-tx v0.16.2.0 .SH DESCRIPTION -Bitcoin Core bitcoin\-tx utility version v0.16.2.0 +Litecoin Core litecoin\-tx utility version v0.16.2.0 .SS "Usage:" .TP litecoin\-tx [options] [commands] diff --git a/doc/man/litecoind.1 b/doc/man/litecoind.1 index adb0da98e..52acec38b 100644 --- a/doc/man/litecoind.1 +++ b/doc/man/litecoind.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIND "1" "July 2018" "bitcoind v0.16.2.0" "User Commands" +.TH LITECOIND "1" "July 2018" "litecoind v0.16.2.0" "User Commands" .SH NAME -bitcoind \- manual page for bitcoind v0.16.2.0 +litecoind \- manual page for litecoind v0.16.2.0 .SH DESCRIPTION -Bitcoin Core Daemon version v0.16.2.0 +Litecoin Core Daemon version v0.16.2.0 .SS "Usage:" .TP litecoind [options] @@ -33,9 +33,9 @@ block hash) If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: -59c9b9d3fec105bdc716d84caa7579503d5b05b73618d0bf2d5fa639f780a011, +66f49ad85624c33e4fd61aa45c54012509ed4a53308908dd07f56346c7939273, testnet: -a0afbded94d4be233e191525dc2d467af5c7eab3143c852c3cd549831022aad6) +1efb29c8187d5a496a33377941d1df415169c3ce5d8c05d055f25b683ec3f9a3) .HP \fB\-conf=\fR .IP From d949bf74d1baf5f927e0e34eb8f6bba7f923b70d Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Mon, 23 Jul 2018 17:16:50 -0700 Subject: [PATCH 31/31] Litecoin: Release notes for v0.16.2 --- doc/release-notes-litecoin.md | 39 ++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/doc/release-notes-litecoin.md b/doc/release-notes-litecoin.md index 776768844..f74cd459f 100644 --- a/doc/release-notes-litecoin.md +++ b/doc/release-notes-litecoin.md @@ -1,9 +1,9 @@ -Litecoin Core version 0.16.1 is now available from: +Litecoin Core version 0.16.2 is now available from: - + -This is a new minor version release, including new features, various bugfixes -and performance improvements, as well as updated translations. +This is a new minor version release, with various bugfixes +as well as updated translations. Please report bugs using the issue tracker at GitHub: @@ -57,7 +57,7 @@ deprecated in version 0.15.1, and has now been removed. Miners should use the `-blockmaxweight` option if they want to limit the weight of their blocks' weights. -0.16.1 change log +0.16.2 change log ------------------ ### Policy @@ -76,11 +76,24 @@ weights. ### Wallet - #13265 `5d8de76` Exit SyncMetaData if there are no transactions to sync (laanwj) - #13030 `5ff571e` Fix zapwallettxes/multiwallet interaction. (jnewbery) +- #13622 `c04a4a5` Remove mapRequest tracking that just effects Qt display. (TheBlueMatt) +- #12905 `cfc6f74` [rpcwallet] Clamp walletpassphrase value at 100M seconds (sdaftuar) +- #13437 `ed82e71` wallet: Erase wtxOrderd wtx pointer on removeprunedfunds (MarcoFalke) + +### RPC and other APIs +- #13451 `cbd2f70` rpc: expose CBlockIndex::nTx in getblock(header) (instagibbs) +- #13507 `f7401c8` RPC: Fix parameter count check for importpubkey (kristapsk) +- #13452 `6b9dc8c` rpc: have verifytxoutproof check the number of txns in proof structure (instagibbs) +- #12837 `bf1f150` rpc: fix type mistmatch in `listreceivedbyaddress` (joemphilips) +- #12743 `657dfc5` Fix csBestBlock/cvBlockChange waiting in rpc/mining (sipa) ### GUI - #12999 `1720eb3` Show the Window when double clicking the taskbar icon (ken2812221) - #12650 `f118a7a` Fix issue: "default port not shown correctly in settings dialog" (251Labs) - #13251 `ea487f9` Rephrase Bech32 checkbox texts, and enable it with legacy address default (fanquake) +- #12432 `f78e7f6` [qt] send: Clear All also resets coin control options (Sjors) +- #12617 `21dd512` gui: Show messages as text not html (laanwj) +- #12793 `cf6feb7` qt: Avoid reseting on resetguisettigs=0 (MarcoFalke) ### Build system - #12474 `b0f692f` Allow depends system to support armv7l (hkjn) @@ -90,6 +103,8 @@ weights. - #12636 `845838c` backport: #11995 Fix Qt build with Xcode 9 (fanquake) - #12946 `e055bc0` depends: Fix Qt build with XCode 9.3 (fanquake) - #12998 `7847b92` Default to defining endian-conversion DECLs in compat w/o config (TheBlueMatt) +- #13544 `9fd3e00` depends: Update Qt download url (fanquake) +- #12573 `88d1a64` Fix compilation when compiler do not support `__builtin_clz*` (532479301) ### Tests and QA - #12447 `01f931b` Add missing signal.h header (laanwj) @@ -104,6 +119,11 @@ weights. - #12904 `6c26df0` Ensure bitcoind processes are cleaned up when tests end (sdaftuar) - #13049 `9ea62a3` Backports (MarcoFalke) - #13201 `b8aacd6` Handle disconnect_node race (sdaftuar) +- #13061 `170b309` Make tests pass after 2020 (bmwiedemann) +- #13192 `79c4fff` [tests] Fixed intermittent failure in `p2p_sendheaders.py` (lmanners) +- #13300 `d9c5630` qa: Initialize lockstack to prevent null pointer deref (MarcoFalke) +- #13545 `e15e3a9` tests: Fix test case `streams_serializedata_xor` Remove Boost dependency. (practicalswift) +- #13304 `cbdabef` qa: Fix `wallet_listreceivedby` race (MarcoFalke) ### Miscellaneous - #12518 `a17fecf` Bump leveldb subtree (MarcoFalke) @@ -111,6 +131,10 @@ weights. - #12988 `acdf433` Hold cs_main while calling UpdatedBlockTip() signal (skeees) - #12985 `0684cf9` Windows: Avoid launching as admin when NSIS installer ends. (JeremyRand) - #503 `87ec334` Fix CVE-2018-12356 by hardening the regex (jmutkawoa) +- #12887 `2291774` Add newlines to end of log messages (jnewbery) +- #12859 `18b0c69` Bugfix: Include for `std::unique_ptr` (luke-jr) +- #13131 `ce8aa54` Add Windows shutdown handler (ken2812221) +- #13652 `20461fc` rpc: Fix that CWallet::AbandonTransaction would leave the grandchildren, etc. active (Empact) ### Documentation - #12637 `60086dd` backport: #12556 fix version typo in getpeerinfo RPC call help (fanquake) @@ -142,3 +166,8 @@ Thanks to everyone who directly contributed to this release: - voidmain - wbsmolen - xinxi + +And to those that reported security issues: + +- Braydon Fuller +- Himanshu Mehta \ No newline at end of file