Skip to content

Commit

Permalink
[test] wallet uses CURRENT_VERSION which is 2
Browse files Browse the repository at this point in the history
  • Loading branch information
glozow committed Jun 2, 2024
1 parent 539404f commit 9dbe6a0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/functional/wallet_create_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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()

0 comments on commit 9dbe6a0

Please sign in to comment.