@@ -45,15 +45,15 @@ def test_replacement(self):
45
45
self .nodes [0 ].prioritisetransaction (tx_replacee ["txid" ], 0 , 100 )
46
46
assert_equal (self .nodes [0 ].getprioritisedtransactions (), { tx_replacee ["txid" ] : { "fee_delta" : 100 , "in_mempool" : False }})
47
47
self .nodes [0 ].sendrawtransaction (tx_replacee ["hex" ])
48
- assert_equal (self .nodes [0 ].getprioritisedtransactions (), { tx_replacee ["txid" ] : { "fee_delta" : 100 , "in_mempool" : True }})
48
+ assert_equal (self .nodes [0 ].getprioritisedtransactions (), { tx_replacee ["txid" ] : { "fee_delta" : 100 , "in_mempool" : True , "modified_fee" : int ( tx_replacee [ "fee" ] * COIN + 100 ) }})
49
49
self .nodes [0 ].sendrawtransaction (tx_replacement ["hex" ])
50
50
assert tx_replacee ["txid" ] not in self .nodes [0 ].getrawmempool ()
51
51
assert_equal (self .nodes [0 ].getprioritisedtransactions (), { tx_replacee ["txid" ] : { "fee_delta" : 100 , "in_mempool" : False }})
52
52
53
53
# PrioritiseTransaction is additive
54
54
self .nodes [0 ].prioritisetransaction (tx_replacee ["txid" ], 0 , COIN )
55
55
self .nodes [0 ].sendrawtransaction (tx_replacee ["hex" ])
56
- assert_equal (self .nodes [0 ].getprioritisedtransactions (), { tx_replacee ["txid" ] : { "fee_delta" : COIN + 100 , "in_mempool" : True }})
56
+ assert_equal (self .nodes [0 ].getprioritisedtransactions (), { tx_replacee ["txid" ] : { "fee_delta" : COIN + 100 , "in_mempool" : True , "modified_fee" : int ( tx_replacee [ "fee" ] * COIN + COIN + 100 ) }})
57
57
self .generate (self .nodes [0 ], 1 )
58
58
assert_equal (self .nodes [0 ].getprioritisedtransactions (), {})
59
59
@@ -111,9 +111,7 @@ def test_diamond(self):
111
111
raw_after = self .nodes [0 ].getrawmempool (verbose = True )
112
112
assert_equal (raw_before [txid_a ], raw_after [txid_a ])
113
113
assert_equal (raw_before , raw_after )
114
- prioritisation_map_in_mempool = self .nodes [0 ].getprioritisedtransactions ()
115
- assert_equal (prioritisation_map_in_mempool [txid_b ], {"fee_delta" : fee_delta_b * COIN , "in_mempool" : True })
116
- assert_equal (prioritisation_map_in_mempool [txid_c ], {"fee_delta" : (fee_delta_c_1 + fee_delta_c_2 )* COIN , "in_mempool" : True })
114
+ assert_equal (self .nodes [0 ].getprioritisedtransactions (), {txid_b : {"fee_delta" : fee_delta_b * COIN , "in_mempool" : True , "modified_fee" : int (fee_delta_b * COIN + COIN * tx_o_b ["fee" ])}, txid_c : {"fee_delta" : (fee_delta_c_1 + fee_delta_c_2 )* COIN , "in_mempool" : True , "modified_fee" : int ((fee_delta_c_1 + fee_delta_c_2 ) * COIN + COIN * tx_o_c ["fee" ])}})
117
115
# Clear prioritisation, otherwise the transactions' fee deltas are persisted to mempool.dat and loaded again when the node
118
116
# is restarted at the end of this subtest. Deltas are removed when a transaction is mined, but only at that time. We do
119
117
# not check whether mapDeltas transactions were mined when loading from mempool.dat.
@@ -126,17 +124,13 @@ def test_diamond(self):
126
124
self .nodes [0 ].prioritisetransaction (txid = txid_b , fee_delta = int (fee_delta_b * COIN ))
127
125
self .nodes [0 ].prioritisetransaction (txid = txid_c , fee_delta = int (fee_delta_c_1 * COIN ))
128
126
self .nodes [0 ].prioritisetransaction (txid = txid_c , fee_delta = int (fee_delta_c_2 * COIN ))
129
- prioritisation_map_not_in_mempool = self .nodes [0 ].getprioritisedtransactions ()
130
- assert_equal (prioritisation_map_not_in_mempool [txid_b ], {"fee_delta" : fee_delta_b * COIN , "in_mempool" : False })
131
- assert_equal (prioritisation_map_not_in_mempool [txid_c ], {"fee_delta" : (fee_delta_c_1 + fee_delta_c_2 )* COIN , "in_mempool" : False })
127
+ assert_equal (self .nodes [0 ].getprioritisedtransactions (), {txid_b : {"fee_delta" : fee_delta_b * COIN , "in_mempool" : False }, txid_c : {"fee_delta" : (fee_delta_c_1 + fee_delta_c_2 )* COIN , "in_mempool" : False }})
132
128
for t in [tx_o_a ["hex" ], tx_o_b ["hex" ], tx_o_c ["hex" ], tx_o_d ["hex" ]]:
133
129
self .nodes [0 ].sendrawtransaction (t )
134
130
raw_after = self .nodes [0 ].getrawmempool (verbose = True )
135
131
assert_equal (raw_before [txid_a ], raw_after [txid_a ])
136
132
assert_equal (raw_before , raw_after )
137
- prioritisation_map_in_mempool = self .nodes [0 ].getprioritisedtransactions ()
138
- assert_equal (prioritisation_map_in_mempool [txid_b ], {"fee_delta" : fee_delta_b * COIN , "in_mempool" : True })
139
- assert_equal (prioritisation_map_in_mempool [txid_c ], {"fee_delta" : (fee_delta_c_1 + fee_delta_c_2 )* COIN , "in_mempool" : True })
133
+ assert_equal (self .nodes [0 ].getprioritisedtransactions (), {txid_b : {"fee_delta" : fee_delta_b * COIN , "in_mempool" : True , "modified_fee" : int (fee_delta_b * COIN + COIN * tx_o_b ["fee" ])}, txid_c : {"fee_delta" : (fee_delta_c_1 + fee_delta_c_2 )* COIN , "in_mempool" : True , "modified_fee" : int ((fee_delta_c_1 + fee_delta_c_2 ) * COIN + COIN * tx_o_c ["fee" ])}})
140
134
141
135
# Clear mempool
142
136
self .generate (self .nodes [0 ], 1 )
@@ -217,7 +211,7 @@ def run_test(self):
217
211
# add a fee delta to something in the cheapest bucket and make sure it gets mined
218
212
# also check that a different entry in the cheapest bucket is NOT mined
219
213
self .nodes [0 ].prioritisetransaction (txid = txids [0 ][0 ], fee_delta = int (3 * base_fee * COIN ))
220
- assert_equal (self .nodes [0 ].getprioritisedtransactions (), {txids [0 ][0 ] : { "fee_delta" : 3 * base_fee * COIN , "in_mempool" : True }})
214
+ assert_equal (self .nodes [0 ].getprioritisedtransactions (), {txids [0 ][0 ] : { "fee_delta" : 3 * base_fee * COIN , "in_mempool" : True , "modified_fee" : int ( 3 * base_fee * COIN + COIN * 1 * base_fee ) }})
221
215
222
216
# Priority disappears when prioritisetransaction is called with an inverse value...
223
217
self .nodes [0 ].prioritisetransaction (txid = txids [0 ][0 ], fee_delta = int (- 3 * base_fee * COIN ))
@@ -264,11 +258,17 @@ def run_test(self):
264
258
mempool = self .nodes [0 ].getrawmempool ()
265
259
self .log .info ("Assert that de-prioritised transaction is still in mempool" )
266
260
assert high_fee_tx in mempool
267
- assert_equal (self .nodes [0 ].getprioritisedtransactions ()[high_fee_tx ], { "fee_delta" : - 2 * base_fee * COIN , "in_mempool" : True })
261
+ assert_equal (self .nodes [0 ].getprioritisedtransactions ()[high_fee_tx ], { "fee_delta" : - 2 * base_fee * COIN , "in_mempool" : True , "modified_fee" : int ( - 2 * base_fee * COIN + COIN * 3 * base_fee ) })
268
262
for x in txids [2 ]:
269
263
if (x != high_fee_tx ):
270
264
assert x not in mempool
271
265
266
+
267
+ self .log .info ("Assert that 0 delta is never added to mapDeltas" )
268
+ tx_id_zero_del = self .wallet .create_self_transfer ()['txid' ]
269
+ self .nodes [0 ].prioritisetransaction (txid = tx_id_zero_del , fee_delta = 0 )
270
+ assert tx_id_zero_del not in self .nodes [0 ].getprioritisedtransactions ()
271
+
272
272
# Create a free transaction. Should be rejected.
273
273
tx_res = self .wallet .create_self_transfer (fee_rate = 0 )
274
274
tx_hex = tx_res ['hex' ]
@@ -287,7 +287,7 @@ def run_test(self):
287
287
self .log .info ("Assert that prioritised free transaction is accepted to mempool" )
288
288
assert_equal (self .nodes [0 ].sendrawtransaction (tx_hex ), tx_id )
289
289
assert tx_id in self .nodes [0 ].getrawmempool ()
290
- assert_equal (self .nodes [0 ].getprioritisedtransactions ()[tx_id ], { "fee_delta" : self .relayfee * COIN , "in_mempool" : True })
290
+ assert_equal (self .nodes [0 ].getprioritisedtransactions ()[tx_id ], { "fee_delta" : self .relayfee * COIN , "in_mempool" : True , "modified_fee" : int ( self . relayfee * COIN + COIN * tx_res [ "fee" ]) })
291
291
292
292
# Test that calling prioritisetransaction is sufficient to trigger
293
293
# getblocktemplate to (eventually) return a new block.
0 commit comments