refactor: Make HexStr take a span

Make HexStr take a span of bytes, instead of an awkward pair of
templated iterators.
This commit is contained in:
Wladimir J. van der Laan
2020-06-24 17:26:47 +02:00
parent 34eb236258
commit 0a8aa626dd
16 changed files with 50 additions and 70 deletions

View File

@@ -48,13 +48,14 @@ std::string FormatScript(const CScript& script)
}
}
if (vch.size() > 0) {
ret += strprintf("0x%x 0x%x ", HexStr(it2, it - vch.size()), HexStr(it - vch.size(), it));
ret += strprintf("0x%x 0x%x ", HexStr(std::vector<uint8_t>(it2, it - vch.size())),
HexStr(std::vector<uint8_t>(it - vch.size(), it)));
} else {
ret += strprintf("0x%x ", HexStr(it2, it));
ret += strprintf("0x%x ", HexStr(std::vector<uint8_t>(it2, it)));
}
continue;
}
ret += strprintf("0x%x ", HexStr(it2, script.end()));
ret += strprintf("0x%x ", HexStr(std::vector<uint8_t>(it2, script.end())));
break;
}
return ret.substr(0, ret.size() - 1);