Skip to content

Commit 30ff3a2

Browse files
committed
Merge #9602: Remove coin age priority and free transactions - implementation
b421e6d Update example bitcoin.conf (Alex Morcos) 7d4e950 Allow setting minrelaytxfee to 0 (Alex Morcos) 359e8a0 [cleanup] Remove coin age priority completely. (Alex Morcos) f9b9371 [rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos) 49be7e1 [rpc] Remove priority information from mempool RPC calls (Alex Morcos) 0315888 [test] Remove priority from tests (Alex Morcos) f838005 No longer allow "free" transactions (Alex Morcos) ad727f4 [rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos) fe282ac [cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos) 400b151 [debug] Change -printpriority option (Alex Morcos) 272b25a [mining] Remove -blockprioritysize. (Alex Morcos) 12839cd [rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos) ddf58c7 wallet: Remove sendfree (MarcoFalke) Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
2 parents 3178b2c + b421e6d commit 30ff3a2

40 files changed

+119
-682
lines changed

contrib/debian/examples/bitcoin.conf

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,7 @@
116116
# running on another host using this option:
117117
#rpcconnect=127.0.0.1
118118

119-
# Transaction Fee Changes in 0.10.0
120-
121-
# Send transactions as zero-fee transactions if possible (default: 0)
122-
#sendfreetransactions=0
123-
124-
# Create transactions that have enough fees (or priority) so they are likely to begin confirmation within n blocks (default: 1).
119+
# Create transactions that have enough fees so they are likely to begin confirmation within n blocks (default: 6).
125120
# This setting is over-ridden by the -paytxfee option.
126121
#txconfirmtarget=n
127122

contrib/devtools/check-doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
REGEX_ARG = re.compile(r'(?:map(?:Multi)?Args(?:\.count\(|\[)|Get(?:Bool)?Arg\()\"(\-[^\"]+?)\"')
2222
REGEX_DOC = re.compile(r'HelpMessageOpt\(\"(\-[^\"=]+?)(?:=|\")')
2323
# list unsupported, deprecated and duplicate args as they need no documentation
24-
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags', '-blockminsize'])
24+
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags', '-blockminsize', '-sendfreetransactions'])
2525

2626
def main():
2727
used = check_output(CMD_GREP_ARGS, shell=True)

qa/rpc-tests/abandonconflict.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def run_test(self):
8080

8181
# Restart the node with a higher min relay fee so the parent tx is no longer in mempool
8282
# TODO: redo with eviction
83-
# Note had to make sure tx did not have AllowFree priority
8483
stop_node(self.nodes[0],0)
8584
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.0001"])
8685

qa/rpc-tests/bip68-sequence.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def __init__(self):
2424

2525
def setup_network(self):
2626
self.nodes = []
27-
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug", "-blockprioritysize=0"]))
28-
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug", "-blockprioritysize=0", "-acceptnonstdtxn=0"]))
27+
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug"]))
28+
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug", "-acceptnonstdtxn=0"]))
2929
self.is_network_split = False
3030
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]
3131
connect_nodes(self.nodes[0], 1)
@@ -254,7 +254,7 @@ def test_nonzero_locks(orig_tx, node, relayfee, use_height_lock):
254254

255255
# Now mine some blocks, but make sure tx2 doesn't get mined.
256256
# Use prioritisetransaction to lower the effective feerate to 0
257-
self.nodes[0].prioritisetransaction(tx2.hash, -1e15, int(-self.relayfee*COIN))
257+
self.nodes[0].prioritisetransaction(tx2.hash, int(-self.relayfee*COIN))
258258
cur_time = int(time.time())
259259
for i in range(10):
260260
self.nodes[0].setmocktime(cur_time + 600)
@@ -267,7 +267,7 @@ def test_nonzero_locks(orig_tx, node, relayfee, use_height_lock):
267267
test_nonzero_locks(tx2, self.nodes[0], self.relayfee, use_height_lock=False)
268268

269269
# Mine tx2, and then try again
270-
self.nodes[0].prioritisetransaction(tx2.hash, 1e15, int(self.relayfee*COIN))
270+
self.nodes[0].prioritisetransaction(tx2.hash, int(self.relayfee*COIN))
271271

272272
# Advance the time on the node so that we can test timelocks
273273
self.nodes[0].setmocktime(cur_time+600)

