Skip to content

Commit faf4081

Browse files
author
MarcoFalke
committed
test: Make msg_tx a witness tx
1 parent 7a311fa commit faf4081

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

test/functional/p2p_segwit.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
msg_inv,
3232
msg_tx,
3333
msg_block,
34-
msg_witness_tx,
34+
msg_no_witness_tx,
3535
ser_uint256,
3636
ser_vector,
3737
sha256,
@@ -125,10 +125,11 @@ def test_transaction_acceptance(node, p2p, tx, with_witness, accepted, reason=No
125125
- use the getrawmempool rpc to check for acceptance."""
126126
reason = [reason] if reason else []
127127
with node.assert_debug_log(expected_msgs=reason):
128-
p2p.send_message(msg_witness_tx(tx) if with_witness else msg_tx(tx))
128+
p2p.send_message(msg_tx(tx) if with_witness else msg_no_witness_tx(tx))
129129
p2p.sync_with_ping()
130130
assert_equal(tx.hash in node.getrawmempool(), accepted)
131131

132+
132133
def test_witness_block(node, p2p, block, accepted, with_witness=True, reason=None):
133134
"""Send a block to the node and check that it's accepted
134135
@@ -311,9 +312,9 @@ def test_non_witness_transaction(self):
311312

312313
# Check that serializing it with or without witness is the same
313314
# This is a sanity check of our testing framework.
314-
assert_equal(msg_tx(tx).serialize(), msg_witness_tx(tx).serialize())
315+
assert_equal(msg_no_witness_tx(tx).serialize(), msg_tx(tx).serialize())
315316

316-
self.test_node.send_message(msg_witness_tx(tx))
317+
self.test_node.send_message(msg_tx(tx))
317318
self.test_node.sync_with_ping() # make sure the tx was processed
318319
assert tx.hash in self.nodes[0].getrawmempool()
319320
# Save this transaction for later

test/functional/test_framework/messages.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,17 +1105,17 @@ def deserialize(self, f):
11051105
self.tx.deserialize(f)
11061106

11071107
def serialize(self):
1108-
return self.tx.serialize_without_witness()
1108+
return self.tx.serialize_with_witness()
11091109

11101110
def __repr__(self):
11111111
return "msg_tx(tx=%s)" % (repr(self.tx))
11121112

11131113

1114-
class msg_witness_tx(msg_tx):
1114+
class msg_no_witness_tx(msg_tx):
11151115
__slots__ = ()
11161116

11171117
def serialize(self):
1118-
return self.tx.serialize_with_witness()
1118+
return self.tx.serialize_without_witness()
11191119

11201120

11211121
class msg_block:

0 commit comments

Comments
 (0)