mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
Use new Join() helper for ListBlockFilterTypes()
This commit is contained in:
parent
fa1c716955
commit
fa95315655
1 changed files with 2 additions and 14 deletions
|
@ -3,7 +3,6 @@
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <sstream>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include <blockfilter.h>
|
#include <blockfilter.h>
|
||||||
|
@ -13,6 +12,7 @@
|
||||||
#include <script/script.h>
|
#include <script/script.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
#include <util/golombrice.h>
|
#include <util/golombrice.h>
|
||||||
|
#include <util/string.h>
|
||||||
|
|
||||||
/// SerType used to serialize parameters in GCS filter encoding.
|
/// SerType used to serialize parameters in GCS filter encoding.
|
||||||
static constexpr int GCS_SER_TYPE = SER_NETWORK;
|
static constexpr int GCS_SER_TYPE = SER_NETWORK;
|
||||||
|
@ -179,19 +179,7 @@ const std::set<BlockFilterType>& AllBlockFilterTypes()
|
||||||
|
|
||||||
const std::string& ListBlockFilterTypes()
|
const std::string& ListBlockFilterTypes()
|
||||||
{
|
{
|
||||||
static std::string type_list;
|
static std::string type_list{Join(g_filter_types, ", ", [](const auto& entry) { return entry.second; })};
|
||||||
|
|
||||||
static std::once_flag flag;
|
|
||||||
std::call_once(flag, []() {
|
|
||||||
std::stringstream ret;
|
|
||||||
bool first = true;
|
|
||||||
for (const auto& entry : g_filter_types) {
|
|
||||||
if (!first) ret << ", ";
|
|
||||||
ret << entry.second;
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
type_list = ret.str();
|
|
||||||
});
|
|
||||||
|
|
||||||
return type_list;
|
return type_list;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue