From e32f0d5d86abd5f101d30ec991545e215b9365f9 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 8 Jan 2020 15:07:34 +0100 Subject: [PATCH] Merge #17858: [0.19] Backports 99b54076ff2d2dd357dafb9f0275713cd8d0111f scripts: fix check-symbols & check-security argument passing (fanquake) 4330a1ee7fdbf97ce466c442936ed04c13f229e2 Update msvc build for Visual Studio 2019 v16.4 (Aaron Clauson) b0f9b8e648733c3c5196fbb85fade88fa7ba9449 Moves vcpkg list to a text file and updates the appveyor job and readme to use it. (Aaron Clauson) cd7b3b254a9d782667c751ade64c329edc30ecbb Updated appveyor config: - Update build image from Visual Studio 2017 to Visual Studio 2019. - Updated Qt static library from Qt5.9.7 to Qt5.9.8. - Added commands to update vcpkg port files (this does not update already installed packages). - Updated vcpkg package list as per #17309. - Removed commands setting common project file options. Now done via common.init.vcxproj include. - Changed msbuild verbosity from normal to quiet. Normal rights a LOT of logs and impacts appveyor job duration. Updated msvc project configs: - Updated platform toolset from v141 to v142. - Updated Qt static library from Qt5.9.7 to Qt5.9.8. - Added ignore for linker warning building bitcoin-qt program. - Added missing util/str.cpp class file to test_bitcoin project file. (Aaron Clauson) 112144dc524b6f4df5c88ab067e899d858f6461d Add missing typeinfo includes (Wladimir J. van der Laan) 1a6a534665be410988785b0f2e09ef001a612d5c net: Log to net category for exceptions in ProcessMessages (Wladimir J. van der Laan) c0dc7282068b370591e89c630c44bc43bbae38a5 test: fix bitcoind already running warnings on macOS (fanquake) 5276b0e5a2e2a12c7e038a44847fe79d7afc2944 util: Add missing headers to util/fees.cpp (Hennadii Stepanov) 4d7875c55500368336992d66b296ba5ee01c0932 rpc: require second argument only for scantxoutset start action (Andrew Chow) bda2f5b3c9aa4d87e33f7af13f7a1ae5b6b4fa11 cli: fix Fatal LevelDB error when specifying -blockfilterindex=basic twice (Harris) d14ab7c522d7b6912af0c7eee006822ff535f9df gui: disable File->CreateWallet during startup (fanquake) b9f1bc0fc17a3a457b2c1fcd47dd0b676b893558 wallet: unbreak with boost 1.72 (Jan Beich) Pull request description: Backports the following PRs to the 0.19 branch: * https://github.com/bitcoin/bitcoin/pull/17654 - Unbreak build with Boost 1.72.0 * https://github.com/bitcoin/bitcoin/pull/17695 - gui: disable File->CreateWallet during startup * https://github.com/bitcoin/bitcoin/pull/17687 - cli: fix Fatal LevelDB error when specifying -blockfilterindex=basic twice * https://github.com/bitcoin/bitcoin/pull/17728 - rpc: require second argument only for scantxoutset start action * https://github.com/bitcoin/bitcoin/pull/17450 - util: Add missing headers to util/fees.cpp * https://github.com/bitcoin/bitcoin/pull/17488 - test: fix "bitcoind already running" warnings on macOS * https://github.com/bitcoin/bitcoin/pull/17762 - Log to net category for exceptions in ProcessMessages * https://github.com/bitcoin/bitcoin/pull/17364 - Updates to appveyor config for VS2019 and Qt5.9.8 + msvc project fixes * https://github.com/bitcoin/bitcoin/pull/17416 - Appveyor improvement - text file for vcpkg package list * https://github.com/bitcoin/bitcoin/pull/17736 - Update msvc build for Visual Studio 2019 v16.4 * https://github.com/bitcoin/bitcoin/pull/17857 - scripts: fix symbol-check & security-check argument passing Fixes #17856. ACKs for top commit: sipsorcery: ACK (tested: Windows 10 & msvc build) 99b54076ff2d2dd357dafb9f0275713cd8d0111f. Tree-SHA512: 91313de56fb0825e70a4be30ba0bf561b8c26d7dcf60549185df4f5e3524099398c828bb46faae807b631634d1afd5a1d397fb41e61ecfa0d746e4bf10b923cb --- src/Makefile.am | 4 ++-- src/net_processing.cpp | 29 ++++------------------------- src/rpc/blockchain.cpp | 7 ++++++- src/util/system.cpp | 1 + test/functional/rpc_scantxoutset.py | 4 ++++ test/functional/test_runner.py | 3 ++- 6 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 410113a8a9d861..ab706c4e292cbc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -869,13 +869,13 @@ clean-local: check-symbols: $(bin_PROGRAMS) if GLIBC_BACK_COMPAT @echo "Checking glibc back compat..." - $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(PYTHON) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS) + $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(PYTHON) $(top_srcdir)/contrib/devtools/symbol-check.py $(bin_PROGRAMS) endif check-security: $(bin_PROGRAMS) if HARDEN @echo "Checking binary security..." - $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(PYTHON) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS) + $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(PYTHON) $(top_srcdir)/contrib/devtools/security-check.py $(bin_PROGRAMS) endif diff --git a/src/net_processing.cpp b/src/net_processing.cpp index e0d03c21c08841..4df126b61f966a 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -4074,32 +4075,10 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic& inter return false; if (!pfrom->vRecvGetData.empty()) fMoreWork = true; - } - catch (const std::ios_base::failure& e) - { - if (m_enable_bip61) { - connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_MALFORMED, std::string("error parsing message"))); - } - if (strstr(e.what(), "end of data")) { - // Allow exceptions from under-length message on vRecv - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught, normally caused by a message being shorter than its stated length\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else if (strstr(e.what(), "size too large")) { - // Allow exceptions from over-long size - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else if (strstr(e.what(), "non-canonical ReadCompactSize()")) { - // Allow exceptions from non-canonical encoding - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else if (strstr(e.what(), "Superfluous witness record")) { - // Allow exceptions from illegal witness encoding - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else if (strstr(e.what(), "Unknown transaction optional data")) { - // Allow exceptions from unknown witness encoding - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else { - PrintExceptionContinue(std::current_exception(), "ProcessMessages()"); - } + } catch (const std::exception& e) { + LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' (%s) caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what(), typeid(e).name()); } catch (...) { - PrintExceptionContinue(std::current_exception(), "ProcessMessages()"); + LogPrint(BCLog::NET, "%s(%s, %u bytes): Unknown exception caught\n", __func__, SanitizeString(strCommand), nMessageSize); } if (!fRet) { diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index b8f0518805cab6..70c0b1e643d966 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2485,7 +2485,7 @@ UniValue scantxoutset(const JSONRPCRequest& request) " \"start\" for starting a scan\n" " \"abort\" for aborting the current scan (returns true when abort was successful)\n" " \"status\" for progress report (in %) of the current scan"}, - {"scanobjects", RPCArg::Type::ARR, RPCArg::Optional::NO, "Array of scan objects\n" + {"scanobjects", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "Array of scan objects. Required for \"start\" action\n" " Every scan object is either a string descriptor or an object:", { {"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "An output descriptor"}, @@ -2542,6 +2542,11 @@ UniValue scantxoutset(const JSONRPCRequest& request) if (!reserver.reserve()) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Scan already in progress, use action \"abort\" or \"status\""); } + + if (request.params.size() < 2) { + throw JSONRPCError(RPC_MISC_ERROR, "scanobjects argument is required for the start action"); + } + std::set needles; std::map descriptors; CAmount total_in = 0; diff --git a/src/util/system.cpp b/src/util/system.cpp index 529acb5d808882..55a468e65a0a36 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -75,6 +75,7 @@ #endif #include +#include // Application startup time (used for uptime calculation) const int64_t nStartupTime = GetTime(); diff --git a/test/functional/rpc_scantxoutset.py b/test/functional/rpc_scantxoutset.py index 1316d578f6f977..965425f6a7e0fb 100755 --- a/test/functional/rpc_scantxoutset.py +++ b/test/functional/rpc_scantxoutset.py @@ -99,5 +99,9 @@ def run_test(self): assert_equal(descriptors(self.nodes[0].scantxoutset("start", [ "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/0)"])), ["pkh([0c5f9a1e/1/1/0]03e1c5b6e650966971d7e71ef2674f80222752740fc1dfd63bbbd220d2da9bd0fb)#cxmct4w8"]) assert_equal(descriptors(self.nodes[0].scantxoutset("start", [ {"desc": "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/*)", "range": 1500}])), ['pkh([0c5f9a1e/1/1/0]03e1c5b6e650966971d7e71ef2674f80222752740fc1dfd63bbbd220d2da9bd0fb)#cxmct4w8', 'pkh([0c5f9a1e/1/1/1500]03832901c250025da2aebae2bfb38d5c703a57ab66ad477f9c578bfbcd78abca6f)#vchwd07g', 'pkh([0c5f9a1e/1/1/1]030d820fc9e8211c4169be8530efbc632775d8286167afd178caaf1089b77daba7)#z2t3ypsa']) + # Check that status and abort don't need second arg + assert_equal(self.nodes[0].scantxoutset("status"), None) + assert_equal(self.nodes[0].scantxoutset("abort"), False) + if __name__ == '__main__': ScantxoutsetTest().main() diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 431ab9a0396620..2d5ccd7320efa4 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -370,7 +370,8 @@ def main(): def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0,failfast=False, runs_ci=False): args = args or [] - # Warn if dashd is already running (unix only) + # Warn if dashd is already running + # pidof might fail or return an empty string if bitcoind is not running try: pidof_output = subprocess.check_output(["pidof", "dashd"]) if not (pidof_output is None or pidof_output == b''):