|
3 | 3 | # Distributed under the MIT software license, see the accompanying
|
4 | 4 | # file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5 | 5 |
|
| 6 | +from test_framework.messages import ( |
| 7 | + tx_from_hex, |
| 8 | +) |
6 | 9 | from test_framework.test_framework import BitcoinTestFramework
|
7 | 10 | from test_framework.util import (
|
8 | 11 | assert_equal,
|
@@ -33,6 +36,7 @@ def run_test(self):
|
33 | 36 | self.test_anti_fee_sniping()
|
34 | 37 | self.test_tx_size_too_large()
|
35 | 38 | self.test_create_too_long_mempool_chain()
|
| 39 | + self.test_version3() |
36 | 40 |
|
37 | 41 | def test_anti_fee_sniping(self):
|
38 | 42 | 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):
|
106 | 110 |
|
107 | 111 | test_wallet.unloadwallet()
|
108 | 112 |
|
| 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 | + |
109 | 130 |
|
110 | 131 | if __name__ == '__main__':
|
111 | 132 | CreateTxWalletTest().main()
|
0 commit comments