@@ -89,28 +89,28 @@ def run_test(self):
89
89
assert_equal (entry , mempool [x ])
90
90
91
91
# Check that the descendant calculations are correct
92
- assert_equal (mempool [ x ] ['descendantcount' ], descendant_count )
93
- descendant_fees += mempool [ x ] ['fee' ]
94
- assert_equal (mempool [ x ][ 'modifiedfee' ], mempool [ x ] ['fee' ])
95
- assert_equal (mempool [ x ][ 'fees' ]['base' ], mempool [ x ] ['fee' ])
96
- assert_equal (mempool [ x ][ 'fees' ]['modified' ], mempool [ x ] ['modifiedfee' ])
97
- assert_equal (mempool [ x ] ['descendantfees' ], descendant_fees * COIN )
98
- assert_equal (mempool [ x ] ['fees' ]['descendant' ], descendant_fees )
99
- descendant_vsize += mempool [ x ] ['vsize' ]
100
- assert_equal (mempool [ x ] ['descendantsize' ], descendant_vsize )
92
+ assert_equal (entry ['descendantcount' ], descendant_count )
93
+ descendant_fees += entry ['fee' ]
94
+ assert_equal (entry [ 'modifiedfee' ], entry ['fee' ])
95
+ assert_equal (entry [ 'fees' ]['base' ], entry ['fee' ])
96
+ assert_equal (entry [ 'fees' ]['modified' ], entry ['modifiedfee' ])
97
+ assert_equal (entry ['descendantfees' ], descendant_fees * COIN )
98
+ assert_equal (entry ['fees' ]['descendant' ], descendant_fees )
99
+ descendant_vsize += entry ['vsize' ]
100
+ assert_equal (entry ['descendantsize' ], descendant_vsize )
101
101
descendant_count += 1
102
102
103
103
# Check that ancestor calculations are correct
104
- assert_equal (mempool [ x ] ['ancestorcount' ], ancestor_count )
105
- assert_equal (mempool [ x ] ['ancestorfees' ], ancestor_fees * COIN )
106
- assert_equal (mempool [ x ] ['ancestorsize' ], ancestor_vsize )
107
- ancestor_vsize -= mempool [ x ] ['vsize' ]
108
- ancestor_fees -= mempool [ x ] ['fee' ]
104
+ assert_equal (entry ['ancestorcount' ], ancestor_count )
105
+ assert_equal (entry ['ancestorfees' ], ancestor_fees * COIN )
106
+ assert_equal (entry ['ancestorsize' ], ancestor_vsize )
107
+ ancestor_vsize -= entry ['vsize' ]
108
+ ancestor_fees -= entry ['fee' ]
109
109
ancestor_count -= 1
110
110
111
111
# Check that parent/child list is correct
112
- assert_equal (mempool [ x ] ['spentby' ], descendants [- 1 :])
113
- assert_equal (mempool [ x ] ['depends' ], ancestors [- 2 :- 1 ])
112
+ assert_equal (entry ['spentby' ], descendants [- 1 :])
113
+ assert_equal (entry ['depends' ], ancestors [- 2 :- 1 ])
114
114
115
115
# Check that getmempooldescendants is correct
116
116
assert_equal (sorted (descendants ), sorted (self .nodes [0 ].getmempooldescendants (x )))
@@ -153,26 +153,26 @@ def run_test(self):
153
153
# Check that ancestor modified fees includes fee deltas from
154
154
# prioritisetransaction
155
155
self .nodes [0 ].prioritisetransaction (txid = chain [0 ], fee_delta = 1000 )
156
- mempool = self .nodes [0 ].getrawmempool (True )
157
156
ancestor_fees = 0
158
157
for x in chain :
159
- ancestor_fees += mempool [x ]['fee' ]
160
- assert_equal (mempool [x ]['fees' ]['ancestor' ], ancestor_fees + Decimal ('0.00001' ))
161
- assert_equal (mempool [x ]['ancestorfees' ], ancestor_fees * COIN + 1000 )
158
+ entry = self .nodes [0 ].getmempoolentry (x )
159
+ ancestor_fees += entry ['fee' ]
160
+ assert_equal (entry ['fees' ]['ancestor' ], ancestor_fees + Decimal ('0.00001' ))
161
+ assert_equal (entry ['ancestorfees' ], ancestor_fees * COIN + 1000 )
162
162
163
163
# Undo the prioritisetransaction for later tests
164
164
self .nodes [0 ].prioritisetransaction (txid = chain [0 ], fee_delta = - 1000 )
165
165
166
166
# Check that descendant modified fees includes fee deltas from
167
167
# prioritisetransaction
168
168
self .nodes [0 ].prioritisetransaction (txid = chain [- 1 ], fee_delta = 1000 )
169
- mempool = self .nodes [0 ].getrawmempool (True )
170
169
171
170
descendant_fees = 0
172
171
for x in reversed (chain ):
173
- descendant_fees += mempool [x ]['fee' ]
174
- assert_equal (mempool [x ]['fees' ]['descendant' ], descendant_fees + Decimal ('0.00001' ))
175
- assert_equal (mempool [x ]['descendantfees' ], descendant_fees * COIN + 1000 )
172
+ entry = self .nodes [0 ].getmempoolentry (x )
173
+ descendant_fees += entry ['fee' ]
174
+ assert_equal (entry ['fees' ]['descendant' ], descendant_fees + Decimal ('0.00001' ))
175
+ assert_equal (entry ['descendantfees' ], descendant_fees * COIN + 1000 )
176
176
177
177
# Adding one more transaction on to the chain should fail.
178
178
assert_raises_rpc_error (- 26 , "too-long-mempool-chain" , chain_transaction , self .nodes [0 ], [txid ], [vout ], value , fee , 1 )
@@ -190,16 +190,15 @@ def run_test(self):
190
190
self .nodes [1 ].invalidateblock (self .nodes [1 ].getbestblockhash ())
191
191
192
192
# Now check that the transaction is in the mempool, with the right modified fee
193
- mempool = self .nodes [0 ].getrawmempool (True )
194
-
195
193
descendant_fees = 0
196
194
for x in reversed (chain ):
197
- descendant_fees += mempool [x ]['fee' ]
195
+ entry = self .nodes [0 ].getmempoolentry (x )
196
+ descendant_fees += entry ['fee' ]
198
197
if (x == chain [- 1 ]):
199
- assert_equal (mempool [ x ][ 'modifiedfee' ], mempool [ x ] ['fee' ]+ satoshi_round (0.00002 ))
200
- assert_equal (mempool [ x ][ 'fees' ]['modified' ], mempool [ x ] ['fee' ]+ satoshi_round (0.00002 ))
201
- assert_equal (mempool [ x ] ['descendantfees' ], descendant_fees * COIN + 2000 )
202
- assert_equal (mempool [ x ] ['fees' ]['descendant' ], descendant_fees + satoshi_round (0.00002 ))
198
+ assert_equal (entry [ 'modifiedfee' ], entry ['fee' ]+ satoshi_round (0.00002 ))
199
+ assert_equal (entry [ 'fees' ]['modified' ], entry ['fee' ]+ satoshi_round (0.00002 ))
200
+ assert_equal (entry ['descendantfees' ], descendant_fees * COIN + 2000 )
201
+ assert_equal (entry ['fees' ]['descendant' ], descendant_fees + satoshi_round (0.00002 ))
203
202
204
203
# Check that node1's mempool is as expected (-> custom ancestor limit)
205
204
mempool0 = self .nodes [0 ].getrawmempool (False )
@@ -255,7 +254,7 @@ def run_test(self):
255
254
# - txs from previous ancestor test (-> custom ancestor limit)
256
255
# - parent tx for descendant test
257
256
# - txs chained off parent tx (-> custom descendant limit)
258
- self .wait_until (lambda : len (self .nodes [1 ].getrawmempool (False )) ==
257
+ self .wait_until (lambda : len (self .nodes [1 ].getrawmempool ()) ==
259
258
MAX_ANCESTORS_CUSTOM + 1 + MAX_DESCENDANTS_CUSTOM , timeout = 10 )
260
259
mempool0 = self .nodes [0 ].getrawmempool (False )
261
260
mempool1 = self .nodes [1 ].getrawmempool (False )
0 commit comments