depgraph: add memory usage control (feature)

Co-Authored-By: Lőrinc <pap.lorinc@gmail.com>
This commit is contained in:
Pieter Wuille
2025-08-04 18:01:05 -04:00
parent b1637a90de
commit bb5cb222ae
2 changed files with 73 additions and 52 deletions

View File

@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
#include <memusage.h>
#include <random.h>
#include <span.h>
#include <util/feefrac.h>
@@ -332,6 +333,17 @@ public:
}
return true;
}
/** Reduce memory usage if possible. No observable effect. */
void Compact() noexcept
{
entries.shrink_to_fit();
}
size_t DynamicMemoryUsage() const noexcept
{
return memusage::DynamicUsage(entries);
}
};
/** A set of transactions together with their aggregate feerate. */