refactor: Remove Span operator==, Use std::ranges::equal

This commit is contained in:
MarcoFalke
2023-12-13 12:24:21 +01:00
parent 1873e4116f
commit fadf0a7e15
20 changed files with 71 additions and 69 deletions

View File

@@ -21,6 +21,7 @@
#include <util/strencodings.h>
#include <util/vector.h>
#include <algorithm>
#include <memory>
#include <numeric>
#include <optional>
@@ -1405,11 +1406,11 @@ std::unique_ptr<PubkeyProvider> ParsePubkeyInner(uint32_t key_exp_index, const S
}
KeyPath path;
DeriveType type = DeriveType::NO;
if (split.back() == Span{"*"}.first(1)) {
if (std::ranges::equal(split.back(), Span{"*"}.first(1))) {
split.pop_back();
type = DeriveType::UNHARDENED;
} else if (split.back() == Span{"*'"}.first(2) || split.back() == Span{"*h"}.first(2)) {
apostrophe = split.back() == Span{"*'"}.first(2);
} else if (std::ranges::equal(split.back(), Span{"*'"}.first(2)) || std::ranges::equal(split.back(), Span{"*h"}.first(2))) {
apostrophe = std::ranges::equal(split.back(), Span{"*'"}.first(2));
split.pop_back();
type = DeriveType::HARDENED;
}