diff options
Diffstat (limited to 'src/rpc/util.cpp')
-rw-r--r-- | src/rpc/util.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index f01944cd0b..f95ac4cb4b 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -1175,8 +1175,25 @@ UniValue GetServicesNames(ServiceFlags services) return servicesNames; } +/** Convert a vector of bilingual strings to a UniValue::VARR containing their original untranslated values. */ +[[nodiscard]] static UniValue BilingualStringsToUniValue(const std::vector<bilingual_str>& bilingual_strings) +{ + CHECK_NONFATAL(!bilingual_strings.empty()); + UniValue result{UniValue::VARR}; + for (const auto& s : bilingual_strings) { + result.push_back(s.original); + } + return result; +} + void PushWarnings(const UniValue& warnings, UniValue& obj) { if (warnings.empty()) return; obj.pushKV("warnings", warnings); } + +void PushWarnings(const std::vector<bilingual_str>& warnings, UniValue& obj) +{ + if (warnings.empty()) return; + obj.pushKV("warnings", BilingualStringsToUniValue(warnings)); +} |