qa/rpc-tests/mempool_packages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def run_test(self):
103103

104104
# Check that descendant modified fees includes fee deltas from
105105
# prioritisetransaction
106-
self.nodes[0].prioritisetransaction(chain[-1], 0, 1000)
106+
self.nodes[0].prioritisetransaction(chain[-1], 1000)
107107
mempool = self.nodes[0].getrawmempool(True)
108108

109109
descendant_fees = 0
@@ -124,7 +124,7 @@ def run_test(self):
124124
assert_equal(len(self.nodes[0].getrawmempool()), 0)
125125
# Prioritise a transaction that has been mined, then add it back to the
126126
# mempool by using invalidateblock.
127-
self.nodes[0].prioritisetransaction(chain[-1], 0, 2000)
127+
self.nodes[0].prioritisetransaction(chain[-1], 2000)
128128
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
129129
# Keep node1's tip synced with node0
130130
self.nodes[1].invalidateblock(self.nodes[1].getbestblockhash())

qa/rpc-tests/nulldummy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ def run_test(self):
7474
self.block_submit(self.nodes[0], test1txs, False, True)
7575

7676
print ("Test 2: Non-NULLDUMMY base multisig transaction should not be accepted to mempool before activation")
77-
test2tx = self.create_transaction(self.nodes[0], txid2, self.ms_address, 48)
77+
test2tx = self.create_transaction(self.nodes[0], txid2, self.ms_address, 47)
7878
trueDummy(test2tx)
7979
txid4 = self.tx_submit(self.nodes[0], test2tx, NULLDUMMY_ERROR)
8080

8181
print ("Test 3: Non-NULLDUMMY base transactions should be accepted in a block before activation [431]")
8282
self.block_submit(self.nodes[0], [test2tx], False, True)
8383

8484
print ("Test 4: Non-NULLDUMMY base multisig transaction is invalid after activation")
85-
test4tx = self.create_transaction(self.nodes[0], txid4, self.address, 47)
85+
test4tx = self.create_transaction(self.nodes[0], txid4, self.address, 46)
8686
test6txs=[CTransaction(test4tx)]
8787
trueDummy(test4tx)
8888
self.tx_submit(self.nodes[0], test4tx, NULLDUMMY_ERROR)

qa/rpc-tests/prioritise_transaction.py

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ def run_test(self):
5050
assert(sizes[i] > MAX_BLOCK_BASE_SIZE) # Fail => raise utxo_count
5151

5252
# add a fee delta to something in the cheapest bucket and make sure it gets mined
53-
# also check that a different entry in the cheapest bucket is NOT mined (lower
54-
# the priority to ensure its not mined due to priority)
55-
self.nodes[0].prioritisetransaction(txids[0][0], 0, int(3*base_fee*COIN))
56-
self.nodes[0].prioritisetransaction(txids[0][1], -1e15, 0)
53+
# also check that a different entry in the cheapest bucket is NOT mined
54+
self.nodes[0].prioritisetransaction(txids[0][0], int(3*base_fee*COIN))
5755

5856
self.nodes[0].generate(1)
5957

@@ -72,7 +70,7 @@ def run_test(self):
7270

7371
# Add a prioritisation before a tx is in the mempool (de-prioritising a
7472
# high-fee transaction so that it's now low fee).
75-
self.nodes[0].prioritisetransaction(high_fee_tx, -1e15, -int(2*base_fee*COIN))
73+
self.nodes[0].prioritisetransaction(high_fee_tx, -int(2*base_fee*COIN))
7674

7775
# Add everything back to mempool
7876
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
@@ -96,45 +94,35 @@ def run_test(self):
9694
if (x != high_fee_tx):
9795
assert(x not in mempool)
9896

99-
# Create a free, low priority transaction. Should be rejected.
97+
# Create a free transaction. Should be rejected.
10098
utxo_list = self.nodes[0].listunspent()
10199
assert(len(utxo_list) > 0)
102100
utxo = utxo_list[0]
103101

