@@ -694,19 +694,21 @@ namespace cryptonote
694
694
return true ;
695
695
}
696
696
// ------------------------------------------------------------------
697
- bool tx_memory_pool::get_transactions_info (const std::vector<crypto::hash>& txids, std::vector<std::pair<crypto::hash, tx_details>>& txs, bool include_sensitive) const
697
+ bool tx_memory_pool::get_transactions_info (const std::vector<crypto::hash>& txids, std::vector<std::pair<crypto::hash, tx_details>>& txs, bool include_sensitive, size_t limit_size ) const
698
698
{
699
699
CRITICAL_REGION_LOCAL (m_transactions_lock);
700
700
CRITICAL_REGION_LOCAL1 (m_blockchain);
701
701
702
702
txs.clear ();
703
+ size_t size = 0 ;
703
704
704
705
for (const auto &it: txids)
705
706
{
706
707
tx_details details;
707
708
bool success = get_transaction_info (it, details, include_sensitive, true /* include_blob*/ );
708
- if (success)
709
+ if (success && (!limit_size || (size + details. blob_size < limit_size)) )
709
710
{
711
+ size += details.blob_size ;
710
712
txs.push_back (std::make_pair (it, std::move (details)));
711
713
}
712
714
}
@@ -985,7 +987,7 @@ namespace cryptonote
985
987
}, false , category);
986
988
}
987
989
// ------------------------------------------------------------------
988
- bool tx_memory_pool::get_pool_info (time_t start_time, bool include_sensitive, size_t max_tx_count, std::vector<std::pair<crypto::hash, tx_details>>& added_txs, std::vector<crypto::hash>& remaining_added_txids, std::vector<crypto::hash>& removed_txs, bool & incremental) const
990
+ bool tx_memory_pool::get_pool_info (time_t start_time, bool include_sensitive, size_t max_tx_count, std::vector<std::pair<crypto::hash, tx_details>>& added_txs, std::vector<crypto::hash>& remaining_added_txids, std::vector<crypto::hash>& removed_txs, bool & incremental, size_t limit_size ) const
989
991
{
990
992
CRITICAL_REGION_LOCAL (m_transactions_lock);
991
993
CRITICAL_REGION_LOCAL1 (m_blockchain);
@@ -1029,7 +1031,7 @@ namespace cryptonote
1029
1031
remaining_added_txids = std::vector<crypto::hash>(txids.begin () + max_tx_count, txids.end ());
1030
1032
txids.erase (txids.begin () + max_tx_count, txids.end ());
1031
1033
}
1032
- get_transactions_info (txids, added_txs, include_sensitive);
1034
+ get_transactions_info (txids, added_txs, include_sensitive, limit_size );
1033
1035
return true ;
1034
1036
}
1035
1037
@@ -1039,7 +1041,7 @@ namespace cryptonote
1039
1041
if (pit.second >= start_time)
1040
1042
txids.push_back (pit.first );
1041
1043
}
1042
- get_transactions_info (txids, added_txs, include_sensitive);
1044
+ get_transactions_info (txids, added_txs, include_sensitive, limit_size );
1043
1045
if (added_txs.size () > max_tx_count)
1044
1046
{
1045
1047
remaining_added_txids.reserve (added_txs.size () - max_tx_count);
0 commit comments