diff options
34 files changed, 122 insertions, 54 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index c4aae3a50a..ccf7077546 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -324,7 +324,7 @@ task: << : *BASE_TEMPLATE android_sdk_cache: folder: "depends/SDKs/android" - fingerprint_key: "ANDROID_API_LEVEL=28 ANDROID_BUILD_TOOLS_VERSION=28.0.3 ANDROID_NDK_VERSION=23.1.7779620" + fingerprint_key: "ANDROID_API_LEVEL=28 ANDROID_BUILD_TOOLS_VERSION=28.0.3 ANDROID_NDK_VERSION=23.2.8568313" depends_sources_cache: folder: "depends/sources" fingerprint_script: git rev-list -1 HEAD ./depends diff --git a/ci/lint/06_script.sh b/ci/lint/06_script.sh index f174b4d074..84b3404e78 100755 --- a/ci/lint/06_script.sh +++ b/ci/lint/06_script.sh @@ -22,7 +22,7 @@ test/lint/git-subtree-check.sh src/univalue test/lint/git-subtree-check.sh src/leveldb test/lint/git-subtree-check.sh src/crc32c test/lint/check-doc.py -test/lint/lint-all.py +test/lint/all-lint.py if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; then # Sanity check only the last few commits to get notified of missing sigs, diff --git a/ci/test/00_setup_env_android.sh b/ci/test/00_setup_env_android.sh index 522a5497fa..6732db36ad 100755 --- a/ci/test/00_setup_env_android.sh +++ b/ci/test/00_setup_env_android.sh @@ -7,7 +7,7 @@ export LC_ALL=C.UTF-8 export HOST=aarch64-linux-android -export PACKAGES="clang llvm unzip openjdk-8-jdk gradle" +export PACKAGES="unzip openjdk-8-jdk gradle" export CONTAINER_NAME=ci_android export DOCKER_NAME_TAG="ubuntu:focal" @@ -16,8 +16,8 @@ export RUN_FUNCTIONAL_TESTS=false export ANDROID_API_LEVEL=28 export ANDROID_BUILD_TOOLS_VERSION=28.0.3 -export ANDROID_NDK_VERSION=23.1.7779620 -export ANDROID_TOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip +export ANDROID_NDK_VERSION=23.2.8568313 +export ANDROID_TOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip export ANDROID_HOME="${DEPENDS_DIR}/SDKs/android" export ANDROID_NDK_HOME="${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}" export DEP_OPTS="ANDROID_SDK=${ANDROID_HOME} ANDROID_NDK=${ANDROID_NDK_HOME} ANDROID_API_LEVEL=${ANDROID_API_LEVEL} ANDROID_TOOLCHAIN_BIN=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/" diff --git a/ci/test/05_before_script.sh b/ci/test/05_before_script.sh index fc2f76797c..f3da6b4f31 100755 --- a/ci/test/05_before_script.sh +++ b/ci/test/05_before_script.sh @@ -31,9 +31,9 @@ if [ -n "$ANDROID_HOME" ] && [ ! -d "$ANDROID_HOME" ]; then if [ ! -f "$ANDROID_TOOLS_PATH" ]; then CI_EXEC curl --location --fail "${ANDROID_TOOLS_URL}" -o "$ANDROID_TOOLS_PATH" fi - CI_EXEC mkdir -p "${ANDROID_HOME}/cmdline-tools" - CI_EXEC unzip -o "$ANDROID_TOOLS_PATH" -d "${ANDROID_HOME}/cmdline-tools" - CI_EXEC "yes | ${ANDROID_HOME}/cmdline-tools/tools/bin/sdkmanager --install \"build-tools;${ANDROID_BUILD_TOOLS_VERSION}\" \"platform-tools\" \"platforms;android-${ANDROID_API_LEVEL}\" \"ndk;${ANDROID_NDK_VERSION}\"" + CI_EXEC mkdir -p "$ANDROID_HOME" + CI_EXEC unzip -o "$ANDROID_TOOLS_PATH" -d "$ANDROID_HOME" + CI_EXEC "yes | ${ANDROID_HOME}/cmdline-tools/bin/sdkmanager --sdk_root=\"${ANDROID_HOME}\" --install \"build-tools;${ANDROID_BUILD_TOOLS_VERSION}\" \"platform-tools\" \"platforms;android-${ANDROID_API_LEVEL}\" \"ndk;${ANDROID_NDK_VERSION}\"" fi if [ -z "$NO_DEPENDS" ]; then diff --git a/ci/test/06_script_a.sh b/ci/test/06_script_a.sh index 6a6bde05a1..218f5eeb63 100755 --- a/ci/test/06_script_a.sh +++ b/ci/test/06_script_a.sh @@ -6,18 +6,20 @@ export LC_ALL=C.UTF-8 +BITCOIN_CONFIG_ALL="--enable-suppress-external-warnings --disable-dependency-tracking --prefix=$DEPENDS_DIR/$HOST" +if [ -z "$NO_WERROR" ]; then + BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-werror" +fi + if [ -n "$ANDROID_TOOLS_URL" ]; then CI_EXEC make distclean || true CI_EXEC ./autogen.sh - CI_EXEC ./configure "$BITCOIN_CONFIG" --prefix="${DEPENDS_DIR}/aarch64-linux-android" || ( (CI_EXEC cat config.log) && false) + CI_EXEC ./configure "$BITCOIN_CONFIG_ALL" "$BITCOIN_CONFIG" || ( (CI_EXEC cat config.log) && false) CI_EXEC "make $MAKEJOBS && cd src/qt && ANDROID_HOME=${ANDROID_HOME} ANDROID_NDK_HOME=${ANDROID_NDK_HOME} make apk" exit 0 fi -BITCOIN_CONFIG_ALL="--enable-external-signer --enable-suppress-external-warnings --disable-dependency-tracking --prefix=$DEPENDS_DIR/$HOST --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib" -if [ -z "$NO_WERROR" ]; then - BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-werror" -fi +BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-external-signer --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib" CI_EXEC "ccache --zero-stats --max-size=$CCACHE_SIZE" if [ -n "$CONFIG_SHELL" ]; then diff --git a/ci/test/06_script_b.sh b/ci/test/06_script_b.sh index e64af2ad5d..bdb68e0f6f 100755 --- a/ci/test/06_script_b.sh +++ b/ci/test/06_script_b.sh @@ -41,6 +41,9 @@ if [ "${RUN_TIDY}" = "true" ]; then CI_EXEC "python3 ${DIR_IWYU}/include-what-you-use/iwyu_tool.py"\ " src/compat"\ " src/init"\ + " src/policy/feerate.cpp"\ + " src/policy/packages.cpp"\ + " src/policy/settings.cpp"\ " src/rpc/fees.cpp"\ " src/rpc/signmessage.cpp"\ " -p . ${MAKEJOBS} -- -Xiwyu --cxx17ns -Xiwyu --mapping_file=${BASE_BUILD_DIR}/bitcoin-$HOST/contrib/devtools/iwyu/bitcoin.core.imp" diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 70b81b3eb2..30d5548385 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -21,6 +21,7 @@ #include <node/blockstorage.h> #include <policy/fees.h> #include <policy/policy.h> +#include <policy/settings.h> #include <primitives/block.h> #include <primitives/transaction.h> #include <random.h> diff --git a/src/policy/feerate.cpp b/src/policy/feerate.cpp index 0ea56d8db7..82b767793d 100644 --- a/src/policy/feerate.cpp +++ b/src/policy/feerate.cpp @@ -3,8 +3,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include <consensus/amount.h> #include <policy/feerate.h> - #include <tinyformat.h> #include <cmath> diff --git a/src/policy/feerate.h b/src/policy/feerate.h index 50fd6fd11b..a8d4d2fc63 100644 --- a/src/policy/feerate.h +++ b/src/policy/feerate.h @@ -9,7 +9,10 @@ #include <consensus/amount.h> #include <serialize.h> + +#include <cstdint> #include <string> +#include <type_traits> const std::string CURRENCY_UNIT = "BTC"; // One formatted unit const std::string CURRENCY_ATOM = "sat"; // One indivisible minimum value unit diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index d2deaf69d0..b39632364f 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -6,12 +6,30 @@ #include <policy/fees.h> #include <clientversion.h> +#include <consensus/amount.h> #include <fs.h> #include <logging.h> +#include <policy/feerate.h> +#include <primitives/transaction.h> +#include <random.h> +#include <serialize.h> #include <streams.h> +#include <sync.h> +#include <tinyformat.h> #include <txmempool.h> +#include <uint256.h> #include <util/serfloat.h> #include <util/system.h> +#include <util/time.h> + +#include <algorithm> +#include <cassert> +#include <cmath> +#include <cstddef> +#include <cstdint> +#include <exception> +#include <stdexcept> +#include <utility> static const char* FEE_ESTIMATES_FILENAME = "fee_estimates.dat"; diff --git a/src/policy/fees.h b/src/policy/fees.h index 6e25bb42b8..dea1e1d31b 100644 --- a/src/policy/fees.h +++ b/src/policy/fees.h @@ -7,20 +7,20 @@ #include <consensus/amount.h> #include <policy/feerate.h> -#include <uint256.h> #include <random.h> #include <sync.h> +#include <threadsafety.h> +#include <uint256.h> #include <array> #include <map> #include <memory> +#include <set> #include <string> #include <vector> class CAutoFile; -class CFeeRate; class CTxMemPoolEntry; -class CTxMemPool; class TxConfirmStats; /* Identifier for each of the 3 different TxConfirmStats which will track diff --git a/src/policy/packages.cpp b/src/policy/packages.cpp index 21f5488816..67918c9dec 100644 --- a/src/policy/packages.cpp +++ b/src/policy/packages.cpp @@ -2,12 +2,16 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include <consensus/validation.h> #include <policy/packages.h> +#include <policy/policy.h> #include <primitives/transaction.h> #include <uint256.h> #include <util/hasher.h> +#include <algorithm> +#include <cassert> +#include <iterator> +#include <memory> #include <numeric> #include <unordered_set> diff --git a/src/policy/packages.h b/src/policy/packages.h index 9f274f6b7d..ba6a3a9a06 100644 --- a/src/policy/packages.h +++ b/src/policy/packages.h @@ -5,10 +5,12 @@ #ifndef BITCOIN_POLICY_PACKAGES_H #define BITCOIN_POLICY_PACKAGES_H +#include <consensus/consensus.h> #include <consensus/validation.h> #include <policy/policy.h> #include <primitives/transaction.h> +#include <cstdint> #include <vector> /** Default maximum number of transactions in a package. */ diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index 6aba6a4a5b..f6452266b7 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -7,10 +7,22 @@ #include <policy/policy.h> -#include <consensus/validation.h> #include <coins.h> +#include <consensus/amount.h> +#include <consensus/consensus.h> +#include <consensus/validation.h> +#include <policy/feerate.h> +#include <primitives/transaction.h> +#include <script/interpreter.h> +#include <script/script.h> +#include <script/standard.h> +#include <serialize.h> #include <span.h> +#include <algorithm> +#include <cstddef> +#include <vector> + CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFeeIn) { // "Dust" is defined in terms of dustRelayFee, diff --git a/src/policy/policy.h b/src/policy/policy.h index 89f6e72618..94f9623b8a 100644 --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -6,15 +6,18 @@ #ifndef BITCOIN_POLICY_POLICY_H #define BITCOIN_POLICY_POLICY_H +#include <consensus/amount.h> #include <consensus/consensus.h> -#include <policy/feerate.h> +#include <primitives/transaction.h> #include <script/interpreter.h> #include <script/standard.h> +#include <cstdint> #include <string> class CCoinsViewCache; -class CTxOut; +class CFeeRate; +class CScript; /** Default for -blockmaxweight, which controls the range of block weights the mining code will create **/ static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = MAX_BLOCK_WEIGHT - 4000; @@ -52,6 +55,8 @@ static const unsigned int MAX_STANDARD_SCRIPTSIG_SIZE = 1650; * only increase the dust limit after prior releases were already not creating * outputs below the new threshold */ static const unsigned int DUST_RELAY_TX_FEE = 3000; +/** Default for -minrelaytxfee, minimum relay fee for transactions */ +static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000; /** * Standard script verification flags that standard transactions will comply * with. However scripts violating these flags may still be present in valid diff --git a/src/policy/rbf.cpp b/src/policy/rbf.cpp index 8fe4dc35b8..e25f5c7c5b 100644 --- a/src/policy/rbf.cpp +++ b/src/policy/rbf.cpp @@ -4,11 +4,19 @@ #include <policy/rbf.h> -#include <policy/settings.h> +#include <consensus/amount.h> +#include <policy/feerate.h> +#include <primitives/transaction.h> +#include <sync.h> #include <tinyformat.h> +#include <txmempool.h> +#include <uint256.h> #include <util/moneystr.h> #include <util/rbf.h> +#include <limits> +#include <vector> + RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) { AssertLockHeld(pool.cs); diff --git a/src/policy/rbf.h b/src/policy/rbf.h index fcec7052ed..07f68c8fd4 100644 --- a/src/policy/rbf.h +++ b/src/policy/rbf.h @@ -5,13 +5,20 @@ #ifndef BITCOIN_POLICY_RBF_H #define BITCOIN_POLICY_RBF_H +#include <consensus/amount.h> #include <primitives/transaction.h> +#include <threadsafety.h> #include <txmempool.h> -#include <uint256.h> +#include <cstddef> +#include <cstdint> #include <optional> +#include <set> #include <string> +class CFeeRate; +class uint256; + /** Maximum number of transactions that can be replaced by BIP125 RBF (Rule #5). This includes all * mempool conflicts and their descendants. */ static constexpr uint32_t MAX_BIP125_REPLACEMENT_CANDIDATES{100}; diff --git a/src/policy/settings.cpp b/src/policy/settings.cpp index eb2ec56850..0b67d274ce 100644 --- a/src/policy/settings.cpp +++ b/src/policy/settings.cpp @@ -11,4 +11,5 @@ bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG; CFeeRate incrementalRelayFee = CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE); CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE); +CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE); unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP; diff --git a/src/policy/settings.h b/src/policy/settings.h index 0b4fc1e770..2311d01fe8 100644 --- a/src/policy/settings.h +++ b/src/policy/settings.h @@ -6,14 +6,19 @@ #ifndef BITCOIN_POLICY_SETTINGS_H #define BITCOIN_POLICY_SETTINGS_H +#include <policy/feerate.h> #include <policy/policy.h> -class CFeeRate; +#include <cstdint> +#include <string> + class CTransaction; // Policy settings which are configurable at runtime. extern CFeeRate incrementalRelayFee; extern CFeeRate dustRelayFee; +/** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */ +extern CFeeRate minRelayTxFee; extern unsigned int nBytesPerSigOp; extern bool fIsBareMultisigStd; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index f2186c131f..d682a7d3e8 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -790,7 +790,7 @@ static RPCHelpMan pruneblockchain() const CBlockIndex& block{*CHECK_NONFATAL(active_chain.Tip())}; const CBlockIndex* last_block{active_chainstate.m_blockman.GetFirstStoredBlock(block)}; - return static_cast<uint64_t>(last_block->nHeight); + return static_cast<int64_t>(last_block->nHeight - 1); }, }; } diff --git a/src/rpc/fees.cpp b/src/rpc/fees.cpp index bfec0780aa..1873bc1587 100644 --- a/src/rpc/fees.cpp +++ b/src/rpc/fees.cpp @@ -7,6 +7,7 @@ #include <policy/feerate.h> #include <policy/fees.h> #include <policy/policy.h> +#include <policy/settings.h> #include <rpc/protocol.h> #include <rpc/request.h> #include <rpc/server.h> @@ -16,7 +17,6 @@ #include <univalue.h> #include <util/fees.h> #include <util/system.h> -#include <validation.h> #include <algorithm> #include <array> diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index 90dc86cd01..97ec95a166 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -8,6 +8,7 @@ #include <core_io.h> #include <fs.h> #include <policy/rbf.h> +#include <policy/settings.h> #include <primitives/transaction.h> #include <rpc/server.h> #include <rpc/server_util.h> @@ -15,7 +16,6 @@ #include <txmempool.h> #include <univalue.h> #include <util/moneystr.h> -#include <validation.h> using node::DEFAULT_MAX_RAW_TX_FEE_RATE; using node::NodeContext; diff --git a/src/rpc/output_script.cpp b/src/rpc/output_script.cpp index 115a656e12..f4bb76f50f 100644 --- a/src/rpc/output_script.cpp +++ b/src/rpc/output_script.cpp @@ -163,11 +163,11 @@ static RPCHelpMan createmultisig() result.pushKV("descriptor", descriptor->ToString()); UniValue warnings(UniValue::VARR); - if (!request.params[2].isNull() && OutputTypeFromDestination(dest) != output_type) { + if (descriptor->GetOutputType() != output_type) { // Only warns if the user has explicitly chosen an address type we cannot generate warnings.push_back("Unable to make chosen address type, please ensure no uncompressed public keys are present."); } - if (warnings.size()) result.pushKV("warnings", warnings); + if (!warnings.empty()) result.pushKV("warnings", warnings); return result; }, diff --git a/src/test/fuzz/tx_out.cpp b/src/test/fuzz/tx_out.cpp index 39a50b6c80..a2421ff582 100644 --- a/src/test/fuzz/tx_out.cpp +++ b/src/test/fuzz/tx_out.cpp @@ -4,6 +4,7 @@ #include <consensus/validation.h> #include <core_memusage.h> +#include <policy/feerate.h> #include <policy/policy.h> #include <primitives/transaction.h> #include <streams.h> diff --git a/src/validation.cpp b/src/validation.cpp index 448720ff83..23ad221ffe 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -134,8 +134,6 @@ int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE; uint256 hashAssumeValid; arith_uint256 nMinimumChainWork; -CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE); - const CBlockIndex* CChainState::FindForkInGlobalIndex(const CBlockLocator& locator) const { AssertLockHeld(cs_main); diff --git a/src/validation.h b/src/validation.h index 31dd089005..cc94add3cb 100644 --- a/src/validation.h +++ b/src/validation.h @@ -58,8 +58,6 @@ namespace Consensus { struct Params; } // namespace Consensus -/** Default for -minrelaytxfee, minimum relay fee for transactions */ -static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000; /** Default for -limitancestorcount, max number of in-mempool ancestors */ static const unsigned int DEFAULT_ANCESTOR_LIMIT = 25; /** Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool ancestors */ @@ -126,8 +124,6 @@ extern bool g_parallel_script_checks; extern bool fRequireStandard; extern bool fCheckBlockIndex; extern bool fCheckpointsEnabled; -/** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */ -extern CFeeRate minRelayTxFee; /** If the tip is older than this (in seconds), the node is considered to be in initial block download. */ extern int64_t nMaxTipAge; diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index d5444f5051..f25ad59528 100644 --- a/src/wallet/rpc/addresses.cpp +++ b/src/wallet/rpc/addresses.cpp @@ -302,11 +302,11 @@ RPCHelpMan addmultisigaddress() result.pushKV("descriptor", descriptor->ToString()); UniValue warnings(UniValue::VARR); - if (!request.params[3].isNull() && OutputTypeFromDestination(dest) != output_type) { + if (descriptor->GetOutputType() != output_type) { // Only warns if the user has explicitly chosen an address type we cannot generate warnings.push_back("Unable to make chosen address type, please ensure no uncompressed public keys are present."); } - if (warnings.size()) result.pushKV("warnings", warnings); + if (!warnings.empty()) result.pushKV("warnings", warnings); return result; }, diff --git a/src/wallet/rpc/backup.cpp b/src/wallet/rpc/backup.cpp index c289c05f2c..aa9f23c886 100644 --- a/src/wallet/rpc/backup.cpp +++ b/src/wallet/rpc/backup.cpp @@ -1621,7 +1621,7 @@ RPCHelpMan importdescriptors() }, RPCExamples{ HelpExampleCli("importdescriptors", "'[{ \"desc\": \"<my descriptor>\", \"timestamp\":1455191478, \"internal\": true }, " - "{ \"desc\": \"<my desccriptor 2>\", \"label\": \"example 2\", \"timestamp\": 1455191480 }]'") + + "{ \"desc\": \"<my descriptor 2>\", \"label\": \"example 2\", \"timestamp\": 1455191480 }]'") + HelpExampleCli("importdescriptors", "'[{ \"desc\": \"<my descriptor>\", \"timestamp\":1455191478, \"active\": true, \"range\": [0,100], \"label\": \"<my bech32 wallet>\" }]'") }, [&](const RPCHelpMan& self, const JSONRPCRequest& main_request) -> UniValue diff --git a/test/README.md b/test/README.md index 0d9b9fb89b..6ca7cc0016 100644 --- a/test/README.md +++ b/test/README.md @@ -327,7 +327,7 @@ test/lint/lint-files.py You can run all the shell-based lint tests by running: ``` -test/lint/lint-all.py +test/lint/all-lint.py ``` # Writing functional tests diff --git a/test/functional/feature_index_prune.py b/test/functional/feature_index_prune.py index 3ee6a8036c..bc85e43a57 100755 --- a/test/functional/feature_index_prune.py +++ b/test/functional/feature_index_prune.py @@ -73,7 +73,7 @@ class FeatureIndexPruneTest(BitcoinTestFramework): pruneheight_new = node.pruneblockchain(400) # the prune heights used here and below are magic numbers that are determined by the # thresholds at which block files wrap, so they depend on disk serialization and default block file size. - assert_equal(pruneheight_new, 249) + assert_equal(pruneheight_new, 248) self.log.info("check if we can access the tips blockfilter and coinstats when we have pruned some blocks") tip = self.nodes[0].getbestblockhash() @@ -108,7 +108,7 @@ class FeatureIndexPruneTest(BitcoinTestFramework): self.log.info("prune exactly up to the indices best blocks while the indices are disabled") for i in range(3): pruneheight_2 = self.nodes[i].pruneblockchain(1000) - assert_equal(pruneheight_2, 751) + assert_equal(pruneheight_2, 750) # Restart the nodes again with the indices activated self.restart_node(i, extra_args=self.extra_args[i]) @@ -142,7 +142,7 @@ class FeatureIndexPruneTest(BitcoinTestFramework): for node in self.nodes[:2]: with node.assert_debug_log(['limited pruning to height 2489']): pruneheight_new = node.pruneblockchain(2500) - assert_equal(pruneheight_new, 2006) + assert_equal(pruneheight_new, 2005) self.log.info("ensure that prune locks don't prevent indices from failing in a reorg scenario") with self.nodes[0].assert_debug_log(['basic block filter index prune lock moved back to 2480']): diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index 77524e85a3..7dbeccbc09 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -291,7 +291,7 @@ class PruneTest(BitcoinTestFramework): def prune(index): ret = node.pruneblockchain(height=height(index)) - assert_equal(ret, node.getblockchaininfo()['pruneheight']) + assert_equal(ret + 1, node.getblockchaininfo()['pruneheight']) def has_block(index): return os.path.isfile(os.path.join(self.nodes[node_number].datadir, self.chain, "blocks", f"blk{index:05}.dat")) diff --git a/test/functional/rpc_createmultisig.py b/test/functional/rpc_createmultisig.py index 1695acaaa8..716ee8f7ef 100755 --- a/test/functional/rpc_createmultisig.py +++ b/test/functional/rpc_createmultisig.py @@ -91,15 +91,17 @@ class RpcCreateMultiSigTest(BitcoinTestFramework): assert 'warnings' not in result # Generate addresses with the segwit types. These should all make legacy addresses + err_msg = ["Unable to make chosen address type, please ensure no uncompressed public keys are present."] + for addr_type in ['bech32', 'p2sh-segwit']: - result = self.nodes[0].createmultisig(2, keys, addr_type) + result = self.nodes[0].createmultisig(nrequired=2, keys=keys, address_type=addr_type) assert_equal(legacy_addr, result['address']) - assert_equal(result['warnings'], ["Unable to make chosen address type, please ensure no uncompressed public keys are present."]) + assert_equal(result['warnings'], err_msg) if self.is_bdb_compiled(): - result = wmulti0.addmultisigaddress(2, keys, '', addr_type) + result = wmulti0.addmultisigaddress(nrequired=2, keys=keys, address_type=addr_type) assert_equal(legacy_addr, result['address']) - assert_equal(result['warnings'], ["Unable to make chosen address type, please ensure no uncompressed public keys are present."]) + assert_equal(result['warnings'], err_msg) self.log.info('Testing sortedmulti descriptors with BIP 67 test vectors') with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data/rpc_bip67.json'), encoding='utf-8') as f: @@ -173,6 +175,7 @@ class RpcCreateMultiSigTest(BitcoinTestFramework): desc = descsum_create(desc) msig = node2.createmultisig(self.nsigs, self.pub, self.output_type) + assert 'warnings' not in msig madd = msig["address"] mredeem = msig["redeemScript"] assert_equal(desc, msig['descriptor']) diff --git a/test/lint/README.md b/test/lint/README.md index 1f683c10b3..a23211a72b 100644 --- a/test/lint/README.md +++ b/test/lint/README.md @@ -39,6 +39,6 @@ To do so, add the upstream repository as remote: git remote add --fetch secp256k1 https://github.com/bitcoin-core/secp256k1.git ``` -lint-all.py +all-lint.py =========== Calls other scripts with the `lint-` prefix. diff --git a/test/lint/lint-all.py b/test/lint/all-lint.py index c280ba2db2..34a7b9742a 100755 --- a/test/lint/lint-all.py +++ b/test/lint/all-lint.py @@ -13,11 +13,10 @@ from subprocess import run exit_code = 0 mod_path = Path(__file__).parent -for lint in glob(f"{mod_path}/lint-*"): - if lint != __file__: - result = run([lint]) - if result.returncode != 0: - print(f"^---- failure generated from {lint.split('/')[-1]}") - exit_code |= result.returncode +for lint in glob(f"{mod_path}/lint-*.py"): + result = run([lint]) + if result.returncode != 0: + print(f"^---- failure generated from {lint.split('/')[-1]}") + exit_code |= result.returncode exit(exit_code) |