print peer id in 0 padded hex for consistency

This commit is contained in:
moneromooo-monero 2017-08-20 21:15:53 +01:00
parent 8f8cc09ba1
commit 5524bc3151
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
4 changed files with 29 additions and 22 deletions

View file

@ -314,6 +314,18 @@ POP_WARNINGS
return str;
}
//----------------------------------------------------------------------------
inline std::string pad_string(std::string s, size_t n, char c = ' ', bool prepend = false)
{
if (s.size() < n)
{
if (prepend)
s = std::string(n - s.size(), c) + s;
else
s.append(n - s.size(), c);
}
return s;
}
//----------------------------------------------------------------------------
template<class t_pod_type>
std::string pod_to_hex(const t_pod_type& s)
{