aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2017-01-19 22:46:50 -0500
committerAlex Morcos <morcos@chaincode.com>2017-03-03 16:50:19 -0500
commit0315888d0db2f39c784afac19ff5db5086f30820 (patch)
treeab5a4feaae705fd449cd2783e88bcd78a73acba3 /qa/rpc-tests
parentf8380054442d8aca4999277fe7617067edf231b9 (diff)
downloadbitcoin-0315888d0db2f39c784afac19ff5db5086f30820.tar.xz
[test] Remove priority from tests
Remove all coin age priority functionality from unit tests and RPC tests.
Diffstat (limited to 'qa/rpc-tests')
-rwxr-xr-xqa/rpc-tests/prioritise_transaction.py30
-rwxr-xr-xqa/rpc-tests/smartfees.py9
-rw-r--r--qa/rpc-tests/test_framework/util.py41
3 files changed, 14 insertions, 66 deletions
diff --git a/qa/rpc-tests/prioritise_transaction.py b/qa/rpc-tests/prioritise_transaction.py
index 9a63d0838f..91d5d6be7d 100755
--- a/qa/rpc-tests/prioritise_transaction.py
+++ b/qa/rpc-tests/prioritise_transaction.py
@@ -50,10 +50,8 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
assert(sizes[i] > MAX_BLOCK_BASE_SIZE) # Fail => raise utxo_count
# add a fee delta to something in the cheapest bucket and make sure it gets mined
- # also check that a different entry in the cheapest bucket is NOT mined (lower
- # the priority to ensure its not mined due to priority)
+ # also check that a different entry in the cheapest bucket is NOT mined
self.nodes[0].prioritisetransaction(txids[0][0], 0, int(3*base_fee*COIN))
- self.nodes[0].prioritisetransaction(txids[0][1], -1e15, 0)
self.nodes[0].generate(1)
@@ -96,7 +94,7 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
if (x != high_fee_tx):
assert(x not in mempool)
- # Create a free, low priority transaction. Should be rejected.
+ # Create a free transaction. Should be rejected.
utxo_list = self.nodes[0].listunspent()
assert(len(utxo_list) > 0)
utxo = utxo_list[0]
@@ -104,37 +102,27 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
inputs = []
outputs = {}
inputs.append({"txid" : utxo["txid"], "vout" : utxo["vout"]})
- outputs[self.nodes[0].getnewaddress()] = utxo["amount"] - self.relayfee
+ outputs[self.nodes[0].getnewaddress()] = utxo["amount"]
raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
tx_hex = self.nodes[0].signrawtransaction(raw_tx)["hex"]
- txid = self.nodes[0].sendrawtransaction(tx_hex)
-
- # A tx that spends an in-mempool tx has 0 priority, so we can use it to
- # test the effect of using prioritise transaction for mempool acceptance
- inputs = []
- inputs.append({"txid": txid, "vout": 0})
- outputs = {}
- outputs[self.nodes[0].getnewaddress()] = utxo["amount"] - self.relayfee
- raw_tx2 = self.nodes[0].createrawtransaction(inputs, outputs)
- tx2_hex = self.nodes[0].signrawtransaction(raw_tx2)["hex"]
- tx2_id = self.nodes[0].decoderawtransaction(tx2_hex)["txid"]
+ tx_id = self.nodes[0].decoderawtransaction(tx_hex)["txid"]
try:
- self.nodes[0].sendrawtransaction(tx2_hex)
+ self.nodes[0].sendrawtransaction(tx_hex)
except JSONRPCException as exp:
assert_equal(exp.error['code'], -26) # insufficient fee
- assert(tx2_id not in self.nodes[0].getrawmempool())
+ assert(tx_id not in self.nodes[0].getrawmempool())
else:
assert(False)
# This is a less than 1000-byte transaction, so just set the fee
# to be the minimum for a 1000 byte transaction and check that it is
# accepted.
- self.nodes[0].prioritisetransaction(tx2_id, 0, int(self.relayfee*COIN))
+ self.nodes[0].prioritisetransaction(tx_id, 0, int(self.relayfee*COIN))
print("Assert that prioritised free transaction is accepted to mempool")
- assert_equal(self.nodes[0].sendrawtransaction(tx2_hex), tx2_id)
- assert(tx2_id in self.nodes[0].getrawmempool())
+ assert_equal(self.nodes[0].sendrawtransaction(tx_hex), tx_id)
+ assert(tx_id in self.nodes[0].getrawmempool())
if __name__ == '__main__':
PrioritiseTransactionTest().main()
diff --git a/qa/rpc-tests/smartfees.py b/qa/rpc-tests/smartfees.py
index 4289c7b0b6..9ce5b8e865 100755
--- a/qa/rpc-tests/smartfees.py
+++ b/qa/rpc-tests/smartfees.py
@@ -69,10 +69,11 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
def split_inputs(from_node, txins, txouts, initial_split = False):
"""
- We need to generate a lot of very small inputs so we can generate a ton of transactions
- and they will have low priority.
+ We need to generate a lot of inputs so we can generate a ton of transactions.
This function takes an input from txins, and creates and sends a transaction
which splits the value into 2 outputs which are appended to txouts.
+ Previously this was designed to be small inputs so they wouldn't have
+ a high coin age when the notion of priority still existed.
"""
prevtxout = txins.pop()
inputs = []
@@ -150,7 +151,7 @@ class EstimateFeeTest(BitcoinTestFramework):
def setup_network(self):
"""
We'll setup the network to have 3 nodes that all mine with different parameters.
- But first we need to use one node to create a lot of small low priority outputs
+ But first we need to use one node to create a lot of outputs
which we will use to generate our transactions.
"""
self.nodes = []
@@ -159,7 +160,7 @@ class EstimateFeeTest(BitcoinTestFramework):
"-whitelist=127.0.0.1"]))
print("This test is time consuming, please be patient")
- print("Splitting inputs to small size so we can generate low priority tx's")
+ print("Splitting inputs so we can generate tx's")
self.txouts = []
self.txouts2 = []
# Split a coinbase into two transaction puzzle outputs
diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py
index e838a40582..408c266aa4 100644
--- a/qa/rpc-tests/test_framework/util.py
+++ b/qa/rpc-tests/test_framework/util.py
@@ -442,47 +442,6 @@ def make_change(from_node, amount_in, amount_out, fee):
outputs[from_node.getnewaddress()] = change
return outputs
-def send_zeropri_transaction(from_node, to_node, amount, fee):
- """
- Create&broadcast a zero-priority transaction.
- Returns (txid, hex-encoded-txdata)
- Ensures transaction is zero-priority by first creating a send-to-self,
- then using its output
- """
-
- # Create a send-to-self with confirmed inputs:
- self_address = from_node.getnewaddress()
- (total_in, inputs) = gather_inputs(from_node, amount+fee*2)
- outputs = make_change(from_node, total_in, amount+fee, fee)
- outputs[self_address] = float(amount+fee)
-
- self_rawtx = from_node.createrawtransaction(inputs, outputs)
- self_signresult = from_node.signrawtransaction(self_rawtx)
- self_txid = from_node.sendrawtransaction(self_signresult["hex"], True)
-
- vout = find_output(from_node, self_txid, amount+fee)
- # Now immediately spend the output to create a 1-input, 1-output
- # zero-priority transaction:
- inputs = [ { "txid" : self_txid, "vout" : vout } ]
- outputs = { to_node.getnewaddress() : float(amount) }
-
- rawtx = from_node.createrawtransaction(inputs, outputs)
- signresult = from_node.signrawtransaction(rawtx)
- txid = from_node.sendrawtransaction(signresult["hex"], True)
-
- return (txid, signresult["hex"])
-
-def random_zeropri_transaction(nodes, amount, min_fee, fee_increment, fee_variants):
- """
- Create a random zero-priority transaction.
- Returns (txid, hex-encoded-transaction-data, fee)
- """
- from_node = random.choice(nodes)
- to_node = random.choice(nodes)
- fee = min_fee + fee_increment*random.randint(0,fee_variants)
- (txid, txhex) = send_zeropri_transaction(from_node, to_node, amount, fee)
- return (txid, txhex, fee)
-
def random_transaction(nodes, amount, min_fee, fee_increment, fee_variants):
"""
Create a random transaction.