Skip to content

Commit 9dbe6a0

Browse files
committed
[test] wallet uses CURRENT_VERSION which is 2
1 parent 539404f commit 9dbe6a0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/functional/wallet_create_tx.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6+
from test_framework.messages import (
7+
tx_from_hex,
8+
)
69
from test_framework.test_framework import BitcoinTestFramework
710
from test_framework.util import (
811
assert_equal,
@@ -33,6 +36,7 @@ def run_test(self):
3336
self.test_anti_fee_sniping()
3437
self.test_tx_size_too_large()
3538
self.test_create_too_long_mempool_chain()
39+
self.test_version3()
3640

3741
def test_anti_fee_sniping(self):
3842
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):
106110

107111
test_wallet.unloadwallet()
108112

113+
def test_version3(self):
114+
self.log.info('Check wallet does not create transactions with nVersion=3 yet')
115+
wallet_rpc = self.nodes[0].get_wallet_rpc(self.default_wallet_name)
116+
117+
self.nodes[0].createwallet("v3")
118+
wallet_v3 = self.nodes[0].get_wallet_rpc("v3")
119+
120+
tx_data = wallet_rpc.send(outputs=[{wallet_v3.getnewaddress(): 25}], options={"change_position": 0})
121+
wallet_tx_data = wallet_rpc.gettransaction(tx_data["txid"])
122+
tx_current_version = tx_from_hex(wallet_tx_data["hex"])
123+
124+
# While v3 transactions are standard, the CURRENT_VERSION is 2.
125+
# This test can be removed if CURRENT_VERSION is changed, and replaced with tests that the
126+
# wallet handles v3 rules properly.
127+
assert_equal(tx_current_version.nVersion, 2)
128+
wallet_v3.unloadwallet()
129+
109130

110131
if __name__ == '__main__':
111132
CreateTxWalletTest().main()

0 commit comments

Comments
 (0)