File tree Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -71,9 +71,13 @@ class InputMissing(BadTxTemplate):
71
71
reject_reason = "bad-txns-vin-empty"
72
72
expect_disconnect = False
73
73
74
+ # We use a blank transaction here to make sure
75
+ # it is interpreted as a non-witness transaction.
76
+ # Otherwise the transaction will fail the
77
+ # "surpufluous witness" check during deserialization
78
+ # rather than the input count check.
74
79
def get_tx (self ):
75
80
tx = CTransaction ()
76
- tx .vout .append (CTxOut (0 , sc .CScript ([sc .OP_TRUE ] * 100 )))
77
81
tx .calc_sha256 ()
78
82
return tx
79
83
Original file line number Diff line number Diff line change @@ -146,20 +146,6 @@ def run_test(self):
146
146
badtx = template .get_tx ()
147
147
if TxTemplate != invalid_txs .InputMissing :
148
148
self .sign_tx (badtx , attempt_spend_tx )
149
- else :
150
- # Segwit is active in regtest at this point, so to deserialize a
151
- # transaction without any inputs correctly, we set the outputs
152
- # to an empty list. This is a hack, as the serialization of an
153
- # empty list of outputs is deserialized as flags==0 and thus
154
- # deserialization of the outputs is skipped.
155
- # A policy check requires "loose" txs to be of a minimum size,
156
- # so vtx is not set to be empty in the TxTemplate class and we
157
- # only apply the workaround where txs are not "loose", i.e. in
158
- # blocks.
159
- #
160
- # The workaround has the purpose that both sides calculate
161
- # the same tx hash in the merkle tree
162
- badtx .vout = []
163
149
badtx .rehash ()
164
150
badblock = self .update_block (blockname , [badtx ])
165
151
self .send_blocks (
You can’t perform that action at this time.
0 commit comments