104102
inputs = []
105103
outputs = {}
106104
inputs.append({"txid" : utxo["txid"], "vout" : utxo["vout"]})
107-
outputs[self.nodes[0].getnewaddress()] = utxo["amount"] - self.relayfee
105+
outputs[self.nodes[0].getnewaddress()] = utxo["amount"]
108106
raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
109107
tx_hex = self.nodes[0].signrawtransaction(raw_tx)["hex"]
110-
txid = self.nodes[0].sendrawtransaction(tx_hex)
111-
112-
# A tx that spends an in-mempool tx has 0 priority, so we can use it to
113-
# test the effect of using prioritise transaction for mempool acceptance
114-
inputs = []
115-
inputs.append({"txid": txid, "vout": 0})
116-
outputs = {}
117-
outputs[self.nodes[0].getnewaddress()] = utxo["amount"] - self.relayfee
118-
raw_tx2 = self.nodes[0].createrawtransaction(inputs, outputs)
119-
tx2_hex = self.nodes[0].signrawtransaction(raw_tx2)["hex"]
120-
tx2_id = self.nodes[0].decoderawtransaction(tx2_hex)["txid"]
108+
tx_id = self.nodes[0].decoderawtransaction(tx_hex)["txid"]
121109

122110
try:
123-
self.nodes[0].sendrawtransaction(tx2_hex)
111+
self.nodes[0].sendrawtransaction(tx_hex)
124112
except JSONRPCException as exp:
125113
assert_equal(exp.error['code'], -26) # insufficient fee
126-
assert(tx2_id not in self.nodes[0].getrawmempool())
114+
assert(tx_id not in self.nodes[0].getrawmempool())
127115
else:
128116
assert(False)
129117

130118
# This is a less than 1000-byte transaction, so just set the fee
131119
# to be the minimum for a 1000 byte transaction and check that it is
132120
# accepted.
133-
self.nodes[0].prioritisetransaction(tx2_id, 0, int(self.relayfee*COIN))
121+
self.nodes[0].prioritisetransaction(tx_id, int(self.relayfee*COIN))
134122

135123
print("Assert that prioritised free transaction is accepted to mempool")
136-
assert_equal(self.nodes[0].sendrawtransaction(tx2_hex), tx2_id)
137-
assert(tx2_id in self.nodes[0].getrawmempool())
124+
assert_equal(self.nodes[0].sendrawtransaction(tx_hex), tx_id)
125+
assert(tx_id in self.nodes[0].getrawmempool())
138126

139127
if __name__ == '__main__':
140128
PrioritiseTransactionTest().main()

qa/rpc-tests/replace-by-fee.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def test_prioritised_transactions(self):
543543
assert(False)
544544

545545
# Use prioritisetransaction to set tx1a's fee to 0.
546-
self.nodes[0].prioritisetransaction(tx1a_txid, 0, int(-0.1*COIN))
546+
self.nodes[0].prioritisetransaction(tx1a_txid, int(-0.1*COIN))
547547

548548
# Now tx1b should be able to replace tx1a
549549
tx1b_txid = self.nodes[0].sendrawtransaction(tx1b_hex, True)
@@ -575,7 +575,7 @@ def test_prioritised_transactions(self):
575575
assert(False)
576576

577577
# Now prioritise tx2b to have a higher modified fee
578-
self.nodes[0].prioritisetransaction(tx2b.hash, 0, int(0.1*COIN))
578+
self.nodes[0].prioritisetransaction(tx2b.hash, int(0.1*COIN))
579579

580580
# tx2b should now be accepted
581581
tx2b_txid = self.nodes[0].sendrawtransaction(tx2b_hex, True)

qa/rpc-tests/smartfees.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
6969

7070
def split_inputs(from_node, txins, txouts, initial_split = False):
7171
"""
72-
We need to generate a lot of very small inputs so we can generate a ton of transactions
73-
and they will have low priority.
72+
We need to generate a lot of inputs so we can generate a ton of transactions.
7473
This function takes an input from txins, and creates and sends a transaction
7574
which splits the value into 2 outputs which are appended to txouts.
75+
Previously this was designed to be small inputs so they wouldn't have
76+
a high coin age when the notion of priority still existed.
7677
"""
7778
prevtxout = txins.pop()
7879
inputs = []
@@ -150,7 +151,7 @@ def __init__(self):
150151
def setup_network(self):
151152
"""
152153
We'll setup the network to have 3 nodes that all mine with different parameters.
153-
But first we need to use one node to create a lot of small low priority outputs
154+
But first we need to use one node to create a lot of outputs
154155
which we will use to generate our transactions.
155156
"""
156157
self.nodes = []
@@ -159,7 +160,7 @@ def setup_network(self):
159160
"-whitelist=127.0.0.1"]))
160161

