diff --git a/README.md b/README.md index 019c038945..7fe7348fce 100644 --- a/README.md +++ b/README.md @@ -146,21 +146,33 @@ Qtum uses a tool called Gitian to make reproducible builds that can be verified This is a quick start script for compiling Qtum on Ubuntu - - sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git cmake libboost-all-dev libgmp3-dev +```bash + sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git cmake libboost-all-dev libgmp3-dev bison libtool-bin sudo apt-get install software-properties-common # If you want to build the Qt GUI: sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler qrencode - git clone https://github.com/qtumproject/qtum --recursive + git clone https://github.com/qtumproject/qtum cd qtum + git submodule update --init --recursive + + ./contrib/install_db4.sh `pwd` + export BDB_PREFIX='/path/to/qtum/db4' + + cd depends + make + + # replace x86_64-pc-linux-gnu with the appropriate folder name for your system + libtool --finish depends/x86_64-pc-linux-gnu/lib + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/x86_64-pc-linux-gnu/lib - # Note autogen will prompt to install some more dependencies if needed + # Note: autogen will prompt to install some more dependencies if needed ./contrib/install_db4.sh `pwd` ./autogen.sh - ./configure - make -j2 + ./configure --prefix=`pwd`/depends/x86_64-pc-linux-gnu + make -j$(nproc) +``` ### Build on CentOS @@ -207,9 +219,8 @@ Then install [Homebrew](https://brew.sh). #### Dependencies - brew install cmake automake berkeley-db@4 libtool boost@1.76 miniupnpc openssl pkg-config protobuf qt@5 libevent imagemagick librsvg qrencode gmp + brew install cmake automake berkeley-db@4 libtool boost miniupnpc openssl pkg-config protobuf qt@5 libevent imagemagick librsvg qrencode gmp -After installing all dependencies, make sure to run "brew link boost@1.76" NOTE: This will work for building on Intel Macs and Apple Silicon Macs NOTE: Building with Qt4 is still supported, however, could result in a broken UI. Building with Qt5 is recommended. diff --git a/doc/hardware-wallet.md b/doc/hardware-wallet.md index e715faeffc..a3d0fbc26a 100644 --- a/doc/hardware-wallet.md +++ b/doc/hardware-wallet.md @@ -11,7 +11,7 @@ Use [HWI](https://github.com/qtumproject/HWI) for command line interaction with `qtum-qt` provides an interface for interacting with hardware wallet devices. -Set the HWI tool path using the the menu `Settings -> Option -> Main -> HWI Tool Path` and restart `qtum-qt`, the tool is needed for hardware wallet interaction. +Set the HWI tool path using the menu `Settings -> Option -> Main -> HWI Tool Path` and restart `qtum-qt`, the tool is needed for hardware wallet interaction. Use the menu `File -> Create Wallet... -> Use a hardware device` for creating hardware wallet. The hardware wallet needs to be connected and the wallet application started. diff --git a/src/cryptopp/Install.txt b/src/cryptopp/Install.txt index 8515252413..4b75843fb3 100644 --- a/src/cryptopp/Install.txt +++ b/src/cryptopp/Install.txt @@ -102,7 +102,7 @@ The following are some of the targets provided by the GNU makefile. `make cryptest.exe` builds the library test harness. -`make test` and `make check` are the same recipe and invoke the test harness with the the validation option. That is, it executes `cryptest.exe v`. +`make test` and `make check` are the same recipe and invoke the test harness with the validation option. That is, it executes `cryptest.exe v`. `make install` installs the library. By default, the makefile copies into `/usr/local` by default. diff --git a/src/cryptopp/TestScripts/setenv-android.sh b/src/cryptopp/TestScripts/setenv-android.sh index a329786b44..e140e14dac 100755 --- a/src/cryptopp/TestScripts/setenv-android.sh +++ b/src/cryptopp/TestScripts/setenv-android.sh @@ -394,7 +394,7 @@ fi echo echo "*******************************************************************************" -echo "It looks the the environment is set correctly. Your next step is" +echo "It looks the environment is set correctly. Your next step is" echo "build the library with 'make -f GNUmakefile-cross'" echo "*******************************************************************************" echo diff --git a/src/cryptopp/TestScripts/setenv-embedded.sh b/src/cryptopp/TestScripts/setenv-embedded.sh index c6259645f5..d30ad6a10c 100755 --- a/src/cryptopp/TestScripts/setenv-embedded.sh +++ b/src/cryptopp/TestScripts/setenv-embedded.sh @@ -86,7 +86,7 @@ fi # IS_LINUX or IS_DARWIN, and incorporate settings for ARM_EMBEDDED export IS_ARM_EMBEDDED=1 -# GNUmakefile-cross uses these to to set CXXFLAGS for ARM_EMBEDDED +# GNUmakefile-cross uses these to set CXXFLAGS for ARM_EMBEDDED if [ -z "$ARM_EMBEDDED_SYSROOT" ]; then export ARM_EMBEDDED_SYSROOT="/usr/arm-linux-gnueabi" fi @@ -134,7 +134,7 @@ fi echo echo "*******************************************************************************" -echo "It looks the the environment is set correctly. Your next step is" +echo "It looks the environment is set correctly. Your next step is" echo "build the library with 'make -f GNUmakefile-cross'" echo "*******************************************************************************" echo diff --git a/src/cryptopp/TestScripts/setenv-ios.sh b/src/cryptopp/TestScripts/setenv-ios.sh index 597a15281a..9652f71bb0 100755 --- a/src/cryptopp/TestScripts/setenv-ios.sh +++ b/src/cryptopp/TestScripts/setenv-ios.sh @@ -285,7 +285,7 @@ fi echo echo "*******************************************************************************" -echo "It looks the the environment is set correctly. Your next step is" +echo "It looks the environment is set correctly. Your next step is" echo "build the library with 'make -f GNUmakefile-cross'" echo "*******************************************************************************" echo diff --git a/src/cryptopp/algebra.h b/src/cryptopp/algebra.h index 1559cb4734..2cb8488b7f 100644 --- a/src/cryptopp/algebra.h +++ b/src/cryptopp/algebra.h @@ -294,7 +294,7 @@ template class CRYPTOPP_NO_VTABLE AbstractEuclideanDomain : public Abs //! \brief Calculates the greatest common denominator in the ring //! \param a the first element //! \param b the second element - //! \returns the the greatest common denominator of a and b. + //! \returns the greatest common denominator of a and b. virtual const Element& Gcd(const Element &a, const Element &b) const; protected: diff --git a/src/cryptopp/algparam.h b/src/cryptopp/algparam.h index 33be4b0c18..333129b3f5 100644 --- a/src/cryptopp/algparam.h +++ b/src/cryptopp/algparam.h @@ -347,7 +347,7 @@ class CRYPTOPP_DLL AlgorithmParametersBase //! \param name the parameter name //! \param throwIfNotUsed flags indicating whether an exception should be thrown //! \details If throwIfNotUsed is true, then a ParameterNotUsed exception - //! will be thrown in the destructor if the parameter is not not retrieved. + //! will be thrown in the destructor if the parameter is not retrieved. AlgorithmParametersBase(const char *name, bool throwIfNotUsed) : m_name(name), m_throwIfNotUsed(throwIfNotUsed), m_used(false) {} @@ -378,7 +378,7 @@ class AlgorithmParametersTemplate : public AlgorithmParametersBase //! \param value a reference to the value //! \param throwIfNotUsed flags indicating whether an exception should be thrown //! \details If throwIfNotUsed is true, then a ParameterNotUsed exception - //! will be thrown in the destructor if the parameter is not not retrieved. + //! will be thrown in the destructor if the parameter is not retrieved. AlgorithmParametersTemplate(const char *name, const T &value, bool throwIfNotUsed) : AlgorithmParametersBase(name, throwIfNotUsed), m_value(value) { diff --git a/src/cryptopp/cryptlib.h b/src/cryptopp/cryptlib.h index 8b7624ca6d..a93acc468a 100644 --- a/src/cryptopp/cryptlib.h +++ b/src/cryptopp/cryptlib.h @@ -1139,7 +1139,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AuthenticatedSymmetricCipher : public Mess //! \brief Provides the maximum length of encrypted data //! \return the maximum length of encrypted data virtual lword MaxMessageLength() const =0; - //! \brief Provides the the maximum length of AAD + //! \brief Provides the maximum length of AAD //! \return the maximum length of AAD that can be input after the encrypted data virtual lword MaxFooterLength() const {return 0;} //! \brief Determines if data lengths must be specified prior to inputting data @@ -2382,7 +2382,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Decryptor : public PK_CryptoSystem, pub //! \param parameters a set of NameValuePairs to initialize this object //! \return the result of the decryption operation //! \details If DecodingResult::isValidCoding is true, then DecodingResult::messageLength - //! is valid and holds the the actual length of the plaintext recovered. The result is undefined + //! is valid and holds the actual length of the plaintext recovered. The result is undefined //! if decryption failed. If DecodingResult::isValidCoding is false, then DecodingResult::messageLength //! is undefined. //! \pre COUNTOF(plaintext) == MaxPlaintextLength(ciphertextLength) ensures the output @@ -2408,7 +2408,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Decryptor : public PK_CryptoSystem, pub //! \param parameters a set of NameValuePairs to initialize this object //! \return the result of the decryption operation //! \details If DecodingResult::isValidCoding is true, then DecodingResult::messageLength - //! is valid and holds the the actual length of the plaintext recovered. The result is undefined + //! is valid and holds the actual length of the plaintext recovered. The result is undefined //! if decryption failed. If DecodingResult::isValidCoding is false, then DecodingResult::messageLength //! is undefined. //! \pre COUNTOF(plaintext) == MaxPlaintextLength(ciphertextLength) ensures the output diff --git a/src/cryptopp/des.cpp b/src/cryptopp/des.cpp index 7807e7524f..866333fd40 100644 --- a/src/cryptopp/des.cpp +++ b/src/cryptopp/des.cpp @@ -5,7 +5,7 @@ * This is a major rewrite of my old public domain DES code written * circa 1987, which in turn borrowed heavily from Jim Gillogly's 1977 * public domain code. I pretty much kept my key scheduling code, but - * the actual encrypt/decrypt routines are taken from from Richard + * the actual encrypt/decrypt routines are taken from Richard * Outerbridge's DES code as printed in Schneier's "Applied Cryptography." * * This code is in the public domain. I would appreciate bug reports and diff --git a/src/cryptopp/ec2n.h b/src/cryptopp/ec2n.h index 8795a5a723..e06dab4756 100644 --- a/src/cryptopp/ec2n.h +++ b/src/cryptopp/ec2n.h @@ -42,7 +42,7 @@ class CRYPTOPP_DLL EC2N : public AbstractGroup, public EncodedPoint, public EncodedPoint class PSSR_MEM_BaseWithHashId : public PSSR_MEM_Base {}; //! \tparam SALT_LEN length of the salt //! \tparam MIN_PAD_LEN minimum length of the pad //! \tparam USE_HASH_ID flag indicating whether the HashId is used -//! \details If ALLOW_RECOVERY is true, the the signature scheme provides message recovery. If -//! ALLOW_RECOVERY is false, the the signature scheme is appendix, and the message must be +//! \details If ALLOW_RECOVERY is true, the signature scheme provides message recovery. If +//! ALLOW_RECOVERY is false, the signature scheme is appendix, and the message must be //! provided during verification. template class PSSR_MEM : public PSSR_MEM_BaseWithHashId diff --git a/src/cryptopp/pubkey.h b/src/cryptopp/pubkey.h index aadc3c26df..f947af0eec 100644 --- a/src/cryptopp/pubkey.h +++ b/src/cryptopp/pubkey.h @@ -88,7 +88,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunctionBounds //! \details The default implementation returns PreimageBound() - 1. virtual Integer MaxPreimage() const {return --PreimageBound();} //! \brief Returns the maximum size of a message after the trapdoor function is applied bound to a public key - //! \returns the the maximum size of a message after the trapdoor function is applied bound to a public key + //! \returns the maximum size of a message after the trapdoor function is applied bound to a public key //! \details The default implementation returns ImageBound() - 1. virtual Integer MaxImage() const {return --ImageBound();} }; @@ -671,7 +671,7 @@ class CRYPTOPP_NO_VTABLE MaskGeneratingFunction //! \brief Generate and apply mask //! \param hash HashTransformation derived class //! \param output the destination byte array - //! \param outputLength the size fo the the destination byte array + //! \param outputLength the size fo the destination byte array //! \param input the message to hash //! \param inputLength the size of the message //! \param mask flag indicating whether to apply the mask @@ -682,7 +682,7 @@ class CRYPTOPP_NO_VTABLE MaskGeneratingFunction //! \brief P1363 mask generation function //! \param hash HashTransformation derived class //! \param output the destination byte array -//! \param outputLength the size fo the the destination byte array +//! \param outputLength the size fo the destination byte array //! \param input the message to hash //! \param inputLength the size of the message //! \param derivationParams additional derivation parameters @@ -915,7 +915,7 @@ class CRYPTOPP_NO_VTABLE DL_GroupParameters : public CryptoParameters //! \brief Determines if an element is an identity //! \param element element to check //! \return true if the element is an identity, false otherwise - //! \details The identity element or or neutral element is a special element in a group that leaves + //! \details The identity element or neutral element is a special element in a group that leaves //! other elements unchanged when combined with it. //! \details IsIdentity() must be implemented in a derived class. virtual bool IsIdentity(const Element &element) const =0; diff --git a/src/cryptopp/setenv-android.sh b/src/cryptopp/setenv-android.sh index 31482b09b6..e8959b6c73 100755 --- a/src/cryptopp/setenv-android.sh +++ b/src/cryptopp/setenv-android.sh @@ -394,7 +394,7 @@ fi echo echo "*******************************************************************************" -echo "It looks the the environment is set correctly. Your next step is build" +echo "It looks the environment is set correctly. Your next step is build" echo "the library with 'make -f GNUmakefile-cross'. You can create a versioned" echo "shared object using 'HAS_SOLIB_VERSION=1 make -f GNUmakefile-cross'" echo "*******************************************************************************" diff --git a/src/cryptopp/setenv-embedded.sh b/src/cryptopp/setenv-embedded.sh index 8e4b0c9319..c8be80aa51 100755 --- a/src/cryptopp/setenv-embedded.sh +++ b/src/cryptopp/setenv-embedded.sh @@ -86,7 +86,7 @@ fi # IS_LINUX or IS_DARWIN, and incorporate settings for ARM_EMBEDDED export IS_ARM_EMBEDDED=1 -# GNUmakefile-cross uses these to to set CXXFLAGS for ARM_EMBEDDED +# GNUmakefile-cross uses these to set CXXFLAGS for ARM_EMBEDDED if [ -z "$ARM_EMBEDDED_SYSROOT" ]; then export ARM_EMBEDDED_SYSROOT="/usr/arm-linux-gnueabi" fi @@ -134,7 +134,7 @@ fi echo echo "*******************************************************************************" -echo "It looks the the environment is set correctly. Your next step is build" +echo "It looks the environment is set correctly. Your next step is build" echo "the library with 'make -f GNUmakefile-cross'. You can create a versioned" echo "shared object using 'HAS_SOLIB_VERSION=1 make -f GNUmakefile-cross'" echo "*******************************************************************************" diff --git a/src/cryptopp/setenv-ios.sh b/src/cryptopp/setenv-ios.sh index cd9469b7bb..7b6ba8b935 100755 --- a/src/cryptopp/setenv-ios.sh +++ b/src/cryptopp/setenv-ios.sh @@ -285,7 +285,7 @@ fi echo echo "*******************************************************************************" -echo "It looks the the environment is set correctly. Your next step is build" +echo "It looks the environment is set correctly. Your next step is build" echo "the library with 'make -f GNUmakefile-cross'. You can create a versioned" echo "shared object using 'HAS_SOLIB_VERSION=1 make -f GNUmakefile-cross'" echo "*******************************************************************************" diff --git a/src/eth_client/libethcore/ChainOperationParams.h b/src/eth_client/libethcore/ChainOperationParams.h index 79aa959e8e..f6e0e1303d 100644 --- a/src/eth_client/libethcore/ChainOperationParams.h +++ b/src/eth_client/libethcore/ChainOperationParams.h @@ -73,7 +73,7 @@ struct ChainOperationParams // returns schedule for the fork active at the given block // may include additional individually activated EIPs on top of the last fork block EVMSchedule const& scheduleForBlockNumber(u256 const& _blockNumber) const; - // returns schedule according to the the fork rules active at the given block + // returns schedule according to the fork rules active at the given block // doesn't include additional individually activated EIPs EVMSchedule const& forkScheduleForBlockNumber(u256 const& _blockNumber) const; u256 blockReward(EVMSchedule const& _schedule) const; diff --git a/src/kernel/chainparams.cpp b/src/kernel/chainparams.cpp index f39c3a2af7..daa630d133 100644 --- a/src/kernel/chainparams.cpp +++ b/src/kernel/chainparams.cpp @@ -676,7 +676,7 @@ class CUnitTestParams : public CRegTestParams explicit CUnitTestParams(const RegTestOptions& opts) : CRegTestParams(opts) { - // Activate the the BIPs for regtest as in Bitcoin + // Activate the BIPs for regtest as in Bitcoin consensus.BIP34Height = 100000000; // BIP34 has not activated on regtest (far in the future so block v1 are not rejected in tests) consensus.BIP34Hash = uint256(); consensus.BIP65Height = consensus.nBlocktimeDownscaleFactor*500 + 851; // BIP65 activated on regtest (Used in rpc activation tests) diff --git a/src/key_io.cpp b/src/key_io.cpp index d28990aa75..97a65e8c5f 100644 --- a/src/key_io.cpp +++ b/src/key_io.cpp @@ -87,7 +87,6 @@ CTxDestination DecodeDestination(const std::string& str, const CChainParams& par std::vector data; uint160 hash; error_str = ""; - bech32::DecodeResult dec; // Note this will be false if it is a valid Bech32 address for a different network bool is_bech32 = (ToLower(str.substr(0, params.Bech32HRP().size())) == params.Bech32HRP()); @@ -95,8 +94,8 @@ CTxDestination DecodeDestination(const std::string& str, const CChainParams& par // Decode bech32 address if(is_bech32) { - dec = bech32::Decode(str); - is_bech32 = dec.encoding != bech32::Encoding::INVALID; + // There are valid PKH addresses that start with Qc, so make sure it is not a valid PKH address + is_bech32 = !DecodeBase58Check(str, data, 21); } if (!is_bech32 && DecodeBase58Check(str, data, 21)) { @@ -137,6 +136,7 @@ CTxDestination DecodeDestination(const std::string& str, const CChainParams& par } data.clear(); + const auto dec = bech32::Decode(str); if (dec.encoding == bech32::Encoding::BECH32 || dec.encoding == bech32::Encoding::BECH32M) { if (dec.data.empty()) { error_str = "Empty Bech32 data section"; diff --git a/src/secp256k1/src/secp256k1.c b/src/secp256k1/src/secp256k1.c index 4c11e7f0b8..d0d513ec10 100644 --- a/src/secp256k1/src/secp256k1.c +++ b/src/secp256k1/src/secp256k1.c @@ -526,7 +526,7 @@ static int secp256k1_ecdsa_sign_inner(const secp256k1_context* ctx, secp256k1_sc break; } is_nonce_valid = secp256k1_scalar_set_b32_seckey(&non, nonce32); - /* The nonce is still secret here, but it being invalid is is less likely than 1:2^255. */ + /* The nonce is still secret here, but it being invalid is less likely than 1:2^255. */ secp256k1_declassify(ctx, &is_nonce_valid, sizeof(is_nonce_valid)); if (is_nonce_valid) { ret = secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, r, s, &sec, &msg, &non, recid); diff --git a/test/functional/feature_bip68_sequence.py b/test/functional/feature_bip68_sequence.py index 725b1def89..1742985147 100755 --- a/test/functional/feature_bip68_sequence.py +++ b/test/functional/feature_bip68_sequence.py @@ -140,7 +140,7 @@ def test_sequence_lock_confirmed_inputs(self): import random num_outputs = random.randint(1, max_outputs) self.wallet.send_self_transfer_multi(from_node=self.nodes[0], num_outputs=num_outputs) - self.generate(self.wallet, 1) + self.generate(self.wallet, COINBASE_MATURITY + 1) utxos = self.wallet.get_utxos(include_immature_coinbase=False) diff --git a/test/functional/feature_notifications.py b/test/functional/feature_notifications.py index 887e558ace..3b378a280e 100755 --- a/test/functional/feature_notifications.py +++ b/test/functional/feature_notifications.py @@ -62,12 +62,12 @@ def run_test(self): seed = "cTdGmKFWpbvpKQ7ejrdzqYT2hhjyb3GPHnLAK7wdi5Em67YLwSm9" xpriv = "tprv8ZgxMBicQKsPfHCsTwkiM1KT56RXbGGTqvc2hgqzycpwbHqqpcajQeMRZoBD35kW4RtyCemu6j34Ku5DEspmgjKdt2qe4SvRch5Kk8B8A2v" desc_imports = [{ - "desc": descsum_create(f"wpkh({xpriv}/0/*)"), + "desc": descsum_create(f"pkh({xpriv}/0/*)"), "timestamp": 0, "active": True, "keypool": True, },{ - "desc": descsum_create(f"wpkh({xpriv}/1/*)"), + "desc": descsum_create(f"pkh({xpriv}/1/*)"), "timestamp": 0, "active": True, "keypool": True, diff --git a/test/functional/interface_zmq.py b/test/functional/interface_zmq.py index dfd6aafe8b..5d5f535232 100755 --- a/test/functional/interface_zmq.py +++ b/test/functional/interface_zmq.py @@ -30,6 +30,7 @@ MiniWallet, ) from test_framework.netutil import test_ipv6_local +from io import BytesIO from test_framework.qtum import convert_btc_bech32_address_to_qtum # Test may be skipped and not have zmq installed diff --git a/test/functional/mempool_package_limits.py b/test/functional/mempool_package_limits.py index c70f34e871..bbeb69d9f3 100755 --- a/test/functional/mempool_package_limits.py +++ b/test/functional/mempool_package_limits.py @@ -3,8 +3,11 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test logic for limiting mempool and package ancestors/descendants.""" +from decimal import Decimal + from test_framework.blocktools import COINBASE_MATURITY from test_framework.messages import ( + COIN, WITNESS_SCALE_FACTOR, ) from test_framework.test_framework import BitcoinTestFramework @@ -289,7 +292,7 @@ def test_anc_size_limits(self): node = self.nodes[0] parent_utxos = [] target_vsize = 30_000 - high_fee = 1000 * target_vsize # 10 sats/vB + high_fee = Decimal("0.3") # 10 sats/vB target_weight = target_vsize * WITNESS_SCALE_FACTOR self.log.info("Check that in-mempool and in-package ancestor size limits are calculated properly in packages") # Mempool transactions A and B @@ -299,7 +302,7 @@ def test_anc_size_limits(self): parent_utxos.append(bulked_tx["new_utxo"]) # Package transaction C - pc_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=parent_utxos, fee_per_output=high_fee, target_weight=target_weight) + pc_tx = self.wallet.create_self_transfer_multi(utxos_to_spend=parent_utxos, fee_per_output=int(high_fee * COIN), target_weight=target_weight) # Package transaction D pd_tx = self.wallet.create_self_transfer(utxo_to_spend=pc_tx["new_utxos"][0], target_weight=target_weight, fee=high_fee) @@ -320,11 +323,11 @@ def test_desc_size_limits(self): """ node = self.nodes[0] target_vsize = 21_000 - high_fee = 1000 * target_vsize # 10 sats/vB + high_fee = Decimal("0.21") # 10 sats/vB target_weight = target_vsize * WITNESS_SCALE_FACTOR self.log.info("Check that in-mempool and in-package descendant sizes are calculated properly in packages") # Top parent in mempool, Ma - ma_tx = self.wallet.create_self_transfer_multi(num_outputs=2, fee_per_output=high_fee // 2, target_weight=target_weight) + ma_tx = self.wallet.create_self_transfer_multi(num_outputs=2, fee_per_output=int(high_fee / 2 * COIN) // 2, target_weight=target_weight) self.wallet.sendrawtransaction(from_node=node, tx_hex=ma_tx["hex"]) package_hex = [] diff --git a/test/functional/mempool_sigoplimit.py b/test/functional/mempool_sigoplimit.py index fbec6d0dc8..814ea637e9 100755 --- a/test/functional/mempool_sigoplimit.py +++ b/test/functional/mempool_sigoplimit.py @@ -38,6 +38,7 @@ ) from test_framework.wallet import MiniWallet from test_framework.wallet_util import generate_keypair +from test_framework.blocktools import COINBASE_MATURITY DEFAULT_BYTES_PER_SIGOP = 20 # default setting @@ -46,7 +47,7 @@ class BytesPerSigOpTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 # allow large datacarrier output to pad transactions - self.extra_args = [['-datacarriersize=100000']] + self.extra_args = [['-datacarriersize=100000', '-minrelaytxfee=0']] def create_p2wsh_spending_tx(self, witness_script, output_script): """Create a 1-input-1-output P2WSH spending transaction with only the @@ -177,6 +178,7 @@ def create_bare_multisig_tx(utxo_to_spend=None): def run_test(self): self.wallet = MiniWallet(self.nodes[0]) + self.generate(self.wallet, COINBASE_MATURITY + 1000) for bytes_per_sigop in (DEFAULT_BYTES_PER_SIGOP, 43, 81, 165, 327, 649, 1072): if bytes_per_sigop == DEFAULT_BYTES_PER_SIGOP: diff --git a/test/functional/p2p_sendtxrcncl.py b/test/functional/p2p_sendtxrcncl.py index 0e349ef70c..513d9ecbb7 100755 --- a/test/functional/p2p_sendtxrcncl.py +++ b/test/functional/p2p_sendtxrcncl.py @@ -82,18 +82,18 @@ def run_test(self): sendtxrcncl_index = [i for i, msg in enumerate(peer.messages) if msg.msgtype == b'sendtxrcncl'][0] assert sendtxrcncl_index < verack_index self.nodes[0].disconnect_p2ps() - - self.log.info('SENDTXRCNCL on pre-WTXID version should not be sent') - peer = self.nodes[0].add_p2p_connection(SendTxrcnclReceiver(), send_version=False, wait_for_verack=False) - pre_wtxid_version_msg = msg_version() - pre_wtxid_version_msg.nVersion = 70015 - pre_wtxid_version_msg.strSubVer = P2P_SUBVERSION - pre_wtxid_version_msg.nServices = P2P_SERVICES - pre_wtxid_version_msg.relay = 1 - peer.send_message(pre_wtxid_version_msg) - peer.wait_for_verack() - assert not peer.sendtxrcncl_msg_received - self.nodes[0].disconnect_p2ps() + # + # self.log.info('SENDTXRCNCL on pre-WTXID version should not be sent') + # peer = self.nodes[0].add_p2p_connection(SendTxrcnclReceiver(), send_version=False, wait_for_verack=False) + # pre_wtxid_version_msg = msg_version() + # pre_wtxid_version_msg.nVersion = 70015 + # pre_wtxid_version_msg.strSubVer = P2P_SUBVERSION + # pre_wtxid_version_msg.nServices = P2P_SERVICES + # pre_wtxid_version_msg.relay = 1 + # peer.send_message(pre_wtxid_version_msg) + # peer.wait_for_verack() + # assert not peer.sendtxrcncl_msg_received + # self.nodes[0].disconnect_p2ps() self.log.info('SENDTXRCNCL for fRelay=false should not be sent') peer = self.nodes[0].add_p2p_connection(SendTxrcnclReceiver(), send_version=False, wait_for_verack=False) @@ -195,17 +195,17 @@ def run_test(self): peer.send_message(sendtxrcncl_higher_version) self.nodes[0].disconnect_p2ps() - self.log.info('unexpected SENDTXRCNCL is ignored') - peer = self.nodes[0].add_p2p_connection(PeerNoVerack(), send_version=False, wait_for_verack=False) - old_version_msg = msg_version() - old_version_msg.nVersion = 70015 - old_version_msg.strSubVer = P2P_SUBVERSION - old_version_msg.nServices = P2P_SERVICES - old_version_msg.relay = 1 - peer.send_message(old_version_msg) - with self.nodes[0].assert_debug_log(['Ignore unexpected txreconciliation signal']): - peer.send_message(create_sendtxrcncl_msg()) - self.nodes[0].disconnect_p2ps() + # self.log.info('unexpected SENDTXRCNCL is ignored') + # peer = self.nodes[0].add_p2p_connection(PeerNoVerack(), send_version=False, wait_for_verack=False) + # old_version_msg = msg_version() + # old_version_msg.nVersion = 70015 + # old_version_msg.strSubVer = P2P_SUBVERSION + # old_version_msg.nServices = P2P_SERVICES + # old_version_msg.relay = 1 + # peer.send_message(old_version_msg) + # with self.nodes[0].assert_debug_log(['Ignore unexpected txreconciliation signal']): + # peer.send_message(create_sendtxrcncl_msg()) + # self.nodes[0].disconnect_p2ps() self.log.info('sending SENDTXRCNCL after sending VERACK triggers a disconnect') peer = self.nodes[0].add_p2p_connection(P2PInterface()) diff --git a/test/functional/qtum_condensing_txs.py b/test/functional/qtum_condensing_txs.py index 3be820d46a..d52cc28d24 100755 --- a/test/functional/qtum_condensing_txs.py +++ b/test/functional/qtum_condensing_txs.py @@ -199,7 +199,7 @@ def run_test(self): assert("vin" in self.node.getaccountinfo(self.sender3)) # We need the txfee to be higher than T5 so that T4 tx is prioritized over T5. - # We set the gas such that the the tx will run but not immediately throw a out of gas exception + # We set the gas such that the tx will run but not immediately throw a out of gas exception T4_raw = make_transaction(self.node, [make_vin(self.node, 3*COIN)], [make_op_call_output(2*COIN, b"\x04", 22000, CScriptNum(QTUM_MIN_GAS_PRICE), hex_str_to_bytes(self.share_abi), hex_str_to_bytes(self.sender2))]) T4_id = self.node.sendrawtransaction(T4_raw, 0) T5_id = self.node.sendtocontract(self.sender2, self.withdrawAll_abi, 0, 1000000, QTUM_MIN_GAS_PRICE_STR, A1)['txid'] diff --git a/test/functional/qtum_dgp.py b/test/functional/qtum_dgp.py index 0667de2f41..a94dac1d98 100755 --- a/test/functional/qtum_dgp.py +++ b/test/functional/qtum_dgp.py @@ -912,7 +912,7 @@ def run_test(self): state.current_on_vote_address_proposals[1][1] = state.gov_keys[-1] state.assert_state() - # Now make sure that accepting one proposal has the desired affect on the the other proposals + # Now make sure that accepting one proposal has the desired affect on the other proposals # Accepting a proposal for removing keys should reset the addAddressProposals state.send_remove_address_proposal(state.admin_keys[-1], 0, keyhash_to_p2pkh(hex_str_to_bytes(state.admin_keys[1]))) self.node.generate(1) diff --git a/test/functional/rpc_getblockfrompeer.py b/test/functional/rpc_getblockfrompeer.py index a2a8fe4060..b9c803af09 100755 --- a/test/functional/rpc_getblockfrompeer.py +++ b/test/functional/rpc_getblockfrompeer.py @@ -95,7 +95,7 @@ def run_test(self): self.log.info("Don't fetch blocks while the node has not synced past it yet") # For this test we need node 1 in prune mode and as a side effect this also disconnects # the nodes which is also necessary for the rest of the test. - self.restart_node(1, ["-prune=550"]) + self.restart_node(1, ["-prune=2000"]) # Generate a block on the disconnected node that the pruning node is not connected to blockhash = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0] @@ -124,10 +124,10 @@ def run_test(self): # We need to generate more blocks to be able to prune self.generate(self.nodes[0], 400, sync_fun=self.no_op) self.sync_blocks([self.nodes[0], pruned_node]) - pruneheight = pruned_node.pruneblockchain(300) - assert_equal(pruneheight, 248) + pruneheight = pruned_node.pruneblockchain(2099) + assert_equal(pruneheight, 2099) # Ensure the block is actually pruned - pruned_block = self.nodes[0].getblockhash(2) + pruned_block = self.nodes[0].getblockhash(2098) assert_raises_rpc_error(-1, "Block not available (pruned data)", pruned_node.getblock, pruned_block) self.log.info("Fetch pruned block") @@ -139,17 +139,17 @@ def run_test(self): assert_equal(result, {}) self.log.info("Fetched block persists after next pruning event") - self.generate(self.nodes[0], 250, sync_fun=self.no_op) + self.generate(self.nodes[0], 500, sync_fun=self.no_op) self.sync_blocks([self.nodes[0], pruned_node]) - pruneheight += 251 - assert_equal(pruned_node.pruneblockchain(700), pruneheight) - assert_equal(pruned_node.getblock(pruned_block)["hash"], "36c56c5b5ebbaf90d76b0d1a074dcb32d42abab75b7ec6fa0ffd9b4fbce8f0f7") + pruneheight += 362 + assert_equal(pruned_node.pruneblockchain(2461), pruneheight) + assert_equal(pruned_node.getblock(pruned_block)["hash"], "528cd25d3052e879507d63d87d3feba71c15460517e1b2547352e4a2738c26bd") self.log.info("Fetched block can be pruned again when prune height exceeds the height of the tip at the time when the block was fetched") - self.generate(self.nodes[0], 250, sync_fun=self.no_op) + self.generate(self.nodes[0], 500, sync_fun=self.no_op) self.sync_blocks([self.nodes[0], pruned_node]) - pruneheight += 250 - assert_equal(pruned_node.pruneblockchain(1000), pruneheight) + pruneheight += 361 + assert_equal(pruned_node.pruneblockchain(2961), pruneheight) assert_raises_rpc_error(-1, "Block not available (pruned data)", pruned_node.getblock, pruned_block) diff --git a/test/functional/rpc_invalid_address_message.py b/test/functional/rpc_invalid_address_message.py index 6759b69dd1..31f9feb52f 100755 --- a/test/functional/rpc_invalid_address_message.py +++ b/test/functional/rpc_invalid_address_message.py @@ -5,38 +5,42 @@ """Test error messages for 'getaddressinfo' and 'validateaddress' RPC commands.""" from test_framework.test_framework import BitcoinTestFramework +from test_framework.qtum import convert_btc_bech32_address_to_qtum from test_framework.util import ( assert_equal, assert_raises_rpc_error, ) -BECH32_VALID = 'bcrt1qtmp74ayg7p24uslctssvjm06q5phz4yrxucgnv' -BECH32_VALID_CAPITALS = 'BCRT1QPLMTZKC2XHARPPZDLNPAQL78RSHJ68U33RAH7R' -BECH32_VALID_MULTISIG = 'bcrt1qdg3myrgvzw7ml9q0ejxhlkyxm7vl9r56yzkfgvzclrf4hkpx9yfqhpsuks' - -BECH32_INVALID_BECH32 = 'bcrt1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqdmchcc' -BECH32_INVALID_BECH32M = 'bcrt1qw508d6qejxtdg4y5r3zarvary0c5xw7k35mrzd' -BECH32_INVALID_VERSION = 'bcrt130xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqynjegk' -BECH32_INVALID_SIZE = 'bcrt1s0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7v8n0nx0muaewav25430mtr' -BECH32_INVALID_V0_SIZE = 'bcrt1qw508d6qejxtdg4y5r3zarvary0c5xw7kqqq5k3my' -BECH32_INVALID_PREFIX = 'bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx' -BECH32_TOO_LONG = 'bcrt1q049edschfnwystcqnsvyfpj23mpsg3jcedq9xv049edschfnwystcqnsvyfpj23mpsg3jcedq9xv049edschfnwystcqnsvyfpj23m' -BECH32_ONE_ERROR = 'bcrt1q049edschfnwystcqnsvyfpj23mpsg3jcedq9xv' -BECH32_ONE_ERROR_CAPITALS = 'BCRT1QPLMTZKC2XHARPPZDLNPAQL78RSHJ68U32RAH7R' -BECH32_TWO_ERRORS = 'bcrt1qax9suht3qv95sw33xavx8crpxduefdrsvgsklu' # should be bcrt1qax9suht3qv95sw33wavx8crpxduefdrsvgsklx -BECH32_NO_SEPARATOR = 'bcrtq049ldschfnwystcqnsvyfpj23mpsg3jcedq9xv' -BECH32_INVALID_CHAR = 'bcrt1q04oldschfnwystcqnsvyfpj23mpsg3jcedq9xv' -BECH32_MULTISIG_TWO_ERRORS = 'bcrt1qdg3myrgvzw7ml8q0ejxhlkyxn7vl9r56yzkfgvzclrf4hkpx9yfqhpsuks' -BECH32_WRONG_VERSION = 'bcrt1ptmp74ayg7p24uslctssvjm06q5phz4yrxucgnv' - -BASE58_VALID = 'mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn' +import test_framework.segwit_addr + +BECH32_VALID = convert_btc_bech32_address_to_qtum('bcrt1qtmp74ayg7p24uslctssvjm06q5phz4yrxucgnv') +BECH32_VALID_CAPITALS = convert_btc_bech32_address_to_qtum('BCRT1QPLMTZKC2XHARPPZDLNPAQL78RSHJ68U33RAH7R') +BECH32_VALID_MULTISIG = convert_btc_bech32_address_to_qtum('bcrt1qdg3myrgvzw7ml9q0ejxhlkyxm7vl9r56yzkfgvzclrf4hkpx9yfqhpsuks') + +BECH32_INVALID_BECH32 = convert_btc_bech32_address_to_qtum('bcrt1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqdmchcc') +BECH32_INVALID_BECH32M = convert_btc_bech32_address_to_qtum('bcrt1qw508d6qejxtdg4y5r3zarvary0c5xw7k35mrzd') +BECH32_INVALID_VERSION = convert_btc_bech32_address_to_qtum('bcrt130xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqynjegk') +BECH32_INVALID_SIZE = convert_btc_bech32_address_to_qtum('bcrt1s0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7v8n0nx0muaewav25430mtr') +BECH32_INVALID_V0_SIZE = convert_btc_bech32_address_to_qtum('bcrt1qw508d6qejxtdg4y5r3zarvary0c5xw7kqqq5k3my') +BECH32_INVALID_PREFIX = 'qc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx' +BECH32_TOO_LONG = 'qcrt1q049edschfnwystcqnsvyfpj23mpsg3jcedq9xv049edschfnwystcqnsvyfpj23mpsg3jcedq9xv049edschfnwystcqnsvyfpj23m' +BECH32_ONE_ERROR = 'qcrt1qkkcddf3qa8s7k65uc9rn8pz3jsjxfl4wqel08t' +BECH32_ONE_ERROR_CAPITALS = 'QCRT1QKKCFDF3QA8S7K65UC9RN8PZ3JSJXFL4WEEL08T' +BECH32_TWO_ERRORS = 'qcrt1qkkcfdf3qa8s7k65uf9rn8pz3jsjxfl4wqel088' # should be bcrt1qax9suht3qv95sw33wavx8crpxduefdrsvgsklx +BECH32_NO_SEPARATOR = 'qcrtq049ldschfnwystcqnsvyfpj23mpsg3jcedq9xv' +BECH32_INVALID_CHAR = 'qcrt1q04oldschfnwystcqnsvyfpj23mpsg3jcedq9xv' +BECH32_MULTISIG_TWO_ERRORS = 'qcrt1q7j7t9yc7jkmfa3h0285lju666d8jwahafu3vwl6hcfdeuxj7xwzsd3yamp' +BECH32_WRONG_VERSION = 'qcrt1p6crvu0zcfn0mag6drc03ufg6n49sfel08grxx7' + + +BASE58_VALID = 'qVU2jTzGzLgT6PdEd2iBynRFDs8jRP4Kmv' BASE58_INVALID_PREFIX = '17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem' BASE58_INVALID_CHECKSUM = 'mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJJfn' BASE58_INVALID_LENGTH = '2VKf7XKMrp4bVNVmuRbyCewkP8FhGLP2E54LHDPakr9Sq5mtU2' INVALID_ADDRESS = 'asfah14i8fajz0123f' -INVALID_ADDRESS_2 = '1q049ldschfnwystcqnsvyfpj23mpsg3jcedq9xv' +INVALID_ADDRESS_2 = '1qkkcddf3qa8s7k65uc9rn8pz3jsjxfl4wqel08t' class InvalidAddressErrorMessageTest(BitcoinTestFramework): def add_options(self, parser): @@ -98,7 +102,7 @@ def test_validateaddress(self): node = self.nodes[0] # Missing arg returns the help text - assert_raises_rpc_error(-1, "Return information about the given bitcoin address.", node.validateaddress) + assert_raises_rpc_error(-1, "Return information about the given qtum address.", node.validateaddress) # Explicit None is not allowed for required parameters assert_raises_rpc_error(-3, "JSON value of type null is not of expected type string", node.validateaddress, None) diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py index d8cbc07345..d259ac677c 100755 --- a/test/functional/rpc_psbt.py +++ b/test/functional/rpc_psbt.py @@ -6,6 +6,7 @@ """ from decimal import Decimal from itertools import product +from test_framework.qtumconfig import INITIAL_BLOCK_REWARD from test_framework.descriptors import descsum_create from test_framework.key import H_POINT @@ -46,6 +47,7 @@ generate_keypair, get_generate_key, ) +from test_framework.qtum import convert_btc_bech32_address_to_qtum import json import os @@ -95,7 +97,7 @@ def test_utxo_conversion(self): # Construct an unsigned PSBT on the online node utxos = wonline.listunspent(addresses=[offline_addr]) - raw = wonline.createrawtransaction([{"txid":utxos[0]["txid"], "vout":utxos[0]["vout"]}],[{online_addr:0.9999}]) + raw = wonline.createrawtransaction([{"txid":utxos[0]["txid"], "vout":utxos[0]["vout"]}],[{online_addr:0.9}]) psbt = wonline.walletprocesspsbt(online_node.converttopsbt(raw))["psbt"] assert not "not_witness_utxo" in mining_node.decodepsbt(psbt)["inputs"][0] @@ -133,7 +135,7 @@ def test_input_confs_control(self): self.log.info("Crafting PSBT using an unconfirmed input") target_address = self.nodes[1].getnewaddress() - psbtx1 = wallet.walletcreatefundedpsbt([], {target_address: 0.1}, 0, {'fee_rate': 1, 'maxconf': 0})['psbt'] + psbtx1 = wallet.walletcreatefundedpsbt([], {target_address: 0.1}, 0, {'fee_rate': 400, 'maxconf': 0})['psbt'] # Make sure we only had the one input tx1_inputs = self.nodes[0].decodepsbt(psbtx1)['tx']['vin'] @@ -155,12 +157,12 @@ def test_input_confs_control(self): assert_raises_rpc_error(-4, "Insufficient funds", wallet.walletcreatefundedpsbt, [{'txid': utxo1['txid'], 'vout': utxo1['vout']}], {target_address: 1}, 0, {'add_inputs': True, 'minconf': 3, 'fee_rate': 10}) self.log.info("Fail to broadcast a new PSBT with maxconf 0 due to BIP125 rules to verify it actually chose unconfirmed outputs") - psbt_invalid = wallet.walletcreatefundedpsbt([{'txid': utxo1['txid'], 'vout': utxo1['vout']}], {target_address: 1}, 0, {'add_inputs': True, 'maxconf': 0, 'fee_rate': 10})['psbt'] + psbt_invalid = wallet.walletcreatefundedpsbt([{'txid': utxo1['txid'], 'vout': utxo1['vout']}], {target_address: 1}, 0, {'add_inputs': True, 'maxconf': 0, 'fee_rate': 4000})['psbt'] signed_invalid = wallet.walletprocesspsbt(psbt_invalid) assert_raises_rpc_error(-26, "bad-txns-spends-conflicting-tx", self.nodes[0].sendrawtransaction, signed_invalid['hex']) self.log.info("Craft a replacement adding inputs with highest confs possible") - psbtx2 = wallet.walletcreatefundedpsbt([{'txid': utxo1['txid'], 'vout': utxo1['vout']}], {target_address: 1}, 0, {'add_inputs': True, 'minconf': 2, 'fee_rate': 10})['psbt'] + psbtx2 = wallet.walletcreatefundedpsbt([{'txid': utxo1['txid'], 'vout': utxo1['vout']}], {target_address: 1}, 0, {'add_inputs': True, 'minconf': 2, 'fee_rate': 4000})['psbt'] tx2_inputs = self.nodes[0].decodepsbt(psbtx2)['tx']['vin'] assert_greater_than_or_equal(len(tx2_inputs), 2) for vin in tx2_inputs: @@ -192,9 +194,9 @@ def run_test(self): utxo1 = self.nodes[0].listunspent()[0] assert_raises_rpc_error(-4, "The preselected coins total amount does not cover the transaction target. " "Please allow other inputs to be automatically selected or include more coins manually", - self.nodes[0].walletcreatefundedpsbt, [{"txid": utxo1['txid'], "vout": utxo1['vout']}], {self.nodes[2].getnewaddress():90}) + self.nodes[0].walletcreatefundedpsbt, [{"txid": utxo1['txid'], "vout": utxo1['vout']}], {self.nodes[2].getnewaddress():2*INITIAL_BLOCK_REWARD-10}) - psbtx1 = self.nodes[0].walletcreatefundedpsbt([{"txid": utxo1['txid'], "vout": utxo1['vout']}], {self.nodes[2].getnewaddress():90}, 0, {"add_inputs": True})['psbt'] + psbtx1 = self.nodes[0].walletcreatefundedpsbt([{"txid": utxo1['txid'], "vout": utxo1['vout']}], {self.nodes[2].getnewaddress():2*INITIAL_BLOCK_REWARD-10}, 0, {"add_inputs": True})['psbt'] assert_equal(len(self.nodes[0].decodepsbt(psbtx1)['tx']['vin']), 2) # Inputs argument can be null @@ -321,7 +323,7 @@ def run_test(self): assert_equal(0, self.nodes[1].walletcreatefundedpsbt(inputs, outputs, 0, {param: zero_value, "add_inputs": True})["fee"]) self.log.info("Test invalid fee rate settings") - for param, value in {("fee_rate", 100000), ("feeRate", 1)}: + for param, value in {("fee_rate", 2000000), ("feeRate", 2)}: assert_raises_rpc_error(-4, "Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)", self.nodes[1].walletcreatefundedpsbt, inputs, outputs, 0, {param: value, "add_inputs": True}) assert_raises_rpc_error(-3, "Amount out of range", @@ -338,7 +340,7 @@ def run_test(self): self.nodes[1].walletcreatefundedpsbt, inputs, outputs, 0, {"fee_rate": invalid_value, "add_inputs": True}) self.log.info("- raises RPC error if both feeRate and fee_rate are passed") - assert_raises_rpc_error(-8, "Cannot specify both fee_rate (sat/vB) and feeRate (BTC/kvB)", + assert_raises_rpc_error(-8, "Cannot specify both fee_rate (sat/vB) and feeRate (QTUM/kvB)", self.nodes[1].walletcreatefundedpsbt, inputs, outputs, 0, {"fee_rate": 0.1, "feeRate": 0.1, "add_inputs": True}) self.log.info("- raises RPC error if both feeRate and estimate_mode passed") @@ -378,7 +380,7 @@ def run_test(self): for bool_add, outputs_array in {True: outputs, False: [{self.nodes[1].getnewaddress(): 1}]}.items(): msg = "Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)" assert_raises_rpc_error(-4, msg, self.nodes[1].walletcreatefundedpsbt, inputs, outputs_array, 0, {"fee_rate": 1000000, "add_inputs": bool_add}) - assert_raises_rpc_error(-4, msg, self.nodes[1].walletcreatefundedpsbt, inputs, outputs_array, 0, {"feeRate": 1, "add_inputs": bool_add}) + assert_raises_rpc_error(-4, msg, self.nodes[1].walletcreatefundedpsbt, inputs, outputs_array, 0, {"feeRate": 5, "add_inputs": bool_add}) self.log.info("Test various PSBT operations") # partially sign multisig things with node 1 @@ -426,7 +428,7 @@ def run_test(self): vout2 = find_output(self.nodes[2], txid2, 13, blockhash=blockhash) # Create a psbt spending outputs from nodes 1 and 2 - psbt_orig = self.nodes[0].createpsbt([{"txid":txid1, "vout":vout1}, {"txid":txid2, "vout":vout2}], {self.nodes[0].getnewaddress():25.999}) + psbt_orig = self.nodes[0].createpsbt([{"txid":txid1, "vout":vout1}, {"txid":txid2, "vout":vout2}], {self.nodes[0].getnewaddress():25.899}) # Update psbts, should only have data for one input and not the other psbt1 = self.nodes[1].walletprocesspsbt(psbt_orig, False, "ALL")['psbt'] @@ -554,6 +556,13 @@ def run_test(self): # Creator Tests for creator in creators: + new_outputs = {} + for k in creator['outputs']: + new_key = convert_btc_bech32_address_to_qtum(list(k.keys())[0]) + new_value = list(k.values())[0] + new_outputs[new_key] = new_value + creator['outputs'] = new_outputs + created_tx = self.nodes[0].createpsbt(inputs=creator['inputs'], outputs=creator['outputs'], replaceable=False) assert_equal(created_tx, creator['result']) @@ -696,7 +705,7 @@ def test_psbt_input_keys(psbt_input, keys): assert_equal(analysis['error'], 'PSBT is not valid. Input 0 spends unspendable output') self.log.info("PSBT with invalid values should have error message and Creator as next") - analysis = self.nodes[0].analyzepsbt('cHNidP8BAHECAAAAAfA00BFgAm6tp86RowwH6BMImQNL5zXUcTT97XoLGz0BAAAAAAD/////AgD5ApUAAAAAFgAUKNw0x8HRctAgmvoevm4u1SbN7XL87QKVAAAAABYAFPck4gF7iL4NL4wtfRAKgQbghiTUAAAAAAABAR8AgIFq49AHABYAFJUDtxf2PHo641HEOBOAIvFMNTr2AAAA') + analysis = self.nodes[0].analyzepsbt('cHNidP8BAHECAAAAAfA00BFgAm6tp86RowwH6BMImQNL5zXUcTT97XoLGz0BAAAAAAD/////AgD5ApUAAAAAFgAUKNw0x8HRctAgmvoevm4u1SbN7XL87QKVAAAAABYAFPck4gF7iL4NL4wtfRAKgQbghiTUAAAAAAABAR8AAJPzil4mABYAFJUDtxf2PHo641HEOBOAIvFMNTr2AAAA') assert_equal(analysis['next'], 'creator') assert_equal(analysis['error'], 'PSBT is not valid. Input 0 has invalid value') @@ -704,7 +713,7 @@ def test_psbt_input_keys(psbt_input, keys): analysis = self.nodes[0].analyzepsbt('cHNidP8BAHECAAAAAZYezcxdnbXoQCmrD79t/LzDgtUo9ERqixk8wgioAobrAAAAAAD9////AlDDAAAAAAAAFgAUy/UxxZuzZswcmFnN/E9DGSiHLUsuGPUFAAAAABYAFLsH5o0R38wXx+X2cCosTMCZnQ4baAAAAAABAR8A4fUFAAAAABYAFOBI2h5thf3+Lflb2LGCsVSZwsltIgIC/i4dtVARCRWtROG0HHoGcaVklzJUcwo5homgGkSNAnJHMEQCIGx7zKcMIGr7cEES9BR4Kdt/pzPTK3fKWcGyCJXb7MVnAiALOBgqlMH4GbC1HDh/HmylmO54fyEy4lKde7/BT/PWxwEBAwQBAAAAIgYC/i4dtVARCRWtROG0HHoGcaVklzJUcwo5homgGkSNAnIYDwVpQ1QAAIABAACAAAAAgAAAAAAAAAAAAAAiAgL+CIiB59NSCssOJRGiMYQK1chahgAaaJpIXE41Cyir+xgPBWlDVAAAgAEAAIAAAACAAQAAAAAAAAAA') assert_equal(analysis['next'], 'finalizer') - analysis = self.nodes[0].analyzepsbt('cHNidP8BAHECAAAAAfA00BFgAm6tp86RowwH6BMImQNL5zXUcTT97XoLGz0BAAAAAAD/////AgCAgWrj0AcAFgAUKNw0x8HRctAgmvoevm4u1SbN7XL87QKVAAAAABYAFPck4gF7iL4NL4wtfRAKgQbghiTUAAAAAAABAR8A8gUqAQAAABYAFJUDtxf2PHo641HEOBOAIvFMNTr2AAAA') + analysis = self.nodes[0].analyzepsbt('cHNidP8BAHECAAAAAfA00BFgAm6tp86RowwH6BMImQNL5zXUcTT97XoLGz0BAAAAAAD/////AgAAk/OKXiYAFgAUKNw0x8HRctAgmvoevm4u1SbN7XL87QKVAAAAABYAFPck4gF7iL4NL4wtfRAKgQbghiTUAAAAAAABAR8A8gUqAQAAABYAFJUDtxf2PHo641HEOBOAIvFMNTr2AAAA') assert_equal(analysis['next'], 'creator') assert_equal(analysis['error'], 'PSBT is not valid. Output amount invalid') @@ -872,9 +881,9 @@ def test_psbt_input_keys(psbt_input, keys): self.log.info("Test that walletprocesspsbt both updates and signs a non-updated psbt containing Taproot inputs") addr = self.nodes[0].getnewaddress("", "bech32m") - txid = self.nodes[0].sendtoaddress(addr, 1) + txid = self.nodes[0].sendtoaddress(addr, 10) vout = find_vout_for_address(self.nodes[0], txid, addr) - psbt = self.nodes[0].createpsbt([{"txid": txid, "vout": vout}], [{self.nodes[0].getnewaddress(): 0.9995}]) + psbt = self.nodes[0].walletcreatefundedpsbt(inputs=[{"txid": txid, "vout": vout}], outputs=[{self.nodes[0].getnewaddress(): 0.9999}], options={"fee_rate": 40800})["psbt"] signed = self.nodes[0].walletprocesspsbt(psbt) rawtx = signed["hex"] self.nodes[0].sendrawtransaction(rawtx) diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py index 5ea11768ad..fbb4339fa1 100755 --- a/test/functional/rpc_rawtransaction.py +++ b/test/functional/rpc_rawtransaction.py @@ -90,7 +90,7 @@ def run_test(self): self.getrawtransaction_tests() self.createrawtransaction_tests() self.sendrawtransaction_tests() - # self.sendrawtransaction_testmempoolaccept_tests() + self.sendrawtransaction_testmempoolaccept_tests() self.decoderawtransaction_tests() self.transaction_version_number_tests() if self.is_specified_wallet_compiled() and not self.options.descriptors: @@ -369,7 +369,7 @@ def sendrawtransaction_tests(self): # Test that oversized script gets rejected by sendrawtransaction tx = self.wallet.create_self_transfer()['tx'] tx_val = 0.001 - tx.vout = [CTxOut(int(Decimal(tx_val) * COIN), CScript([OP_FALSE] * 10001))] + tx.vout = [CTxOut(int(Decimal(tx_val) * COIN), CScript([OP_FALSE] * 1000001))] tx_hex = tx.serialize().hex() assert_raises_rpc_error(-25, max_burn_exceeded, self.nodes[2].sendrawtransaction, tx_hex) @@ -407,13 +407,13 @@ def sendrawtransaction_testmempoolaccept_tests(self): # Test a transaction with a small fee. # Fee rate is 0.00100000 BTC/kvB - tx = self.wallet.create_self_transfer(fee_rate=Decimal('0.00100000')) + tx = self.wallet.create_self_transfer(fee_rate=Decimal('0.100000')) # Thus, testmempoolaccept should reject - testres = self.nodes[2].testmempoolaccept([tx['hex']], 0.00001000)[0] + testres = self.nodes[2].testmempoolaccept([tx['hex']], 0.001000)[0] assert_equal(testres['allowed'], False) assert_equal(testres['reject-reason'], 'max-fee-exceeded') # and sendrawtransaction should throw - assert_raises_rpc_error(-25, fee_exceeds_max, self.nodes[2].sendrawtransaction, tx['hex'], 0.00001000) + assert_raises_rpc_error(-25, fee_exceeds_max, self.nodes[2].sendrawtransaction, tx['hex'], 0.001000) # and the following calls should both succeed testres = self.nodes[2].testmempoolaccept(rawtxs=[tx['hex']])[0] assert_equal(testres['allowed'], True) @@ -421,7 +421,7 @@ def sendrawtransaction_testmempoolaccept_tests(self): # Test a transaction with a large fee. # Fee rate is 0.20000000 BTC/kvB - tx = self.wallet.create_self_transfer(fee_rate=Decimal("0.20000000")) + tx = self.wallet.create_self_transfer(fee_rate=Decimal("2.0000000")) # Thus, testmempoolaccept should reject testres = self.nodes[2].testmempoolaccept([tx['hex']])[0] assert_equal(testres['allowed'], False) diff --git a/test/functional/rpc_scanblocks.py b/test/functional/rpc_scanblocks.py index 8b4aebc77a..2c49e9ec7a 100755 --- a/test/functional/rpc_scanblocks.py +++ b/test/functional/rpc_scanblocks.py @@ -18,7 +18,9 @@ MiniWallet, getnewdestination, ) +from test_framework.qtum import convert_btc_address_to_qtum +import random class ScanblocksTest(BitcoinTestFramework): def set_test_params(self): @@ -37,7 +39,7 @@ def run_test(self): # send 1.0, mempool only # childkey 5 of `parent_key` wallet.send_to(from_node=node, - scriptPubKey=address_to_scriptpubkey("mkS4HXoTYWRTescLGaUTGbtTTYX5EjJyEE"), + scriptPubKey=address_to_scriptpubkey(convert_btc_address_to_qtum("mkS4HXoTYWRTescLGaUTGbtTTYX5EjJyEE")), amount=1 * COIN) # mine a block and assure that the mined blockhash is in the filterresult @@ -90,7 +92,7 @@ def run_test(self): genesis_spks = bip158_relevant_scriptpubkeys(node, genesis_blockhash) assert_equal(len(genesis_spks), 1) genesis_coinbase_spk = list(genesis_spks)[0] - false_positive_spk = bytes.fromhex("001400000000000000000000000000000000000cadcb") + false_positive_spk = bytes.fromhex("d271948696ba4beef1e514e7040f8d5d6a9eb86add") genesis_coinbase_hash = bip158_basic_element_hash(genesis_coinbase_spk, 1, genesis_blockhash) false_positive_hash = bip158_basic_element_hash(false_positive_spk, 1, genesis_blockhash) diff --git a/test/functional/rpc_validateaddress.py b/test/functional/rpc_validateaddress.py index d87ba098c3..e0c8f790d4 100755 --- a/test/functional/rpc_validateaddress.py +++ b/test/functional/rpc_validateaddress.py @@ -5,34 +5,35 @@ """Test validateaddress for main chain""" from test_framework.test_framework import BitcoinTestFramework +from test_framework.qtum import convert_btc_bech32_address_to_qtum from test_framework.util import assert_equal INVALID_DATA = [ # BIP 173 ( - "tc1qw508d6qejxtdg4y5r3zarvary0c5xw7kg3g4ty", + "tc1quyzcrlk72erlphx0v2wphsna0tsaat488kyt9h", "Invalid or unsupported Segwit (Bech32) or Base58 encoding.", # Invalid hrp [], ), - ("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t5", "Invalid Bech32 checksum", [41]), + ( "qc1qyeelyp74mcw5ddm959l5smnzzgf387psv9a2gg", "Invalid Bech32 checksum", [41]), ( - "BC13W508D6QEJXTDG4Y5R3ZARVARY0C5XW7KN40WF2", + convert_btc_bech32_address_to_qtum("BC13W508D6QEJXTDG4Y5R3ZARVARY0C5XW7KN40WF2", main=True).upper(), "Version 1+ witness address must use Bech32m checksum", [], ), ( - "bc1rw5uspcuh", + convert_btc_bech32_address_to_qtum("bc1rw5uspcuh", main=True), "Version 1+ witness address must use Bech32m checksum", # Invalid program length [], ), ( - "bc10w508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kw5rljs90", + convert_btc_bech32_address_to_qtum("bc10w508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kw5rljs90", main=True), "Version 1+ witness address must use Bech32m checksum", # Invalid program length [], ), ( - "BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P", + convert_btc_bech32_address_to_qtum("BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P", main=True).upper(), "Invalid Bech32 v0 address program size (16 bytes), per BIP141", [], ), @@ -42,29 +43,29 @@ [], ), ( - "BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3t4", + "QC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3t4", "Invalid character or mixed case", # bc1, Mixed case, not in BIP 173 test vectors [40], ), ( - "bc1zw508d6qejxtdg4y5r3zarvaryvqyzf3du", + convert_btc_bech32_address_to_qtum("bc1zw508d6qejxtdg4y5r3zarvaryvqyzf3du", main=True), "Version 1+ witness address must use Bech32m checksum", # Wrong padding [], ), ( - "tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3pjxtptv", + "tc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3pjxtptv", "Invalid or unsupported Segwit (Bech32) or Base58 encoding.", # tb1, Non-zero padding in 8-to-5 conversion [], ), - ("bc1gmk9yu", "Empty Bech32 data section", []), - # BIP 350 + (convert_btc_bech32_address_to_qtum("bc1gmk9yu", main=True), "Empty Bech32 data section", []), + # BIP 350 ( - "tc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vq5zuyut", + "tb1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vpggkg4j", "Invalid or unsupported Segwit (Bech32) or Base58 encoding.", # Invalid human-readable part [], ), ( - "bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqh2y7hd", + convert_btc_bech32_address_to_qtum("bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqh2y7hd", main=True), "Version 1+ witness address must use Bech32m checksum", # Invalid checksum (Bech32 instead of Bech32m) [], ), @@ -74,12 +75,12 @@ [], ), ( - "BC1S0XLXVLHEMJA6C4DQV22UAPCTQUPFHLXM9H8Z3K2E72Q4K9HCZ7VQ54WELL", + convert_btc_bech32_address_to_qtum("BC1S0XLXVLHEMJA6C4DQV22UAPCTQUPFHLXM9H8Z3K2E72Q4K9HCZ7VQ54WELL", main=True).upper(), "Version 1+ witness address must use Bech32m checksum", # Invalid checksum (Bech32 instead of Bech32m) [], ), ( - "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kemeawh", + convert_btc_bech32_address_to_qtum("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kemeawh", main=True), "Version 0 witness address must use Bech32 checksum", # Invalid checksum (Bech32m instead of Bech32) [], ), @@ -89,47 +90,47 @@ [], ), ( - "bc1p38j9r5y49hruaue7wxjce0updqjuyyx0kh56v8s25huc6995vvpql3jow4", + "qc1p38j9r5y49hruaue7wxjce0updqjuyyx0kh56v8s25huc6995vvpql3jow4", "Invalid Base 32 character", # Invalid character in checksum [59], ), ( - "BC130XLXVLHEMJA6C4DQV22UAPCTQUPFHLXM9H8Z3K2E72Q4K9HCZ7VQ7ZWS8R", + convert_btc_bech32_address_to_qtum("BC130XLXVLHEMJA6C4DQV22UAPCTQUPFHLXM9H8Z3K2E72Q4K9HCZ7VQ7ZWS8R", main=True).upper(), "Invalid Bech32 address witness version", [], ), - ("bc1pw5dgrnzv", "Invalid Bech32 address program size (1 byte)", []), + (convert_btc_bech32_address_to_qtum("bc1pw5dgrnzv", main=True), "Invalid Bech32 address program size (1 byte)", []), ( - "bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7v8n0nx0muaewav253zgeav", + convert_btc_bech32_address_to_qtum("bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7v8n0nx0muaewav253zgeav", main=True), "Invalid Bech32 address program size (41 bytes)", [], ), ( - "BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P", + convert_btc_bech32_address_to_qtum("BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P", main=True).upper(), "Invalid Bech32 v0 address program size (16 bytes), per BIP141", [], ), ( - "tb1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vq47Zagq", + "tq1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vq47Zagq", "Invalid or unsupported Segwit (Bech32) or Base58 encoding.", # tb1, Mixed case [], ), ( - "bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7v07qwwzcrf", + convert_btc_bech32_address_to_qtum("bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7v07qwwzcrf", main=True), "Invalid padding in Bech32 data section", # zero padding of more than 4 bits [], ), ( - "tb1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vpggkg4j", + "tq1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vpggkg4j", "Invalid or unsupported Segwit (Bech32) or Base58 encoding.", # tb1, Non-zero padding in 8-to-5 conversion [], ), - ("bc1gmk9yu", "Empty Bech32 data section", []), + (convert_btc_bech32_address_to_qtum("bc1gmk9yu", main=True), "Empty Bech32 data section", []), ] VALID_DATA = [ # BIP 350 ( - "BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4", + convert_btc_bech32_address_to_qtum("BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4", main=True), "0014751e76e8199196d454941c45d1b3a323f1433bd6", ), # ( @@ -137,21 +138,21 @@ # "00201863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262", # ), ( - "bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3", + convert_btc_bech32_address_to_qtum("bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3", main=True), "00201863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262", ), ( - "bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kt5nd6y", + convert_btc_bech32_address_to_qtum("bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kt5nd6y", main=True), "5128751e76e8199196d454941c45d1b3a323f1433bd6751e76e8199196d454941c45d1b3a323f1433bd6", ), - ("BC1SW50QGDZ25J", "6002751e"), - ("bc1zw508d6qejxtdg4y5r3zarvaryvaxxpcs", "5210751e76e8199196d454941c45d1b3a323"), + (convert_btc_bech32_address_to_qtum("BC1SW50QGDZ25J", main=True), "6002751e"), + (convert_btc_bech32_address_to_qtum("bc1zw508d6qejxtdg4y5r3zarvaryvaxxpcs", main=True), "5210751e76e8199196d454941c45d1b3a323"), # ( # "tb1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesrxh6hy", # "0020000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433", # ), ( - "bc1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvses5wp4dt", + convert_btc_bech32_address_to_qtum("bc1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvses5wp4dt", main=True), "0020000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433", ), # ( @@ -159,13 +160,17 @@ # "5120000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433", # ), ( - "bc1pqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvses7epu4h", + convert_btc_bech32_address_to_qtum("bc1pqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvses7epu4h", main=True), "5120000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433", ), ( - "bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0", + convert_btc_bech32_address_to_qtum("bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0", main=True), "512079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", ), + ( + "QcE4AavBwevi38EkYfaweLtSkix6cyuwCy", + "76a914ab5c3f6a583e6242da2f118a8b8d761e529453cf88ac", + ), ] diff --git a/test/functional/test_framework/qtum.py b/test/functional/test_framework/qtum.py index f79b377171..ad1e88d029 100644 --- a/test/functional/test_framework/qtum.py +++ b/test/functional/test_framework/qtum.py @@ -99,7 +99,7 @@ def convert_btc_address_to_qtum(addr, main=False): def convert_btc_bech32_address_to_qtum(addr, main=False, encoding=Encoding.BECH32): encoding, hdr, data = bech32_decode(addr) - return bech32_encode(encoding, 'qcrt', data) + return bech32_encode(encoding, 'qcrt' if not main else 'qc', data) def p2pkh_to_hex_hash(address): diff --git a/test/functional/wallet_balance.py b/test/functional/wallet_balance.py index 394ca14db2..32c9a35428 100755 --- a/test/functional/wallet_balance.py +++ b/test/functional/wallet_balance.py @@ -93,8 +93,8 @@ def run_test(self): self.sync_all() # Verify listunspent returns immature coinbase if 'include_immature_coinbase' is set - assert_equal(len(self.nodes[0].listunspent(query_options={'include_immature_coinbase': True})), 1) - assert_equal(len(self.nodes[0].listunspent(query_options={'include_immature_coinbase': False})), 0) + assert_equal(len(self.nodes[2].listunspent(query_options={'include_immature_coinbase': True})), 2002) + assert_equal(len(self.nodes[2].listunspent(query_options={'include_immature_coinbase': False})), 2) generatesynchronized(self.nodes[1], COINBASE_MATURITY+1, ADDRESS_WATCHONLY, self.nodes) self.sync_blocks() diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py index 349dd21b2a..dcbe011131 100755 --- a/test/functional/wallet_bumpfee.py +++ b/test/functional/wallet_bumpfee.py @@ -314,8 +314,8 @@ def test_simple_bumpfee_succeeds(self, mode, rbf_node, peer_node, dest_address): bumped_tx = rbf_node.bumpfee(rbfid, fee_rate=NORMAL) elif mode == "new_outputs": new_address = peer_node.getnewaddress() - bumped_psbt = rbf_node.psbtbumpfee(rbfid, outputs={new_address: 0.0003}) - bumped_tx = rbf_node.bumpfee(rbfid, outputs={new_address: 0.0003}) + bumped_psbt = rbf_node.psbtbumpfee(rbfid, outputs={new_address: 0.003}) + bumped_tx = rbf_node.bumpfee(rbfid, outputs={new_address: 0.003}) else: bumped_psbt = rbf_node.psbtbumpfee(rbfid) bumped_tx = rbf_node.bumpfee(rbfid) @@ -794,7 +794,7 @@ def spend_one_input(node, dest_address, change_size=Decimal("0.04900000"), data= def test_no_more_inputs_fails(self, rbf_node, dest_address): # Throw away some coins to a dummy address so that the test does not hit the max tx size error - rbf_node.sendtoaddress("qc4bREjo85FRxUMatqVTVAeaD4XKGHswgm", rbf_node.getbalance()/2) + rbf_node.sendtoaddress("qc4bREjo85FRxUMatqVTVAeaD4XKGHswgm", int(rbf_node.getbalance()/2)) self.log.info('Test that bumpfee fails when there are no available confirmed outputs') # feerate rbf requires confirmed outputs when change output doesn't exist or is insufficient self.generatetoaddress(rbf_node, 1, dest_address) @@ -813,7 +813,7 @@ def test_feerate_checks_replaced_outputs(self, rbf_node, peer_node): outputs = [] for i in range(50): outputs.append({rbf_node.getnewaddress(address_type="bech32"): 1}) - tx_res = rbf_node.send(outputs=outputs, fee_rate=5) + tx_res = rbf_node.send(outputs=outputs, fee_rate=500) tx_details = rbf_node.gettransaction(txid=tx_res["txid"], verbose=True) # Calculate the minimum feerate required for the bump to work. diff --git a/test/functional/wallet_fundrawtransaction.py b/test/functional/wallet_fundrawtransaction.py index be0d0a3ba1..c51d5ee428 100755 --- a/test/functional/wallet_fundrawtransaction.py +++ b/test/functional/wallet_fundrawtransaction.py @@ -999,9 +999,9 @@ def test_transaction_too_large(self): # shouldn't use BnB and instead fall back to Knapsack but that behavior # is not implemented yet. For now we just check that we get an error. # First, force the wallet to bulk-generate the addresses we'll need. - recipient.keypoolrefill(3222) - for _ in range(3222): - outputs[recipient.getnewaddress()] = 0.1 + recipient.keypoolrefill(322) + for _ in range(322): + outputs[recipient.getnewaddress()] = 0.001 wallet.sendmany("", outputs) self.generate(self.nodes[0], 10) # assert_raises_rpc_error(-4, "The inputs size exceeds the maximum weight. " @@ -1426,7 +1426,7 @@ def test_input_confs_control(self): self.log.info("Crafting TX using an unconfirmed input") target_address = self.nodes[2].getnewaddress() raw_tx1 = wallet.createrawtransaction([], {target_address: 0.1}, 0, True) - funded_tx1 = wallet.fundrawtransaction(raw_tx1, {'fee_rate': 1, 'maxconf': 0})['hex'] + funded_tx1 = wallet.fundrawtransaction(raw_tx1, {'fee_rate': 600, 'maxconf': 0})['hex'] # Make sure we only had the one input tx1_inputs = self.nodes[0].decoderawtransaction(funded_tx1)['vin'] @@ -1452,12 +1452,12 @@ def test_input_confs_control(self): # So, the selection process, to cover the amount, will pick up the 'final_tx1' output as well, which is an output of the tx that this # new tx is replacing!. So, once we send it to the mempool, it will return a "bad-txns-spends-conflicting-tx" # because the input will no longer exist once the first tx gets replaced by this new one). - funded_invalid = wallet.fundrawtransaction(raw_tx2, {'add_inputs': True, 'maxconf': 0, 'fee_rate': 10})['hex'] + funded_invalid = wallet.fundrawtransaction(raw_tx2, {'add_inputs': True, 'maxconf': 0, 'fee_rate': 1200})['hex'] final_invalid = wallet.signrawtransactionwithwallet(funded_invalid)['hex'] assert_raises_rpc_error(-26, "bad-txns-spends-conflicting-tx", self.nodes[0].sendrawtransaction, final_invalid) self.log.info("Craft a replacement adding inputs with highest depth possible") - funded_tx2 = wallet.fundrawtransaction(raw_tx2, {'add_inputs': True, 'minconf': 2, 'fee_rate': 10})['hex'] + funded_tx2 = wallet.fundrawtransaction(raw_tx2, {'add_inputs': True, 'minconf': 2, 'fee_rate': 900})['hex'] tx2_inputs = self.nodes[0].decoderawtransaction(funded_tx2)['vin'] assert_greater_than_or_equal(len(tx2_inputs), 2) for vin in tx2_inputs: diff --git a/test/functional/wallet_importdescriptors.py b/test/functional/wallet_importdescriptors.py index 53fcbff707..a3aea3625e 100755 --- a/test/functional/wallet_importdescriptors.py +++ b/test/functional/wallet_importdescriptors.py @@ -695,7 +695,7 @@ def run_test(self): encrypted_wallet.walletpassphrase("passphrase", 99999) with concurrent.futures.ThreadPoolExecutor(max_workers=1) as thread: - with self.nodes[0].assert_debug_log(expected_msgs=["Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)"], timeout=5): + with self.nodes[0].assert_debug_log(expected_msgs=["Rescan started from block 665ed5b402ac0b44efc37d8926332994363e8a7278b7ee9a58fb972efadae943... (slow variant inspecting all blocks)"], timeout=5): importing = thread.submit(encrypted_wallet.importdescriptors, requests=[descriptor]) # Set the passphrase timeout to 1 to test that the wallet remains unlocked during the rescan diff --git a/test/functional/wallet_signer.py b/test/functional/wallet_signer.py index d523419da4..923aaf13ce 100755 --- a/test/functional/wallet_signer.py +++ b/test/functional/wallet_signer.py @@ -49,8 +49,8 @@ def set_test_params(self): self.num_nodes = 2 self.extra_args = [ - [], - [f"-signer={self.mock_signer_path()}", '-keypool=10'], + ["-addresstype=bech32", "-minrelaytxfee=0.00001"], + [f"-signer={self.mock_signer_path()}", '-keypool=10', "-addresstype=bech32", "-minrelaytxfee=0.00001"], ] def skip_test_if_missing_module(self): @@ -169,7 +169,7 @@ def test_valid_signer(self): assert_equal(result[1], {'success': True}) assert_equal(mock_wallet.getwalletinfo()["txcount"], 1) dest = self.nodes[0].getnewaddress(address_type='bech32') - mock_psbt = mock_wallet.walletcreatefundedpsbt([], {dest:0.5}, 0, {'replaceable': True, 'change_type': 'bech32'}, True)['psbt'] + mock_psbt = mock_wallet.walletcreatefundedpsbt([], {dest:0.5}, 0, {'replaceable': True}, True)['psbt'] mock_psbt_signed = mock_wallet.walletprocesspsbt(psbt=mock_psbt, sign=True, sighashtype="ALL", bip32derivs=True) mock_tx = mock_psbt_signed["hex"] assert mock_wallet.testmempoolaccept([mock_tx])[0]["allowed"] diff --git a/test/functional/wallet_transactiontime_rescan.py b/test/functional/wallet_transactiontime_rescan.py index 4124acce4a..f6c7f87e5a 100755 --- a/test/functional/wallet_transactiontime_rescan.py +++ b/test/functional/wallet_transactiontime_rescan.py @@ -202,7 +202,7 @@ def run_test(self): encrypted_wallet.sethdseed(seed=hd_seed) with concurrent.futures.ThreadPoolExecutor(max_workers=1) as thread: - with minernode.assert_debug_log(expected_msgs=["Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)"], timeout=5): + with minernode.assert_debug_log(expected_msgs=["Rescan started from block 665ed5b402ac0b44efc37d8926332994363e8a7278b7ee9a58fb972efadae943... (slow variant inspecting all blocks)"], timeout=5): rescanning = thread.submit(encrypted_wallet.rescanblockchain) # set the passphrase timeout to 1 to test that the wallet remains unlocked during the rescan @@ -218,7 +218,7 @@ def run_test(self): except JSONRPCException as e: assert e.error["code"] == -4 and "Error: the wallet is currently being used to rescan the blockchain for related transactions. Please call `abortrescan` before changing the passphrase." in e.error["message"] - assert_equal(rescanning.result(), {"start_height": 0, "stop_height": 803}) + assert_equal(rescanning.result(), {"start_height": 0, "stop_height": 14103}) assert_equal(encrypted_wallet.getbalance(), temp_wallet.getbalance()) diff --git a/test/lint/lint-files.py b/test/lint/lint-files.py index f2b5db681b..f9286a0bb8 100755 --- a/test/lint/lint-files.py +++ b/test/lint/lint-files.py @@ -91,7 +91,7 @@ def check_all_filenames(files) -> int: for filename in filenames: if not filename_regex.match(filename): print( - f"""File {repr(filename)} does not not match the allowed filename regexp ('{ALLOWED_FILENAME_REGEXP}').""" + f"""File {repr(filename)} does not match the allowed filename regexp ('{ALLOWED_FILENAME_REGEXP}').""" ) failed_tests += 1 return failed_tests @@ -111,7 +111,7 @@ def check_source_filenames(files) -> int: for filename in filenames: if not filename_regex.match(filename) and not filename_exception_regex.match(filename): print( - f"""File {repr(filename)} does not not match the allowed source filename regexp ('{ALLOWED_SOURCE_FILENAME_REGEXP}'), or the exception regexp ({ALLOWED_SOURCE_FILENAME_EXCEPTION_REGEXP}).""" + f"""File {repr(filename)} does not match the allowed source filename regexp ('{ALLOWED_SOURCE_FILENAME_REGEXP}'), or the exception regexp ({ALLOWED_SOURCE_FILENAME_EXCEPTION_REGEXP}).""" ) failed_tests += 1 return failed_tests