From 9dbe6a03f0d6e70ccdf8e8715f888c0c17216bee Mon Sep 17 00:00:00 2001 From: glozow Date: Thu, 23 May 2024 14:29:32 +0100 Subject: [PATCH] [test] wallet uses CURRENT_VERSION which is 2 --- test/functional/wallet_create_tx.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/functional/wallet_create_tx.py b/test/functional/wallet_create_tx.py index 4e31b48ec0142..fb1ee3ae6162a 100755 --- a/test/functional/wallet_create_tx.py +++ b/test/functional/wallet_create_tx.py @@ -3,6 +3,9 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. +from test_framework.messages import ( + tx_from_hex, +) from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, @@ -33,6 +36,7 @@ def run_test(self): self.test_anti_fee_sniping() self.test_tx_size_too_large() self.test_create_too_long_mempool_chain() + self.test_version3() def test_anti_fee_sniping(self): self.log.info('Check that we have some (old) blocks and that anti-fee-sniping is disabled') @@ -106,6 +110,23 @@ def test_create_too_long_mempool_chain(self): test_wallet.unloadwallet() + def test_version3(self): + self.log.info('Check wallet does not create transactions with nVersion=3 yet') + wallet_rpc = self.nodes[0].get_wallet_rpc(self.default_wallet_name) + + self.nodes[0].createwallet("v3") + wallet_v3 = self.nodes[0].get_wallet_rpc("v3") + + tx_data = wallet_rpc.send(outputs=[{wallet_v3.getnewaddress(): 25}], options={"change_position": 0}) + wallet_tx_data = wallet_rpc.gettransaction(tx_data["txid"]) + tx_current_version = tx_from_hex(wallet_tx_data["hex"]) + + # While v3 transactions are standard, the CURRENT_VERSION is 2. + # This test can be removed if CURRENT_VERSION is changed, and replaced with tests that the + # wallet handles v3 rules properly. + assert_equal(tx_current_version.nVersion, 2) + wallet_v3.unloadwallet() + if __name__ == '__main__': CreateTxWalletTest().main()