Merge TER codes with transaction result metadata codes.

This commit is contained in:
JoelKatz
2012-10-16 16:24:32 -07:00
parent 6675a79b63
commit 517f3aa031
2 changed files with 15 additions and 8 deletions

View File

@@ -11,6 +11,7 @@
#include "NewcoinAddress.h"
#include "utils.h"
#include "NewcoinAddress.h"
#include "TransactionErr.h"
STAmount saZero(CURRENCY_ONE, ACCOUNT_ONE, 0);
STAmount saOne(CURRENCY_ONE, ACCOUNT_ONE, 1);
@@ -61,11 +62,23 @@ STUInt8* STUInt8::construct(SerializerIterator& u, SField::ref name)
std::string STUInt8::getText() const
{
if (getFName() == sfTransactionType)
{
std::string token, human;
if (transResultInfo(static_cast<TER>(value), token, human))
return human;
}
return boost::lexical_cast<std::string>(value);
}
Json::Value STUInt8::getJson(int) const
{
if (getFName() == sfTransactionType)
{
std::string token, human;
if (transResultInfo(static_cast<TER>(value), token, human))
return token;
}
return value;
}

View File

@@ -100,14 +100,8 @@ STObject TransactionMetaSet::getAsObject() const
void TransactionMetaSet::addRaw(Serializer& s, TER result)
{
mResult = 255;
if (result == tesSUCCESS)
mResult = 0;
else if (result == tepPATH_DRY)
mResult = 1;
else if (result == tepPATH_PARTIAL)
mResult = 2;
mResult = static_cast<int>(result);
assert((mResult == 0) || ((mResult > 100) && (mResult <= 255)));
mNodes.sort(compare);