Skip to content

Commit f783f0e

Browse files
committed
[test] Separate 64B and 63B tx size tests
1 parent d7ebacc commit f783f0e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/functional/data/invalid_txs.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def get_tx(self):
115115

116116
# The following check prevents exploit of lack of merkle
117117
# tree depth commitment (CVE-2017-12842)
118-
class SizeTooSmall(BadTxTemplate):
118+
class SizeExactly64(BadTxTemplate):
119119
reject_reason = "tx-size-small"
120120
expect_disconnect = False
121121
valid_in_block = True
@@ -129,6 +129,20 @@ def get_tx(self):
129129
tx.calc_sha256()
130130
return tx
131131

132+
class SizeSub64(BadTxTemplate):
133+
reject_reason = "tx-size-small"
134+
expect_disconnect = False
135+
valid_in_block = True
136+
137+
def get_tx(self):
138+
tx = CTransaction()
139+
tx.vin.append(self.valid_txin)
140+
tx.vout.append(CTxOut(0, CScript([OP_RETURN] + ([OP_0] * (MIN_PADDING - 3)))))
141+
assert len(tx.serialize_without_witness()) == 63
142+
assert MIN_STANDARD_TX_NONWITNESS_SIZE - 1 == 64
143+
tx.calc_sha256()
144+
return tx
145+
132146

133147
class BadInputOutpointIndex(BadTxTemplate):
134148
# Won't be rejected - nonexistent outpoint index is treated as an orphan since the coins

0 commit comments

Comments
 (0)