Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#22532: test : improve mempool_accept_wtxid.py
Browse files Browse the repository at this point in the history
91b0597 Improve mempool_accept_wtxid.py (naiza)

Pull request description:

  Follow-up to #22253 adding changes suggested in [#22253 (review)](bitcoin/bitcoin#22253 (comment))

ACKs for top commit:
  glozow:
    utACK 91b0597

Tree-SHA512: 383064138a5b2160d769c9df370470fd585c91682083013a6fa15e14448a4b481bc09b3a0ed6e75554db2c378df6b2263c65f209f973c9e9d577e15814a4be1d
  • Loading branch information
MarcoFalke committed Aug 3, 2021
2 parents ad0fc45 + 91b0597 commit 87257d8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/functional/mempool_accept_wtxid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test mempool acceptance in case of an already known transaction
with identical non-witness data different witness.
with identical non-witness data but different witness.
"""

from copy import deepcopy
from test_framework.messages import (
COIN,
COutPoint,
Expand Down Expand Up @@ -79,10 +80,7 @@ def run_test(self):
child_one_txid = child_one.rehash()

# Create another identical transaction with witness solving second branch
child_two = CTransaction()
child_two.vin.append(CTxIn(COutPoint(int(parent_txid, 16), 0), b""))
child_two.vout.append(CTxOut(int(9.99996 * COIN), child_script_pubkey))
child_two.wit.vtxinwit.append(CTxInWitness())
child_two = deepcopy(child_one)
child_two.wit.vtxinwit[0].scriptWitness.stack = [b'', witness_script]
child_two_wtxid = child_two.getwtxid()
child_two_txid = child_two.rehash()
Expand All @@ -104,8 +102,7 @@ def run_test(self):
"allowed": False,
"reject-reason": "txn-already-in-mempool"
}])
testres_child_two = node.testmempoolaccept([child_two.serialize().hex()])[0]
assert_equal(testres_child_two, {
assert_equal(node.testmempoolaccept([child_two.serialize().hex()])[0], {
"txid": child_two_txid,
"wtxid": child_two_wtxid,
"allowed": False,
Expand Down

0 comments on commit 87257d8

Please sign in to comment.