Browse Source

Merge pull request #7250

fa0a974 [qa] Move gen_return_txouts() to util.py (MarcoFalke)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
49a735cba4
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 17
      qa/rpc-tests/maxuploadtarget.py
  2. 16
      qa/rpc-tests/mempool_limit.py
  3. 16
      qa/rpc-tests/prioritise_transaction.py
  4. 19
      qa/rpc-tests/pruning.py
  5. 18
      qa/rpc-tests/test_framework/util.py

17
qa/rpc-tests/maxuploadtarget.py

@ -84,22 +84,7 @@ class TestNode(NodeConnCB):
class MaxUploadTest(BitcoinTestFramework): class MaxUploadTest(BitcoinTestFramework):
def __init__(self): def __init__(self):
self.utxo = [] self.utxo = []
self.txouts = gen_return_txouts()
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create
# So we have big transactions and full blocks to fill up our block files
# create one script_pubkey
script_pubkey = "6a4d0200" #OP_RETURN OP_PUSH2 512 bytes
for i in xrange (512):
script_pubkey = script_pubkey + "01"
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
self.txouts = "81"
for k in xrange(128):
# add txout value
self.txouts = self.txouts + "0000000000000000"
# add length of script_pubkey
self.txouts = self.txouts + "fd0402"
# add script_pubkey
self.txouts = self.txouts + script_pubkey
def add_options(self, parser): def add_options(self, parser):
parser.add_option("--testbinary", dest="testbinary", parser.add_option("--testbinary", dest="testbinary",

16
qa/rpc-tests/mempool_limit.py

@ -11,21 +11,7 @@ from test_framework.util import *
class MempoolLimitTest(BitcoinTestFramework): class MempoolLimitTest(BitcoinTestFramework):
def __init__(self): def __init__(self):
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create self.txouts = gen_return_txouts()
# So we have big transactions (and therefore can't fit very many into each block)
# create one script_pubkey
script_pubkey = "6a4d0200" #OP_RETURN OP_PUSH2 512 bytes
for i in xrange (512):
script_pubkey = script_pubkey + "01"
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
self.txouts = "81"
for k in xrange(128):
# add txout value
self.txouts = self.txouts + "0000000000000000"
# add length of script_pubkey
self.txouts = self.txouts + "fd0402"
# add script_pubkey
self.txouts = self.txouts + script_pubkey
def setup_network(self): def setup_network(self):
self.nodes = [] self.nodes = []

16
qa/rpc-tests/prioritise_transaction.py

@ -15,21 +15,7 @@ COIN = 100000000
class PrioritiseTransactionTest(BitcoinTestFramework): class PrioritiseTransactionTest(BitcoinTestFramework):
def __init__(self): def __init__(self):
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create self.txouts = gen_return_txouts()
# So we have big transactions (and therefore can't fit very many into each block)
# create one script_pubkey
script_pubkey = "6a4d0200" #OP_RETURN OP_PUSH2 512 bytes
for i in xrange (512):
script_pubkey = script_pubkey + "01"
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
self.txouts = "81"
for k in xrange(128):
# add txout value
self.txouts = self.txouts + "0000000000000000"
# add length of script_pubkey
self.txouts = self.txouts + "fd0402"
# add script_pubkey
self.txouts = self.txouts + script_pubkey
def setup_chain(self): def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir) print("Initializing test directory "+self.options.tmpdir)

19
qa/rpc-tests/pruning.py

@ -23,24 +23,7 @@ class PruneTest(BitcoinTestFramework):
def __init__(self): def __init__(self):
self.utxo = [] self.utxo = []
self.address = ["",""] self.address = ["",""]
self.txouts = gen_return_txouts()
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create
# So we have big transactions and full blocks to fill up our block files
# create one script_pubkey
script_pubkey = "6a4d0200" #OP_RETURN OP_PUSH2 512 bytes
for i in xrange (512):
script_pubkey = script_pubkey + "01"
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
self.txouts = "81"
for k in xrange(128):
# add txout value
self.txouts = self.txouts + "0000000000000000"
# add length of script_pubkey
self.txouts = self.txouts + "fd0402"
# add script_pubkey
self.txouts = self.txouts + script_pubkey
def setup_chain(self): def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir) print("Initializing test directory "+self.options.tmpdir)

18
qa/rpc-tests/test_framework/util.py

@ -437,6 +437,24 @@ def create_confirmed_utxos(fee, node, count):
assert(len(utxos) >= count) assert(len(utxos) >= count)
return utxos return utxos
def gen_return_txouts():
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create
# So we have big transactions (and therefore can't fit very many into each block)
# create one script_pubkey
script_pubkey = "6a4d0200" #OP_RETURN OP_PUSH2 512 bytes
for i in xrange (512):
script_pubkey = script_pubkey + "01"
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
txouts = "81"
for k in xrange(128):
# add txout value
txouts = txouts + "0000000000000000"
# add length of script_pubkey
txouts = txouts + "fd0402"
# add script_pubkey
txouts = txouts + script_pubkey
return txouts
def create_lots_of_big_transactions(node, txouts, utxos, fee): def create_lots_of_big_transactions(node, txouts, utxos, fee):
addr = node.getnewaddress() addr = node.getnewaddress()
txids = [] txids = []

Loading…
Cancel
Save