aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaiza <naiza@iitk.ac.in>2021-07-26 03:06:26 +0530
committernaiza <naiza@iitk.ac.in>2021-08-03 06:49:22 +0530
commit91b05974fc1ea38062f12d36152201af81bda1a2 (patch)
treee220720af45bdf34c7d53a22a70aabe04e4e9673 /test
parent1488f55fa57a1400a57be837b574183f019c7855 (diff)
downloadbitcoin-91b05974fc1ea38062f12d36152201af81bda1a2.tar.xz
Improve mempool_accept_wtxid.py
Improve mempool_accept_wtxid.py Improve mempool_accept_wtxid.py Improve mempool_accept_wtxid.py Improve mempool_accept_wtxid.py
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/mempool_accept_wtxid.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/test/functional/mempool_accept_wtxid.py b/test/functional/mempool_accept_wtxid.py
index 63ecc8ee2a..ffafe7428f 100755
--- a/test/functional/mempool_accept_wtxid.py
+++ b/test/functional/mempool_accept_wtxid.py
@@ -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,
@@ -79,10 +80,7 @@ class MempoolWtxidTest(BitcoinTestFramework):
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()
@@ -104,8 +102,7 @@ class MempoolWtxidTest(BitcoinTestFramework):
"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,