[#CTxMemPool-ExtractBestByMiningScoreWithTopology]
= xref:CTxMemPool.adoc[CTxMemPool]::ExtractBestByMiningScoreWithTopology
:relfileprefix: ../
:mrdocs:

Look up wtxids in the mempool and (partially) sort by mining score&period;

== Synopsis

Declared in `&lt;txmempool&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;requires&lowbar;capability(0x7f95135d1ff8), requires&lowbar;capability(0x7f9501b113d8), requires&lowbar;capability(0x7f950ec775c8), requires&lowbar;capability(0x7f9525ea7318), requires&lowbar;capability(0x7f9515096a58), requires&lowbar;capability(0x7f950826acf8), requires&lowbar;capability(0x7f94f856e408), requires&lowbar;capability(0x7f9513c585f8)&rsqb;&rsqb;
std::vector&lt;txiter&gt;
ExtractBestByMiningScoreWithTopology(
    std::vector&lt;Wtxid&gt;& wtxids,
    size&lowbar;t n&lowbar;to&lowbar;sort) const;
----

== Description

The `n&lowbar;to&lowbar;sort` best entries are removed from `wtxids` and their corresponding txiter entries are returned&period; In addition wtxids that are duplicates or were not found in the mempool are silently dropped from `wtxids&period;` The returned vector is ordered from best to worst (by CompareMainOrder)&period; Entries remaining in `wtxids` are in unspecified order&period;

Note that the returned `txiter` values may become invalidated once mempool&period;cs is released&period;

== Return Value

The extracted iterators, ordered from best to worst by mining score&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *wtxids* [inout]
| The wtxids to look up&semi; sorted best entries are removed from it&period;
| *n&lowbar;to&lowbar;sort* [in]
| The number of best entries to extract&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
