Skip to content

Commit 87257d8

Browse files
author
MarcoFalke
committed
Merge bitcoin#22532: test : improve mempool_accept_wtxid.py
91b0597 Improve mempool_accept_wtxid.py (naiza) Pull request description: Follow-up to bitcoin#22253 adding changes suggested in [bitcoin#22253 (review)](bitcoin#22253 (comment)) ACKs for top commit: glozow: utACK 91b0597 Tree-SHA512: 383064138a5b2160d769c9df370470fd585c91682083013a6fa15e14448a4b481bc09b3a0ed6e75554db2c378df6b2263c65f209f973c9e9d577e15814a4be1d
2 parents ad0fc45 + 91b0597 commit 87257d8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

test/functional/mempool_accept_wtxid.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""
66
Test mempool acceptance in case of an already known transaction
7-
with identical non-witness data different witness.
7+
with identical non-witness data but different witness.
88
"""
99

10+
from copy import deepcopy
1011
from test_framework.messages import (
1112
COIN,
1213
COutPoint,
@@ -79,10 +80,7 @@ def run_test(self):
7980
child_one_txid = child_one.rehash()
8081

8182
# Create another identical transaction with witness solving second branch
82-
child_two = CTransaction()
83-
child_two.vin.append(CTxIn(COutPoint(int(parent_txid, 16), 0), b""))
84-
child_two.vout.append(CTxOut(int(9.99996 * COIN), child_script_pubkey))
85-
child_two.wit.vtxinwit.append(CTxInWitness())
83+
child_two = deepcopy(child_one)
8684
child_two.wit.vtxinwit[0].scriptWitness.stack = [b'', witness_script]
8785
child_two_wtxid = child_two.getwtxid()
8886
child_two_txid = child_two.rehash()
@@ -104,8 +102,7 @@ def run_test(self):
104102
"allowed": False,
105103
"reject-reason": "txn-already-in-mempool"
106104
}])
107-
testres_child_two = node.testmempoolaccept([child_two.serialize().hex()])[0]
108-
assert_equal(testres_child_two, {
105+
assert_equal(node.testmempoolaccept([child_two.serialize().hex()])[0], {
109106
"txid": child_two_txid,
110107
"wtxid": child_two_wtxid,
111108
"allowed": False,

0 commit comments

Comments
 (0)