From 30c1a2e7a47e79485e13d21927042dfa97e3343e Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 28 Apr 2020 08:51:54 -0400 Subject: [PATCH 1/9] Merge #18663: doc: mention build docs in README.md bda62e87e681696828d14b5581b6c19b6e81f378 Adding build instructions to Bitcoin Core, fixes #18658 (Saahil Shangle) Pull request description: Making the instructions for building Bitcoin Core more clear in the main `README.md` will reduce confusion between the `build_msvc` and `doc` folders. ACKs for top commit: laanwj: ACK bda62e87e681696828d14b5581b6c19b6e81f378 Tree-SHA512: ee4c394661eba48d4229e3d1e9ddb67ccb79589429bfa9986cb0242cd615d1f3cc5332063562c1e89c0cdd9ae2e609f61e8bfb209926d8363d35d3da6d94ae9c --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 75dc9e847a858..b5577106a40ba 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ The `master` branch is meant to be stable. Development is normally done in separ [Tags](https://github.com/dashpay/dash/tags) are created to indicate new official, stable release versions of Dash Core. +The `develop` branch is regularly built (see doc/build-*.md for instructions) and tested, but is not guaranteed to be +completely stable. + The contribution workflow is described in [CONTRIBUTING.md](CONTRIBUTING.md) and useful hints for developers can be found in [doc/developer-notes.md](doc/developer-notes.md). From d2a2054dd35796d1c8c9ee9ee66de72d04d36a0e Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 14 May 2020 19:12:26 +0200 Subject: [PATCH 2/9] Merge #18946: rpcwallet: Replace boost::optional::emplace with simple assignment of T{} fa1f840596554ed264d11ee3b3643bf99eb57eb5 rpcwallet: Replace pwallet-> with wallet. (MarcoFalke) fa182a8794cbf9be1aa91d1d75e65bc7800156bc rpcwallet: Replace boost::optional::emplace with simple assignment of T{} (MarcoFalke) Pull request description: Closes #18943 ACKs for top commit: laanwj: ACK fa1f840596554ed264d11ee3b3643bf99eb57eb5 ryanofsky: Code review ACK fa1f840596554ed264d11ee3b3643bf99eb57eb5 and thanks for using a standalone commit for the fix promag: Code review ACK fa1f840596554ed264d11ee3b3643bf99eb57eb5. hebasto: ACK fa1f840596554ed264d11ee3b3643bf99eb57eb5, tested on Linux Mint 19.3. Tree-SHA512: 0838485d1f93f737ce5bf12740669dcafeebb78dbc3fa15dbcc511edce64bf024f60f0497a04149a1e799d893d57b0c9ffe442020c1b9cfc3c69db731f50e712 --- src/wallet/rpcwallet.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 43cec0be5ab77..721c3af64e322 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1583,15 +1583,15 @@ static UniValue listsinceblock(const JSONRPCRequest& request) }, }.Check(request); - std::shared_ptr const wallet = GetWalletForJSONRPCRequest(request); - if (!wallet) return NullUniValue; - const CWallet* const pwallet = wallet.get(); + std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); + if (!pwallet) return NullUniValue; + const CWallet& wallet = *pwallet; // Make sure the results are valid at least up to the most recent block // the user could have gotten from another RPC command prior to now - pwallet->BlockUntilSyncedToCurrentChain(); + wallet.BlockUntilSyncedToCurrentChain(); - LOCK(pwallet->cs_wallet); + LOCK(wallet.cs_wallet); std::optional height; // Height of the specified block or the common ancestor, if the block provided was in a deactivated chain. std::optional altheight; // Height of the specified block, even if it's in a deactivated chain. @@ -1601,9 +1601,9 @@ static UniValue listsinceblock(const JSONRPCRequest& request) uint256 blockId; if (!request.params[0].isNull() && !request.params[0].get_str().empty()) { blockId = ParseHashV(request.params[0], "blockhash"); - height.emplace(); - altheight.emplace(); - if (!pwallet->chain().findCommonAncestor(blockId, pwallet->GetLastBlockHash(), /* ancestor out */ FoundBlock().height(*height), /* blockId out */ FoundBlock().height(*altheight))) { + height = int{}; + altheight = int{}; + if (!wallet.chain().findCommonAncestor(blockId, wallet.GetLastBlockHash(), /* ancestor out */ FoundBlock().height(*height), /* blockId out */ FoundBlock().height(*altheight))) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); } } @@ -1616,21 +1616,21 @@ static UniValue listsinceblock(const JSONRPCRequest& request) } } - if (ParseIncludeWatchonly(request.params[2], *pwallet)) { + if (ParseIncludeWatchonly(request.params[2], wallet)) { filter |= ISMINE_WATCH_ONLY; } bool include_removed = (request.params[3].isNull() || request.params[3].get_bool()); - int depth = height ? pwallet->GetLastBlockHeight() + 1 - *height : -1; + int depth = height ? wallet.GetLastBlockHeight() + 1 - *height : -1; UniValue transactions(UniValue::VARR); - for (const std::pair& pairWtx : pwallet->mapWallet) { + for (const std::pair& pairWtx : wallet.mapWallet) { const CWalletTx& tx = pairWtx.second; if (depth == -1 || abs(tx.GetDepthInMainChain()) < depth) { - ListTransactions(pwallet, tx, 0, true, transactions, filter, nullptr /* filter_label */); + ListTransactions(&wallet, tx, 0, true, transactions, filter, nullptr /* filter_label */); } } @@ -1639,15 +1639,15 @@ static UniValue listsinceblock(const JSONRPCRequest& request) UniValue removed(UniValue::VARR); while (include_removed && altheight && *altheight > *height) { CBlock block; - if (!pwallet->chain().findBlock(blockId, FoundBlock().data(block)) || block.IsNull()) { + if (!wallet.chain().findBlock(blockId, FoundBlock().data(block)) || block.IsNull()) { throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); } for (const CTransactionRef& tx : block.vtx) { - auto it = pwallet->mapWallet.find(tx->GetHash()); - if (it != pwallet->mapWallet.end()) { + auto it = wallet.mapWallet.find(tx->GetHash()); + if (it != wallet.mapWallet.end()) { // We want all transactions regardless of confirmation count to appear here, // even negative confirmation ones, hence the big negative. - ListTransactions(pwallet, it->second, -100000000, true, removed, filter, nullptr /* filter_label */); + ListTransactions(&wallet, it->second, -100000000, true, removed, filter, nullptr /* filter_label */); } } blockId = block.hashPrevBlock; @@ -1655,7 +1655,7 @@ static UniValue listsinceblock(const JSONRPCRequest& request) } uint256 lastblock; - CHECK_NONFATAL(pwallet->chain().findAncestorByHeight(pwallet->GetLastBlockHash(), pwallet->GetLastBlockHeight() + 1 - target_confirms, FoundBlock().hash(lastblock))); + CHECK_NONFATAL(wallet.chain().findAncestorByHeight(wallet.GetLastBlockHash(), wallet.GetLastBlockHeight() + 1 - target_confirms, FoundBlock().hash(lastblock))); UniValue ret(UniValue::VOBJ); ret.pushKV("transactions", transactions); From 41dcede5a5a1446c61c6e2aed321a7dc40af96a0 Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 15 May 2020 07:46:42 +0800 Subject: [PATCH 3/9] Merge #18975: test: Remove const to work around compiler error on xenial 050e2ee6f28e7b31c167013be7313726e34084e9 test: Remove const to work around compiler error on xenial (Wladimir J. van der Laan) Pull request description: Fix the following error in travis: test/validationinterface_tests.cpp:26:36: error: default initialization of an object of const type 'const BlockValidationState' without a user-provided default constructor const BlockValidationState state_dummy; ACKs for top commit: MarcoFalke: Tested ACK 050e2ee6f28e7b31c167013be7313726e34084e9 on xenial with clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) fanquake: ACK 050e2ee6f28e7b31c167013be7313726e34084e9 - I see why we didn't hit this on master. We are installing the `clang-8` packages for the tsan job. However on the 0.20 branch we are still just installing `clang`, which is 3.8. Tree-SHA512: 8a1d57289dbe9895ab79f81ca87b4fd723426b8d72f3a34bec9553226fba69f6dc19551c1f1d52db6c4b2652164a02ddc60f3187c3e2ad7bcacb0aaca7fa690a --- src/test/validationinterface_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/validationinterface_tests.cpp b/src/test/validationinterface_tests.cpp index 1e935a0ba1b05..11f8c5a53ee99 100644 --- a/src/test/validationinterface_tests.cpp +++ b/src/test/validationinterface_tests.cpp @@ -23,7 +23,7 @@ BOOST_AUTO_TEST_CASE(unregister_validation_interface_race) // Start thread to generate notifications std::thread gen{[&] { const CBlock block_dummy; - const BlockValidationState state_dummy; + BlockValidationState state_dummy; while (generate) { GetMainSignals().BlockChecked(block_dummy, state_dummy); } From 061f2b57c81b3f1e74605ad880e237f3b955687f Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 19 May 2020 08:54:18 -0400 Subject: [PATCH 4/9] Merge #17946: Fix GBT: Restore "!segwit" and "csv" to "rules" key 412d5fe8791c417bf46fc55a5bb8d59be98a33db QA: feature_segwit: Check that template "rules" includes "!segwit" as appropriate (Luke Dashjr) 2abe8cc3b760219cfa434e4c96e9f8d3611d0037 Bugfix: Include "csv","!segwit" in "rules" (Luke Dashjr) Pull request description: #16060 removed CSV & segwit from versionbits, breaking the "rules" key returned by GBT. Without this, miners don't know they're mining segwit blocks, and should fall back to pre-segwit block creation. ACKs for top commit: sipa: ACK 412d5fe8791c417bf46fc55a5bb8d59be98a33db jnewbery: Tested ACK 412d5fe8791c417bf46fc55a5bb8d59be98a33db. Tree-SHA512: 825d72e257dc0dd4941f2fe498d8d4f4f2a21b9505cd21a8f9eb7fb5d6d7dd9219347928cf90bb57a777920ce24295859763e64fa8a22ebb58fc2380f80f5615 --- src/rpc/mining.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 9d4415275c65f..6f027d18be9ed 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -849,6 +849,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) result.pushKV("capabilities", aCaps); UniValue aRules(UniValue::VARR); + aRules.push_back("csv"); UniValue vbavailable(UniValue::VOBJ); for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) { Consensus::DeploymentPos pos = Consensus::DeploymentPos(j); From f2790a8e8b8d67e70b0bf54373d5b7b601ade7ac Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 27 May 2020 07:15:53 -0400 Subject: [PATCH 5/9] Merge #19004: refactor: Replace const char* to std::string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit c57f03ce1741b38af448bec7b22ab9f8ac21f067 refactor: Replace const char* to std::string (Calvin Kim) Pull request description: Rationale: Addresses #19000 Some functions should be returning std::string instead of const char*. This commit changes that. Main benefits/reasoning: 1. The functions never return nullptr, so returning a string makes code at call sites easier to review (reviewers don't have to read the source code to verify that a nullptr is never returned) 2. All call sites convert to string anyway ACKs for top commit: MarcoFalke: re-ACK c57f03ce17 (no changes since previous review) 🚃 Empact: Fair enough, Code Review ACK https://github.com/bitcoin/bitcoin/pull/19004/commits/c57f03ce1741b38af448bec7b22ab9f8ac21f067 practicalswift: ACK c57f03ce1741b38af448bec7b22ab9f8ac21f067 -- patch looks correct hebasto: re-ACK c57f03ce1741b38af448bec7b22ab9f8ac21f067 Tree-SHA512: 9ce99bb38fe399b54844315048204cafce0f27fd8f24cae357fa7ac6f5d8094d57bbf5f5c1f5878a65f2d35e4a3f95d527eb17f49250b690c591c0df86ca84fd --- src/bitcoin-cli.cpp | 3 ++- src/core_read.cpp | 6 +++--- src/script/script.cpp | 4 +++- src/script/script.h | 2 +- src/script/script_error.cpp | 4 +++- src/script/script_error.h | 4 +++- src/script/standard.cpp | 6 ++++-- src/script/standard.h | 4 +++- src/test/script_tests.cpp | 4 ++-- 9 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 9c2e0518b290e..af24fb55b8e0e 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -172,7 +173,7 @@ struct HTTPReply std::string body; }; -static const char *http_errorstring(int code) +static std::string http_errorstring(int code) { switch(code) { #if LIBEVENT_VERSION_NUMBER >= 0x02010300 diff --git a/src/core_read.cpp b/src/core_read.cpp index cbd31f55a52db..f0232b7902573 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -16,6 +16,7 @@ #include #include +#include namespace { @@ -31,10 +32,9 @@ opcodetype ParseOpCode(const std::string& s) if (op < OP_NOP && op != OP_RESERVED) continue; - const char* name = GetOpName(static_cast(op)); - if (strcmp(name, "OP_UNKNOWN") == 0) + std::string strName = GetOpName(static_cast(op)); + if (strName == "OP_UNKNOWN") continue; - std::string strName(name); mapOpNames[strName] = static_cast(op); // Convenience: OP_ADD and just ADD are both recognized: if (strName.compare(0, 3, "OP_") == 0) { // strName starts with "OP_" diff --git a/src/script/script.cpp b/src/script/script.cpp index 4c3f7091de2fa..900e4e7ee5eaf 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -6,7 +6,9 @@ #include