diff options
author | MacroFake <falke.marco@gmail.com> | 2022-08-19 19:31:51 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-08-24 10:15:32 +0200 |
commit | fa95315655fcd31a5482f5313faf04dbfa4de580 (patch) | |
tree | 682500d2d50e2c1260739ebac2facb889442565f | |
parent | fa1c71695593d5d3b264c2504baca318fc46d580 (diff) | |
download | bitcoin-fa95315655fcd31a5482f5313faf04dbfa4de580.tar.xz |
Use new Join() helper for ListBlockFilterTypes()
-rw-r--r-- | src/blockfilter.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/blockfilter.cpp b/src/blockfilter.cpp index 43d88df720..85929747be 100644 --- a/src/blockfilter.cpp +++ b/src/blockfilter.cpp @@ -3,7 +3,6 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <mutex> -#include <sstream> #include <set> #include <blockfilter.h> @@ -13,6 +12,7 @@ #include <script/script.h> #include <streams.h> #include <util/golombrice.h> +#include <util/string.h> /// SerType used to serialize parameters in GCS filter encoding. static constexpr int GCS_SER_TYPE = SER_NETWORK; @@ -179,19 +179,7 @@ const std::set<BlockFilterType>& AllBlockFilterTypes() const std::string& ListBlockFilterTypes() { - static std::string type_list; - - 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(); - }); + static std::string type_list{Join(g_filter_types, ", ", [](const auto& entry) { return entry.second; })}; return type_list; } |