diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-12-02 09:29:53 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-12-02 09:30:08 +0100 |
commit | 5baaea4410a1cafb4381c2bf95b5ae9e465a7214 (patch) | |
tree | ac0716e069be5f60c4a837fd0fb6e685a62e1914 | |
parent | aee9d2306ad1e1eed24dc57d181c75bd2344291d (diff) | |
parent | 9c714993e9dba2f08c2c89cf06ad8fecd528ad1b (diff) |
Merge #20150: [0.19] Backports
9c714993e9dba2f08c2c89cf06ad8fecd528ad1b rpc: Adjust witness-tx deserialize error message (MarcoFalke)
a7bdf5c3ac360a918d398a775c2de21d1e2ed639 rpc: Properly deserialize txs with witness before signing (MarcoFalke)
0b64310fb6f1816a4ceba99eadb532c30ba867d5 Avoid the use of abs64 in timedata (Pieter Wuille)
5b2de04e7f37043d850bd89554789d5b86f6b735 Bump vcpkg commit ID to get new msys mirror list (Aaron Clauson)
6957419a28ec3a129177fbdabcae48889a8bbab0 build: set minimum required Boost to 1.48.0 (fanquake)
27bb2cc3b6053f94b38934748127bc73f87618ad util: Don't reference errno when pthread fails. (MIZUTA Takeshi)
8bd2ab1f35f1b3f618fa801debf844eb164a2bd6 docs: Correct description for getblockstats's txs field (Nadav Ivgi)
a8411b3d9c37b4c6fcf0ab992d3f622f6bda879b qt: Fix QFileDialog for static builds (Hennadii Stepanov)
Pull request description:
Backports the following to the 0.19 branch:
* https://github.com/bitcoin/bitcoin/pull/19194 - util: Don't reference errno when pthread fails. - not clean.
* https://github.com/bitcoin/bitcoin/pull/19536 - qt, build: Fix QFileDialog for static builds
* https://github.com/bitcoin/bitcoin/pull/19777 - docs: Correct description for getblockstats's txs field
* https://github.com/bitcoin/bitcoin/pull/19836 - rpc: Properly deserialize txs with witness before signing
* https://github.com/bitcoin/bitcoin/pull/20095 - CI: Bump vcpkg commit ID to get new msys mirror list
* https://github.com/bitcoin/bitcoin/pull/20141 - Avoid the use of abs64 in timedata
* https://github.com/bitcoin/bitcoin/pull/20142 - [0.20] build: set minimum required Boost to 1.48.0
ACKs for top commit:
jnewbery:
utACK 9c714993e9dba2f08c2c89cf06ad8fecd528ad1b
dergoegge:
utACK 9c714993e9dba2f08c2c89cf06ad8fecd528ad1b
MarcoFalke:
ACK 9c714993e9dba2f08c2c89cf06ad8fecd528ad1b
Tree-SHA512: 2151f22bc37a6a2f51a8f36c27376622016b51ff99b570e95354356fce1f1761cf19cb4f8ebfa26d38485a0bff6ff6ee834d2798fb383e2ae2abb175548b8fe6
-rw-r--r-- | .appveyor.yml | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | depends/packages/qt.mk | 1 | ||||
-rw-r--r-- | doc/dependencies.md | 2 | ||||
-rw-r--r-- | src/rpc/blockchain.cpp | 2 | ||||
-rw-r--r-- | src/rpc/rawtransaction.cpp | 16 | ||||
-rw-r--r-- | src/timedata.cpp | 14 | ||||
-rw-r--r-- | src/util/system.cpp | 7 | ||||
-rw-r--r-- | src/wallet/rpcdump.cpp | 5 | ||||
-rw-r--r-- | src/wallet/rpcwallet.cpp | 4 |
10 files changed, 26 insertions, 29 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 443913672e..0ecaa7709e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,7 +11,7 @@ environment: QT_DOWNLOAD_HASH: '9a8c6eb20967873785057fdcd329a657c7f922b0af08c5fde105cc597dd37e21' QT_LOCAL_PATH: 'C:\Qt5.9.8_x64_static_vs2019' VCPKG_INSTALL_PATH: 'C:\tools\vcpkg\installed' - VCPKG_COMMIT_ID: 'ed0df8ecc4ed7e755ea03e18aaf285fd9b4b4a74' + VCPKG_COMMIT_ID: '40230b8e3f6368dcb398d649331be878ca1e9007' install: # Disable zmq test for now since python zmq library on Windows would cause Access violation sometimes. # - cmd: pip install zmq diff --git a/configure.ac b/configure.ac index ad6de55561..dd49c2f672 100644 --- a/configure.ac +++ b/configure.ac @@ -1055,7 +1055,7 @@ fi if test x$use_boost = xyes; then dnl Minimum required Boost version -define(MINIMUM_REQUIRED_BOOST, 1.47.0) +define(MINIMUM_REQUIRED_BOOST, 1.48.0) dnl Check for boost libs AX_BOOST_BASE([MINIMUM_REQUIRED_BOOST]) diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index f4832b6168..cdafbfc936 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -76,7 +76,6 @@ $(package)_config_opts += -no-feature-colordialog $(package)_config_opts += -no-feature-commandlineparser $(package)_config_opts += -no-feature-concurrent $(package)_config_opts += -no-feature-dial -$(package)_config_opts += -no-feature-filesystemwatcher $(package)_config_opts += -no-feature-fontcombobox $(package)_config_opts += -no-feature-ftp $(package)_config_opts += -no-feature-image_heuristic_mask diff --git a/doc/dependencies.md b/doc/dependencies.md index ae3d26839f..f814f07c14 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -6,7 +6,7 @@ These are the dependencies currently used by Bitcoin Core. You can find instruct | Dependency | Version used | Minimum required | CVEs | Shared | [Bundled Qt library](https://doc.qt.io/qt-5/configure-options.html#third-party-libraries) | | --- | --- | --- | --- | --- | --- | | Berkeley DB | [4.8.30](https://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html) | 4.8.x | No | | | -| Boost | [1.70.0](https://www.boost.org/users/download/) | [1.47.0](https://github.com/bitcoin/bitcoin/pull/8920) | No | | | +| Boost | [1.70.0](https://www.boost.org/users/download/) | [1.48.0](https://github.com/bitcoin/bitcoin/pull/20142) | No | | | | Clang | | [3.3+](https://releases.llvm.org/download.html) (C++11 support) | | | | | Expat | [2.2.7](https://libexpat.github.io/) | | No | Yes | | | fontconfig | [2.12.1](https://www.freedesktop.org/software/fontconfig/release/) | | No | Yes | | diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index ad5be71e21..7c08c0a45f 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1717,7 +1717,7 @@ static UniValue getblockstats(const JSONRPCRequest& request) " \"90th_percentile_feerate\", (numeric) The 90th percentile feerate\n" " ],\n" " \"height\": xxxxx, (numeric) The height of the block\n" - " \"ins\": xxxxx, (numeric) The number of inputs (excluding coinbase)\n" + " \"ins\": xxxxx, (numeric) The number of inputs (including coinbase)\n" " \"maxfee\": xxxxx, (numeric) Maximum fee in the block\n" " \"maxfeerate\": xxxxx, (numeric) Maximum feerate (in satoshis per virtual byte)\n" " \"maxtxsize\": xxxxx, (numeric) Maximum transaction size\n" diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 3b202d6538..b155a3289d 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -619,8 +619,8 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request) std::vector<CMutableTransaction> txVariants(txs.size()); for (unsigned int idx = 0; idx < txs.size(); idx++) { - if (!DecodeHexTx(txVariants[idx], txs[idx].get_str(), true)) { - throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed for tx %d", idx)); + if (!DecodeHexTx(txVariants[idx], txs[idx].get_str())) { + throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed for tx %d. Make sure the tx has at least one input.", idx)); } } @@ -738,8 +738,8 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request) RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VARR, UniValue::VSTR}, true); CMutableTransaction mtx; - if (!DecodeHexTx(mtx, request.params[0].get_str(), true)) { - throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); + if (!DecodeHexTx(mtx, request.params[0].get_str())) { + throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input."); } FillableSigningProvider keystore; @@ -800,10 +800,10 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request) UniValueType(), // NUM or BOOL, checked later }); - // parse hex string from parameter CMutableTransaction mtx; - if (!DecodeHexTx(mtx, request.params[0].get_str())) - throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); + if (!DecodeHexTx(mtx, request.params[0].get_str())) { + throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input."); + } CTransactionRef tx(MakeTransactionRef(std::move(mtx))); CFeeRate max_raw_tx_fee_rate = DEFAULT_MAX_RAW_TX_FEE_RATE; @@ -875,7 +875,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request) CMutableTransaction mtx; if (!DecodeHexTx(mtx, request.params[0].get_array()[0].get_str())) { - throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); + throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input."); } CTransactionRef tx(MakeTransactionRef(std::move(mtx))); const uint256& tx_hash = tx->GetHash(); diff --git a/src/timedata.cpp b/src/timedata.cpp index 9458b9ae0c..0c6698d87a 100644 --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -37,11 +37,6 @@ int64_t GetAdjustedTime() return GetTime() + GetTimeOffset(); } -static int64_t abs64(int64_t n) -{ - return (n >= 0 ? n : -n); -} - #define BITCOIN_TIMEDATA_MAX_SAMPLES 200 void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample) @@ -81,8 +76,8 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample) int64_t nMedian = vTimeOffsets.median(); std::vector<int64_t> vSorted = vTimeOffsets.sorted(); // Only let other nodes change our time by so much - if (abs64(nMedian) <= std::max<int64_t>(0, gArgs.GetArg("-maxtimeadjustment", DEFAULT_MAX_TIME_ADJUSTMENT))) - { + int64_t max_adjustment = std::max<int64_t>(0, gArgs.GetArg("-maxtimeadjustment", DEFAULT_MAX_TIME_ADJUSTMENT)); + if (nMedian >= -max_adjustment && nMedian <= max_adjustment) { nTimeOffset = nMedian; } else @@ -94,9 +89,10 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample) { // If nobody has a time different than ours but within 5 minutes of ours, give a warning bool fMatch = false; - for (const int64_t nOffset : vSorted) - if (nOffset != 0 && abs64(nOffset) < 5 * 60) + for (const int64_t nOffset : vSorted) { + if (nOffset != 0 && nOffset > -5 * 60 && nOffset < 5 * 60) fMatch = true; + } if (!fMatch) { diff --git a/src/util/system.cpp b/src/util/system.cpp index 5a3c68aa0c..db1d032916 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -1236,9 +1236,10 @@ int ScheduleBatchPriority() { #ifdef SCHED_BATCH const static sched_param param{}; - if (int ret = pthread_setschedparam(pthread_self(), SCHED_BATCH, ¶m)) { - LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(errno)); - return ret; + const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, ¶m); + if (rc != 0) { + LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(rc)); + return rc; } return 0; #else diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index f52e4318c8..5cfc6cfea2 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -353,8 +353,9 @@ UniValue importprunedfunds(const JSONRPCRequest& request) }.Check(request); CMutableTransaction tx; - if (!DecodeHexTx(tx, request.params[0].get_str())) - throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); + if (!DecodeHexTx(tx, request.params[0].get_str())) { + throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input."); + } uint256 hashTx = tx.GetHash(); CWalletTx wtx(pwallet, MakeTransactionRef(std::move(tx))); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index fe004a862d..4113c14ce4 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3269,8 +3269,8 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request) RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VSTR}, true); CMutableTransaction mtx; - if (!DecodeHexTx(mtx, request.params[0].get_str(), true)) { - throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); + if (!DecodeHexTx(mtx, request.params[0].get_str())) { + throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed. Make sure the tx has at least one input."); } // Sign the transaction |