MCPcopy Create free account
hub / github.com/ElementsProject/elements / ToStringHelper

Method ToStringHelper

src/script/descriptor.cpp:566–592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564 }
565
566 bool ToStringHelper(const SigningProvider* arg, std::string& out, const StringType type, const DescriptorCache* cache = nullptr) const
567 {
568 std::string extra = ToStringExtra();
569 size_t pos = extra.size() > 0 ? 1 : 0;
570 std::string ret = m_name + "(" + extra;
571 for (const auto& pubkey : m_pubkey_args) {
572 if (pos++) ret += ",";
573 std::string tmp;
574 switch (type) {
575 case StringType::NORMALIZED:
576 if (!pubkey->ToNormalizedString(*arg, tmp, cache)) return false;
577 break;
578 case StringType::PRIVATE:
579 if (!pubkey->ToPrivateString(*arg, tmp)) return false;
580 break;
581 case StringType::PUBLIC:
582 tmp = pubkey->ToString();
583 break;
584 }
585 ret += std::move(tmp);
586 }
587 std::string subscript;
588 if (!ToStringSubScriptHelper(arg, subscript, type, cache)) return false;
589 if (pos && subscript.size()) ret += ',';
590 out = std::move(ret) + std::move(subscript) + ")";
591 return true;
592 }
593
594 std::string ToString() const final
595 {

Callers 2

Calls 4

sizeMethod · 0.45
ToNormalizedStringMethod · 0.45
ToPrivateStringMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected