aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol
diff options
context:
space:
mode:
authorjeffro256 <jeffro256@tutanota.com>2025-11-03 17:05:57 -0600
committerjeffro256 <jeffro256@tutanota.com>2026-03-21 23:50:10 -1000
commit0761024b349048ebf79dbfe71caab11826833464 (patch)
treeba73e9ab3f873fcc0e7b4520d4889669ca7e8ee6 /src/cryptonote_protocol
parent23b420a992417abb6131b3d152d7e32adf224351 (diff)
downloadmonzero-core-0761024b349048ebf79dbfe71caab11826833464.tar.gz
monzero-core-0761024b349048ebf79dbfe71caab11826833464.tar.xz
monzero-core-0761024b349048ebf79dbfe71caab11826833464.zip
tx_memory_pool: speedup get_complement() for large requests
Changes complexity from M*N to (2*N+M)*log2(M). The FCMP++ stressnet recently hit mempool sizes of ~55k txs. If the requesting node's mempool is populated, this results in an average of (55000*55000)/2 (about 1.5 billion) comparisons for the responding node. Under this commit, this would be reduced to (55000+55000)*log2(55000) comparisons (about 2.6 million), a 99.83% reduction.
Diffstat (limited to 'src/cryptonote_protocol')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index fb195b390..6a3fd2532 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -855,7 +855,7 @@ namespace cryptonote
std::vector<cryptonote::blobdata> local_txs;
std::vector<cryptonote::blobdata> txes;
- if (!m_core.get_txpool_complement(arg.hashes, txes))
+ if (!m_core.get_txpool_complement(std::move(arg.hashes), txes))
{
LOG_ERROR_CCONTEXT("failed to get txpool complement");
return 1;