Skip to content

Commit 1eef038

Browse files
committed
Merge #7562: Bump transaction version default to 2
c5c92c4 Update python tests for default tx version=2 (BtcDrak) dab207e Preserve tx version=1 for certain tests (BtcDrak) c5d746a tiny test fix for mempool_tests (Alex Morcos) 1f0ca1a Bump default transaction version to 2 (BtcDrak)
2 parents 5bc209c + c5c92c4 commit 1eef038

22 files changed

+116
-44
lines changed

qa/rpc-tests/bip68-112-113-p2p.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ def get_tests(self):
289289
# BIP113 test transaction will be modified before each use to put in appropriate block time
290290
bip113tx_v1 = self.create_transaction(self.nodes[0], bip113input, self.nodeaddress, Decimal("49.98"))
291291
bip113tx_v1.vin[0].nSequence = 0xFFFFFFFE
292+
bip113tx_v1.nVersion = 1
292293
bip113tx_v2 = self.create_transaction(self.nodes[0], bip113input, self.nodeaddress, Decimal("49.98"))
293294
bip113tx_v2.vin[0].nSequence = 0xFFFFFFFE
294295
bip113tx_v2.nVersion = 2

qa/rpc-tests/mempool_reorg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def run_test(self):
5555
# Create a block-height-locked transaction which will be invalid after reorg
5656
timelock_tx = self.nodes[0].createrawtransaction([{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 49.99})
5757
# Set the time lock
58-
timelock_tx = timelock_tx.replace("ffffffff", "11111111", 1)
58+
timelock_tx = timelock_tx.replace("ffffffff", "11111191", 1)
5959
timelock_tx = timelock_tx[:-8] + hex(self.nodes[0].getblockcount() + 2)[2:] + "000000"
6060
timelock_tx = self.nodes[0].signrawtransaction(timelock_tx)["hex"]
6161
assert_raises(JSONRPCException, self.nodes[0].sendrawtransaction, timelock_tx)

src/primitives/transaction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class CTransaction
363363
{
364364
public:
365365
// Default transaction version.
366-
static const int32_t CURRENT_VERSION=1;
366+
static const int32_t CURRENT_VERSION=2;
367367

368368
// Changing the default transaction version requires a two step process: first
369369
// adapting relay policy by bumping MAX_STANDARD_VERSION, and then later date

src/test/data/bitcoin-util-test.json

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
[
22
{ "exec": "./bitcoin-tx",
3-
"args": ["-create"],
4-
"output_cmp": "blanktx.hex",
5-
"description": "Creates a blank transaction"
3+
"args": ["-create", "nversion=1"],
4+
"output_cmp": "blanktxv1.hex",
5+
"description": "Creates a blank v1 transaction"
66
},
77
{ "exec": "./bitcoin-tx",
88
"args": ["-json","-create"],
9-
"output_cmp": "blanktx.json",
9+
"output_cmp": "blanktxv2.json",
1010
"description": "Creates a blank transaction (output in json)"
1111
},
1212
{ "exec": "./bitcoin-tx",
1313
"args": ["-"],
14-
"input": "blanktx.hex",
15-
"output_cmp": "blanktx.hex",
14+
"input": "blanktxv2.hex",
15+
"output_cmp": "blanktxv2.hex",
1616
"description": "Creates a blank transaction when nothing is piped into bitcoin-tx"
1717
},
1818
{ "exec": "./bitcoin-tx",
1919
"args": ["-json","-"],
20-
"input": "blanktx.hex",
21-
"output_cmp": "blanktx.json",
20+
"input": "blanktxv2.hex",
21+
"output_cmp": "blanktxv2.json",
2222
"description": "Creates a blank transaction when nothing is piped into bitcoin-tx (output in json)"
2323
},
2424
{ "exec": "./bitcoin-tx",
@@ -103,37 +103,48 @@
103103
"description": "Creates a new transaction with a single empty output script (output in json)"
104104
},
105105
{ "exec": "./bitcoin-tx",
106-
"args": ["01000000000100000000000000000000000000"],
106+
"args": ["02000000000100000000000000000000000000"],
107107
"output_cmp": "txcreate2.hex",
108108
"description": "Parses a transation with no inputs and a single output script"
109109
},
110110
{ "exec": "./bitcoin-tx",
111-
"args": ["-json", "01000000000100000000000000000000000000"],
111+
"args": ["-json", "02000000000100000000000000000000000000"],
112112
"output_cmp": "txcreate2.json",
113113
"description": "Parses a transation with no inputs and a single output script (output in json)"
114114
},
115115
{ "exec": "./bitcoin-tx",
116116
"args":
117-
["-create",
117+
["-create", "nversion=1",
118118
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
119119
"set=privatekeys:[\"5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf\"]",
120120
"set=prevtxs:[{\"txid\":\"4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485\",\"vout\":0,\"scriptPubKey\":\"76a91491b24bf9f5288532960ac687abb035127b1d28a588ac\"}]",
121121
"sign=ALL",
122122
"outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"],
123-
"output_cmp": "txcreatesign.hex",
124-
"description": "Creates a new transaction with a single input and a single output, and then signs the transaction"
123+
"output_cmp": "txcreatesignv1.hex",
124+
"description": "Creates a new v1 transaction with a single input and a single output, and then signs the transaction"
125125
},
126126
{ "exec": "./bitcoin-tx",
127127
"args":
128128
["-json",
129-
"-create",
129+
"-create", "nversion=1",
130130
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
131131
"set=privatekeys:[\"5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf\"]",
132132
"set=prevtxs:[{\"txid\":\"4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485\",\"vout\":0,\"scriptPubKey\":\"76a91491b24bf9f5288532960ac687abb035127b1d28a588ac\"}]",
133133
"sign=ALL",
134134
"outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"],
135-
"output_cmp": "txcreatesign.json",
136-
"description": "Creates a new transaction with a single input and a single output, and then signs the transaction (output in json)"
135+
"output_cmp": "txcreatesignv1.json",
136+
"description": "Creates a new v1 transaction with a single input and a single output, and then signs the transaction (output in json)"
137+
},
138+
{ "exec": "./bitcoin-tx",
139+
"args":
140+
["-create",
141+
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
142+
"set=privatekeys:[\"5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf\"]",
143+
"set=prevtxs:[{\"txid\":\"4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485\",\"vout\":0,\"scriptPubKey\":\"76a91491b24bf9f5288532960ac687abb035127b1d28a588ac\"}]",
144+
"sign=ALL",
145+
"outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"],
146+
"output_cmp": "txcreatesignv2.hex",
147+
"description": "Creates a new transaction with a single input and a single output, and then signs the transaction"
137148
},
138149
{ "exec": "./bitcoin-tx",
139150
"args":
@@ -163,12 +174,12 @@
163174
{ "exec": "./bitcoin-tx",
164175
"args":
165176
["-json",
166-
"-create",
177+
"-create", "nversion=1",
167178
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
168179
"outaddr=0.18:13tuJJDR2RgArmgfv6JScSdreahzgc4T6o",
169180
"outdata=4:54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
170181
"output_cmp": "txcreatedata1.json",
171-
"description": "Creates a new transaction with one input, one address output and one data output (output in json)"
182+
"description": "Creates a new v1 transaction with one input, one address output and one data output (output in json)"
172183
},
173184
{ "exec": "./bitcoin-tx",
174185
"args":
File renamed without changes.

src/test/data/blanktxv2.hex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
02000000000000000000

src/test/data/blanktxv2.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"txid": "4ebd325a4b394cff8c57e8317ccf5a8d0e2bdf1b8526f8aad6c8e43d8240621a",
3+
"hash": "4ebd325a4b394cff8c57e8317ccf5a8d0e2bdf1b8526f8aad6c8e43d8240621a",
4+
"version": 2,
5+
"locktime": 0,
6+
"vin": [
7+
],
8+
"vout": [
9+
],
10+
"hex": "02000000000000000000"
11+
}

src/test/data/txcreate1.hex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
01000000031f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000ffffffff7cca453133921c50d5025878f7f738d1df891fd359763331935784cf6b9c82bf1200000000fffffffffccd319e04a996c96cfc0bf4c07539aa90bd0b1a700ef72fae535d6504f9a6220100000000ffffffff0280a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac0084d717000000001976a914f2d4db28cad6502226ee484ae24505c2885cb12d88ac00000000
1+
02000000031f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000ffffffff7cca453133921c50d5025878f7f738d1df891fd359763331935784cf6b9c82bf1200000000fffffffffccd319e04a996c96cfc0bf4c07539aa90bd0b1a700ef72fae535d6504f9a6220100000000ffffffff0280a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac0084d717000000001976a914f2d4db28cad6502226ee484ae24505c2885cb12d88ac00000000

src/test/data/txcreate1.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"txid": "f70f0d6c71416ed538e37549f430ab3665fee2437a42f10238c1bd490e782231",
3-
"hash": "f70f0d6c71416ed538e37549f430ab3665fee2437a42f10238c1bd490e782231",
4-
"version": 1,
2+
"txid": "fe7d174f42dce0cffa7a527e9bc8368956057619ec817648f6138b98f2533e8f",
3+
"hash": "fe7d174f42dce0cffa7a527e9bc8368956057619ec817648f6138b98f2533e8f",
4+
"version": 2,
55
"locktime": 0,
66
"vin": [
77
{
@@ -60,5 +60,5 @@
6060
}
6161
}
6262
],
63-
"hex": "01000000031f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000ffffffff7cca453133921c50d5025878f7f738d1df891fd359763331935784cf6b9c82bf1200000000fffffffffccd319e04a996c96cfc0bf4c07539aa90bd0b1a700ef72fae535d6504f9a6220100000000ffffffff0280a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac0084d717000000001976a914f2d4db28cad6502226ee484ae24505c2885cb12d88ac00000000"
63+
"hex": "02000000031f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000ffffffff7cca453133921c50d5025878f7f738d1df891fd359763331935784cf6b9c82bf1200000000fffffffffccd319e04a996c96cfc0bf4c07539aa90bd0b1a700ef72fae535d6504f9a6220100000000ffffffff0280a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac0084d717000000001976a914f2d4db28cad6502226ee484ae24505c2885cb12d88ac00000000"
6464
}

src/test/data/txcreate2.hex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
01000000000100000000000000000000000000
1+
02000000000100000000000000000000000000

0 commit comments

Comments
 (0)