Partially revert 4652 (#4674)

Using `string_view` results in things like `nSessionDenom: 2 (\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00)` etc. for some reason
This commit is contained in:
UdjinM6 2022-02-02 12:08:50 +03:00 committed by GitHub
parent ac010d9bf3
commit 52d3546a70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 15 deletions

View File

@ -357,6 +357,22 @@ bool CCoinJoin::IsCollateralValid(const CTransaction& txCollateral)
return true;
}
std::string CCoinJoin::DenominationToString(int nDenom)
{
CAmount nDenomAmount = DenominationToAmount(nDenom);
switch (nDenomAmount) {
case 0: return "N/A";
case -1: return "out-of-bounds";
case -2: return "non-denom";
case -3: return "to-amount-error";
default: return ValueFromAmount(nDenomAmount).getValStr();
}
// shouldn't happen
return "to-string-error";
}
std::string CCoinJoin::GetMessageByID(PoolMessage nMessageID)
{
switch (nMessageID) {

View File

@ -438,21 +438,7 @@ public:
/*
Same as DenominationToAmount but returns a string representation
*/
static constexpr std::string_view DenominationToString(int nDenom)
{
CAmount nDenomAmount = DenominationToAmount(nDenom);
switch (nDenomAmount) {
case 0: return "N/A";
case -1: return "out-of-bounds";
case -2: return "non-denom";
case -3: return "to-amount-error";
default: return ValueFromAmount(nDenomAmount).getValStr();
}
// shouldn't happen
return "to-string-error";
}
static std::string DenominationToString(int nDenom);
static std::string GetMessageByID(PoolMessage nMessageID);