mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 13:43:43 +01:00
Merge bitcoin/bitcoin#29071: refactor: Remove Span operator==, Use std::ranges::equal
fad0cf6f26refactor: Use std::ranges::equal in GetNetworkForMagic (MarcoFalke)fadf0a7e15refactor: Remove Span operator==, Use std::ranges::equal (MarcoFalke) Pull request description: `std::span` removed the comparison operators, so it makes sense to remove them for the `Span` "backport" as well. Using `std::ranges::equal` also has the benefit that some `Span` temporary constructions can now be dropped. This is required to move from `Span` toward `std::span`. ACKs for top commit: hodlinator: Untested Code Review re-ACKfad0cf6stickies-v: ACKfad0cf6f26TheCharlatan: ACKfad0cf6f26Tree-SHA512: 5b9d1826ceac2aabae2295bc89893dd23ac3a1cc0d41988331cdbdc21be531aa91795d5273819f349f79648c6c4f30ed31af6e7a3816153e92080061b92ffe00
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user