161162
print("This test is time consuming, please be patient")
162-
print("Splitting inputs to small size so we can generate low priority tx's")
163+
print("Splitting inputs so we can generate tx's")
163164
self.txouts = []
164165
self.txouts2 = []
165166
# Split a coinbase into two transaction puzzle outputs
@@ -188,18 +189,17 @@ def setup_network(self):
188189

189190
# Now we can connect the other nodes, didn't want to connect them earlier
190191
# so the estimates would not be affected by the splitting transactions
191-
# Node1 mines small blocks but that are bigger than the expected transaction rate,
192-
# and allows free transactions.
192+
# Node1 mines small blocks but that are bigger than the expected transaction rate.
193193
# NOTE: the CreateNewBlock code starts counting block size at 1,000 bytes,
194194
# (17k is room enough for 110 or so transactions)
195195
self.nodes.append(start_node(1, self.options.tmpdir,
196-
["-blockprioritysize=1500", "-blockmaxsize=17000",
196+
["-blockmaxsize=17000",
197197
"-maxorphantx=1000", "-debug=estimatefee"]))
198198
connect_nodes(self.nodes[1], 0)
199199

200200
# Node2 is a stingy miner, that
201201
# produces too small blocks (room for only 55 or so transactions)
202-
node2args = ["-blockprioritysize=0", "-blockmaxsize=8000", "-maxorphantx=1000"]
202+
node2args = ["-blockmaxsize=8000", "-maxorphantx=1000"]
203203

204204
self.nodes.append(start_node(2, self.options.tmpdir, node2args))
205205
connect_nodes(self.nodes[0], 2)

qa/rpc-tests/test_framework/util.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -442,47 +442,6 @@ def make_change(from_node, amount_in, amount_out, fee):
442442
outputs[from_node.getnewaddress()] = change
443443
return outputs
444444

445-
def send_zeropri_transaction(from_node, to_node, amount, fee):
446-
"""
447-
Create&broadcast a zero-priority transaction.
448-
Returns (txid, hex-encoded-txdata)
449-
Ensures transaction is zero-priority by first creating a send-to-self,
450-
then using its output
451-
"""
452-
453-
# Create a send-to-self with confirmed inputs:
454-
self_address = from_node.getnewaddress()
455-
(total_in, inputs) = gather_inputs(from_node, amount+fee*2)
456-
outputs = make_change(from_node, total_in, amount+fee, fee)
457-
outputs[self_address] = float(amount+fee)
458-
459-
self_rawtx = from_node.createrawtransaction(inputs, outputs)
460-
self_signresult = from_node.signrawtransaction(self_rawtx)
461-
self_txid = from_node.sendrawtransaction(self_signresult["hex"], True)
462-
463-
vout = find_output(from_node, self_txid, amount+fee)
464-
# Now immediately spend the output to create a 1-input, 1-output
465-
# zero-priority transaction:
466-
inputs = [ { "txid" : self_txid, "vout" : vout } ]
467-
outputs = { to_node.getnewaddress() : float(amount) }
468-
469-
rawtx = from_node.createrawtransaction(inputs, outputs)
470-
signresult = from_node.signrawtransaction(rawtx)
471-
txid = from_node.sendrawtransaction(signresult["hex"], True)
472-
473-
return (txid, signresult["hex"])
474-
475-
def random_zeropri_transaction(nodes, amount, min_fee, fee_increment, fee_variants):
476-
"""
477-
Create a random zero-priority transaction.
478-
Returns (txid, hex-encoded-transaction-data, fee)
479-
"""
480-
from_node = random.choice(nodes)
481-
to_node = random.choice(nodes)
482-
fee = min_fee + fee_increment*random.randint(0,fee_variants)
483-
(txid, txhex) = send_zeropri_transaction(from_node, to_node, amount, fee)
484-
return (txid, txhex, fee)
485-
486445
def random_transaction(nodes, amount, min_fee, fee_increment, fee_variants):
487446
"""
488447
Create a random transaction.

0 commit comments

Comments
 (0)