@@ -126,36 +126,35 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
126
126
tx1.vout .resize (1 );
127
127
tx1.vout [0 ].scriptPubKey = CScript () << OP_11 << OP_EQUAL;
128
128
tx1.vout [0 ].nValue = 10 * COIN;
129
- pool.addUnchecked (tx1.GetHash (), entry.Fee (10000LL ).Priority ( 10.0 ). FromTx (tx1));
129
+ pool.addUnchecked (tx1.GetHash (), entry.Fee (10000LL ).FromTx (tx1));
130
130
131
131
/* highest fee */
132
132
CMutableTransaction tx2 = CMutableTransaction ();
133
133
tx2.vout .resize (1 );
134
134
tx2.vout [0 ].scriptPubKey = CScript () << OP_11 << OP_EQUAL;
135
135
tx2.vout [0 ].nValue = 2 * COIN;
136
- pool.addUnchecked (tx2.GetHash (), entry.Fee (20000LL ).Priority ( 9.0 ). FromTx (tx2));
136
+ pool.addUnchecked (tx2.GetHash (), entry.Fee (20000LL ).FromTx (tx2));
137
137
138
138
/* lowest fee */
139
139
CMutableTransaction tx3 = CMutableTransaction ();
140
140
tx3.vout .resize (1 );
141
141
tx3.vout [0 ].scriptPubKey = CScript () << OP_11 << OP_EQUAL;
142
142
tx3.vout [0 ].nValue = 5 * COIN;
143
- pool.addUnchecked (tx3.GetHash (), entry.Fee (0LL ).Priority ( 100.0 ). FromTx (tx3));
143
+ pool.addUnchecked (tx3.GetHash (), entry.Fee (0LL ).FromTx (tx3));
144
144
145
145
/* 2nd highest fee */
146
146
CMutableTransaction tx4 = CMutableTransaction ();
147
147
tx4.vout .resize (1 );
148
148
tx4.vout [0 ].scriptPubKey = CScript () << OP_11 << OP_EQUAL;
149
149
tx4.vout [0 ].nValue = 6 * COIN;
150
- pool.addUnchecked (tx4.GetHash (), entry.Fee (15000LL ).Priority ( 1.0 ). FromTx (tx4));
150
+ pool.addUnchecked (tx4.GetHash (), entry.Fee (15000LL ).FromTx (tx4));
151
151
152
152
/* equal fee rate to tx1, but newer */
153
153
CMutableTransaction tx5 = CMutableTransaction ();
154
154
tx5.vout .resize (1 );
155
155
tx5.vout [0 ].scriptPubKey = CScript () << OP_11 << OP_EQUAL;
156
156
tx5.vout [0 ].nValue = 11 * COIN;
157
157
entry.nTime = 1 ;
158
- entry.dPriority = 10.0 ;
159
158
pool.addUnchecked (tx5.GetHash (), entry.Fee (10000LL ).FromTx (tx5));
160
159
BOOST_CHECK_EQUAL (pool.size (), 5 );
161
160
@@ -328,29 +327,29 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
328
327
tx1.vout .resize (1 );
329
328
tx1.vout [0 ].scriptPubKey = CScript () << OP_11 << OP_EQUAL;
330
329
tx1.vout [0 ].nValue = 10 * COIN;
331
- pool.addUnchecked (tx1.GetHash (), entry.Fee (10000LL ).Priority ( 10.0 ). FromTx (tx1));
330
+ pool.addUnchecked (tx1.GetHash (), entry.Fee (10000LL ).FromTx (tx1));
332
331
333
332
/* highest fee */
334
333
CMutableTransaction tx2 = CMutableTransaction ();
335
334
tx2.vout .resize (1 );
336
335
tx2.vout [0 ].scriptPubKey = CScript () << OP_11 << OP_EQUAL;
337
336
tx2.vout [0 ].nValue = 2 * COIN;
338
- pool.addUnchecked (tx2.GetHash (), entry.Fee (20000LL ).Priority ( 9.0 ). FromTx (tx2));
337
+ pool.addUnchecked (tx2.GetHash (), entry.Fee (20000LL ).FromTx (tx2));
339
338
uint64_t tx2Size = GetVirtualTransactionSize (tx2);
340
339
341
340
/* lowest fee */
342
341
CMutableTransaction tx3 = CMutableTransaction ();
343
342
tx3.vout .resize (1 );
344
343
tx3.vout [0 ].scriptPubKey = CScript () << OP_11 << OP_EQUAL;
345
344
tx3.vout [0 ].nValue = 5 * COIN;
346
- pool.addUnchecked (tx3.GetHash (), entry.Fee (0LL ).Priority ( 100.0 ). FromTx (tx3));
345
+ pool.addUnchecked (tx3.GetHash (), entry.Fee (0LL ).FromTx (tx3));
347
346
348
347
/* 2nd highest fee */
349
348
CMutableTransaction tx4 = CMutableTransaction ();
350
349
tx4.vout .resize (1 );
351
350
tx4.vout [0 ].scriptPubKey = CScript () << OP_11 << OP_EQUAL;
352
351
tx4.vout [0 ].nValue = 6 * COIN;
353
- pool.addUnchecked (tx4.GetHash (), entry.Fee (15000LL ).Priority ( 1.0 ). FromTx (tx4));
352
+ pool.addUnchecked (tx4.GetHash (), entry.Fee (15000LL ).FromTx (tx4));
354
353
355
354
/* equal fee rate to tx1, but newer */
356
355
CMutableTransaction tx5 = CMutableTransaction ();
@@ -434,23 +433,22 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
434
433
{
435
434
CTxMemPool pool (CFeeRate (1000 ));
436
435
TestMemPoolEntryHelper entry;
437
- entry.dPriority = 10.0 ;
438
436
439
437
CMutableTransaction tx1 = CMutableTransaction ();
440
438
tx1.vin .resize (1 );
441
439
tx1.vin [0 ].scriptSig = CScript () << OP_1;
442
440
tx1.vout .resize (1 );
443
441
tx1.vout [0 ].scriptPubKey = CScript () << OP_1 << OP_EQUAL;
444
442
tx1.vout [0 ].nValue = 10 * COIN;
445
- pool.addUnchecked (tx1.GetHash (), entry.Fee (10000LL ).FromTx (tx1, &pool ));
443
+ pool.addUnchecked (tx1.GetHash (), entry.Fee (10000LL ).FromTx (tx1));
446
444
447
445
CMutableTransaction tx2 = CMutableTransaction ();
448
446
tx2.vin .resize (1 );
449
447
tx2.vin [0 ].scriptSig = CScript () << OP_2;
450
448
tx2.vout .resize (1 );
451
449
tx2.vout [0 ].scriptPubKey = CScript () << OP_2 << OP_EQUAL;
452
450
tx2.vout [0 ].nValue = 10 * COIN;
453
- pool.addUnchecked (tx2.GetHash (), entry.Fee (5000LL ).FromTx (tx2, &pool ));
451
+ pool.addUnchecked (tx2.GetHash (), entry.Fee (5000LL ).FromTx (tx2));
454
452
455
453
pool.TrimToSize (pool.DynamicMemoryUsage ()); // should do nothing
456
454
BOOST_CHECK (pool.exists (tx1.GetHash ()));
@@ -460,15 +458,15 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
460
458
BOOST_CHECK (pool.exists (tx1.GetHash ()));
461
459
BOOST_CHECK (!pool.exists (tx2.GetHash ()));
462
460
463
- pool.addUnchecked (tx2.GetHash (), entry.FromTx (tx2, &pool ));
461
+ pool.addUnchecked (tx2.GetHash (), entry.FromTx (tx2));
464
462
CMutableTransaction tx3 = CMutableTransaction ();
465
463
tx3.vin .resize (1 );
466
464
tx3.vin [0 ].prevout = COutPoint (tx2.GetHash (), 0 );
467
465
tx3.vin [0 ].scriptSig = CScript () << OP_2;
468
466
tx3.vout .resize (1 );
469
467
tx3.vout [0 ].scriptPubKey = CScript () << OP_3 << OP_EQUAL;
470
468
tx3.vout [0 ].nValue = 10 * COIN;
471
- pool.addUnchecked (tx3.GetHash (), entry.Fee (20000LL ).FromTx (tx3, &pool ));
469
+ pool.addUnchecked (tx3.GetHash (), entry.Fee (20000LL ).FromTx (tx3));
472
470
473
471
pool.TrimToSize (pool.DynamicMemoryUsage () * 3 / 4 ); // tx3 should pay for tx2 (CPFP)
474
472
BOOST_CHECK (!pool.exists (tx1.GetHash ()));
@@ -531,10 +529,10 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
531
529
tx7.vout [1 ].scriptPubKey = CScript () << OP_7 << OP_EQUAL;
532
530
tx7.vout [1 ].nValue = 10 * COIN;
533
531
534
- pool.addUnchecked (tx4.GetHash (), entry.Fee (7000LL ).FromTx (tx4, &pool ));
535
- pool.addUnchecked (tx5.GetHash (), entry.Fee (1000LL ).FromTx (tx5, &pool ));
536
- pool.addUnchecked (tx6.GetHash (), entry.Fee (1100LL ).FromTx (tx6, &pool ));
537
- pool.addUnchecked (tx7.GetHash (), entry.Fee (9000LL ).FromTx (tx7, &pool ));
532
+ pool.addUnchecked (tx4.GetHash (), entry.Fee (7000LL ).FromTx (tx4));
533
+ pool.addUnchecked (tx5.GetHash (), entry.Fee (1000LL ).FromTx (tx5));
534
+ pool.addUnchecked (tx6.GetHash (), entry.Fee (1100LL ).FromTx (tx6));
535
+ pool.addUnchecked (tx7.GetHash (), entry.Fee (9000LL ).FromTx (tx7));
538
536
539
537
// we only require this remove, at max, 2 txn, because its not clear what we're really optimizing for aside from that
540
538
pool.TrimToSize (pool.DynamicMemoryUsage () - 1 );
@@ -543,17 +541,17 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
543
541
BOOST_CHECK (!pool.exists (tx7.GetHash ()));
544
542
545
543
if (!pool.exists (tx5.GetHash ()))
546
- pool.addUnchecked (tx5.GetHash (), entry.Fee (1000LL ).FromTx (tx5, &pool ));
547
- pool.addUnchecked (tx7.GetHash (), entry.Fee (9000LL ).FromTx (tx7, &pool ));
544
+ pool.addUnchecked (tx5.GetHash (), entry.Fee (1000LL ).FromTx (tx5));
545
+ pool.addUnchecked (tx7.GetHash (), entry.Fee (9000LL ).FromTx (tx7));
548
546
549
547
pool.TrimToSize (pool.DynamicMemoryUsage () / 2 ); // should maximize mempool size by only removing 5/7
550
548
BOOST_CHECK (pool.exists (tx4.GetHash ()));
551
549
BOOST_CHECK (!pool.exists (tx5.GetHash ()));
552
550
BOOST_CHECK (pool.exists (tx6.GetHash ()));
553
551
BOOST_CHECK (!pool.exists (tx7.GetHash ()));
554
552
555
- pool.addUnchecked (tx5.GetHash (), entry.Fee (1000LL ).FromTx (tx5, &pool ));
556
- pool.addUnchecked (tx7.GetHash (), entry.Fee (9000LL ).FromTx (tx7, &pool ));
553
+ pool.addUnchecked (tx5.GetHash (), entry.Fee (1000LL ).FromTx (tx5));
554
+ pool.addUnchecked (tx7.GetHash (), entry.Fee (9000LL ).FromTx (tx7));
557
555
558
556
std::vector<CTransactionRef> vtx;
559
557
SetMockTime (42 );
0 commit comments