mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-04 06:12:07 +01:00
Simplify usage of Span in several places
This commit is contained in:
@@ -139,7 +139,7 @@ std::string DescriptorChecksum(const Span<const char>& span)
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string AddChecksum(const std::string& str) { return str + "#" + DescriptorChecksum(MakeSpan(str)); }
|
||||
std::string AddChecksum(const std::string& str) { return str + "#" + DescriptorChecksum(str); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Internal representation //
|
||||
@@ -1087,7 +1087,7 @@ bool CheckChecksum(Span<const char>& sp, bool require_checksum, std::string& err
|
||||
|
||||
std::unique_ptr<Descriptor> Parse(const std::string& descriptor, FlatSigningProvider& out, std::string& error, bool require_checksum)
|
||||
{
|
||||
Span<const char> sp(descriptor.data(), descriptor.size());
|
||||
Span<const char> sp{descriptor};
|
||||
if (!CheckChecksum(sp, require_checksum, error)) return nullptr;
|
||||
auto ret = ParseScript(0, sp, ParseScriptContext::TOP, out, error);
|
||||
if (sp.size() == 0 && ret) return std::unique_ptr<Descriptor>(std::move(ret));
|
||||
@@ -1098,7 +1098,7 @@ std::string GetDescriptorChecksum(const std::string& descriptor)
|
||||
{
|
||||
std::string ret;
|
||||
std::string error;
|
||||
Span<const char> sp(descriptor.data(), descriptor.size());
|
||||
Span<const char> sp{descriptor};
|
||||
if (!CheckChecksum(sp, false, error, &ret)) return "";
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user