@@ -1189,6 +1189,8 @@ namespace cryptonote
1189
1189
}
1190
1190
1191
1191
bool is_nofake_tx = false ;
1192
+ bool can_nofake_tx_be_simply_added = false ;
1193
+ bool can_nofake_tx_replace_existing_tx = false ;
1192
1194
if (tx.vin .size () > 0 )
1193
1195
{
1194
1196
if (version >= 2 )
@@ -1251,7 +1253,6 @@ namespace cryptonote
1251
1253
1252
1254
LOG_PRINT_L2 (" We have currently " << nofake_txs_taken << " non-private transactions out of " << n << " transactions in the block" );
1253
1255
1254
- bool can_nofake_tx_be_simply_added = false ;
1255
1256
if (nofake_txs_taken + 1 <= rational_ceil ((n + 1 ) * NOFAKE_TXS_TO_TOTAL_TXS_PERCENT, 100 ))
1256
1257
{
1257
1258
LOG_PRINT_L2 (" Checking if this tx can be simply added" );
@@ -1267,7 +1268,6 @@ namespace cryptonote
1267
1268
}
1268
1269
}
1269
1270
1270
- bool can_nofake_tx_replace_existing_tx = false ;
1271
1271
if (!can_nofake_tx_be_simply_added && n > nofake_txs_taken && nofake_txs_taken + 1 <= rational_ceil (n * NOFAKE_TXS_TO_TOTAL_TXS_PERCENT, 100 ))
1272
1272
{
1273
1273
LOG_PRINT_L2 (" Checking if this tx can replace an already added tx" );
@@ -1279,9 +1279,6 @@ namespace cryptonote
1279
1279
{
1280
1280
LOG_PRINT_L2 (" replacing existing tx " << bl.tx_hashes .back () << " with this tx would increase coinbase to " << print_money (coinbase));
1281
1281
can_nofake_tx_replace_existing_tx = true ;
1282
- bl.tx_hashes .pop_back ();
1283
- tx_sizes.pop_back ();
1284
- tx_fees.pop_back ();
1285
1282
}
1286
1283
}
1287
1284
}
@@ -1350,6 +1347,16 @@ namespace cryptonote
1350
1347
tx_sizes.insert (tx_sizes.begin (), meta.blob_size ); // not really needed, just to make these two arrays in correspondence with bl.tx_hashes
1351
1348
tx_fees.insert (tx_fees.begin (), meta.fee );
1352
1349
1350
+ if (can_nofake_tx_replace_existing_tx)
1351
+ {
1352
+ // remove the least profitable tx at the back of the array
1353
+ bl.tx_hashes .pop_back ();
1354
+ total_size -= tx_sizes.back ();
1355
+ fee -= tx_fees.back ();
1356
+ tx_sizes.pop_back ();
1357
+ tx_fees.pop_back ();
1358
+ }
1359
+
1353
1360
nofake_txs_taken++;
1354
1361
}
1355
1362
else
0 commit comments