Cosmetic.

This commit is contained in:
Arthur Britto
2012-07-02 13:31:33 -07:00
parent c5234545dc
commit 569edadeae
3 changed files with 66 additions and 53 deletions

View File

@@ -74,6 +74,9 @@ public:
static NewcoinAddress createAccountID(const uint160& uiAccountID);
static std::string createHumanAccountID(const uint160& uiAccountID)
{ return createAccountID(uiAccountID).humanAccountID(); }
static std::string createHumanAccountID(const std::vector<unsigned char>& vPrivate)
{ return createAccountPrivate(vPrivate).humanAccountID(); }

View File

@@ -297,7 +297,7 @@ STPathSet* STPathSet::construct(SerializerIterator& s, const char *name)
switch(s.get8())
{
case STPathElement::typeEnd:
if(path.empty())
if (path.empty())
{
if (!paths.empty())
throw std::runtime_error("empty last path");
@@ -335,16 +335,17 @@ int STPathSet::getLength() const
Json::Value STPath::getJson(int) const
{
Json::Value ret(Json::arrayValue);
for (std::vector<STPathElement>::const_iterator it = mPath.begin(), end = mPath.end(); it != end; ++it)
BOOST_FOREACH(std::vector<STPathElement>::const_iterator::value_type it, mPath)
{
switch (it->getNodeType())
switch (it.getNodeType())
{
case STPathElement::typeAccount:
{
Json::Value elem(Json::objectValue);
NewcoinAddress account;
account.setAccountID(it->getNode());
elem["account"] = account.humanAccountID();
elem["account"] = NewcoinAddress::createHumanAccountID(it.getNode());
ret.append(elem);
break;
}
@@ -352,7 +353,9 @@ Json::Value STPath::getJson(int) const
case STPathElement::typeOffer:
{
Json::Value elem(Json::objectValue);
elem["offer"] = it->getNode().GetHex();
elem["offer"] = it.getNode().GetHex();
ret.append(elem);
break;
}
@@ -360,14 +363,17 @@ Json::Value STPath::getJson(int) const
default: throw std::runtime_error("Unknown path element");
}
}
return ret;
}
Json::Value STPathSet::getJson(int options) const
{
Json::Value ret(Json::arrayValue);
for (std::vector<STPath>::const_iterator it = value.begin(), end = value.end(); it!=end; ++it)
ret.append(it->getJson(options));
BOOST_FOREACH(std::vector<STPath>::const_iterator::value_type it, value)
ret.append(it.getJson(options));
return ret;
}
@@ -375,22 +381,22 @@ std::string STPath::getText() const
{
std::string ret("[");
bool first = true;
for (std::vector<STPathElement>::const_iterator it = mPath.begin(), end = mPath.end(); it != end; ++it)
BOOST_FOREACH(std::vector<STPathElement>::const_iterator::value_type it, mPath)
{
if (!first) ret += ", ";
switch (it->getNodeType())
switch (it.getNodeType())
{
case STPathElement::typeAccount:
{
NewcoinAddress account;
account.setAccountID(it->getNode());
ret += account.humanAccountID();
ret += NewcoinAddress::createHumanAccountID(it.getNode());
break;
}
case STPathElement::typeOffer:
{
ret += "Offer(";
ret += it->getNode().GetHex();
ret += it.getNode().GetHex();
ret += ")";
break;
}
@@ -399,6 +405,7 @@ std::string STPath::getText() const
}
first = false;
}
return ret + "]";
}
@@ -406,14 +413,15 @@ std::string STPathSet::getText() const
{
std::string ret("{");
bool firstPath = true;
for (std::vector<STPath>::const_iterator it = value.begin(), end = value.end(); it != end; ++it)
BOOST_FOREACH(std::vector<STPath>::const_iterator::value_type it, value)
{
if (!firstPath)
{
ret += ", ";
firstPath = false;
}
ret += it->getText();
ret += it.getText();
}
return ret + "}";
}
@@ -421,14 +429,16 @@ std::string STPathSet::getText() const
void STPathSet::add(Serializer& s) const
{
bool firstPath = true;
for (std::vector<STPath>::const_iterator pit = value.begin(), pend = value.end(); pit != pend; ++pit)
BOOST_FOREACH(std::vector<STPath>::const_iterator::value_type pit, value)
{
if (!firstPath)
{
s.add8(STPathElement::typeBoundary);
firstPath = false;
}
for (std::vector<STPathElement>::const_iterator eit = pit->begin(), eend = pit->end(); eit != eend; ++eit)
for (std::vector<STPathElement>::const_iterator eit = pit.begin(), eend = pit.end(); eit != eend; ++eit)
{
s.add8(eit->getNodeType());
s.add160(eit->getNode());

View File

@@ -24,49 +24,49 @@ bool transResultInfo(TransactionEngineResult terCode, std::string& strToken, std
const char* cpToken;
const char* cpHuman;
} transResultInfoA[] = {
{ tenGEN_IN_USE, "tenGEN_IN_USE", "Generator already in use." },
{ tenCREATEXNS, "tenCREATEXNS", "Can not specify non XNS for Create." },
{ tenEXPLICITXNS, "tenEXPLICITXNS", "XNS is used by default, don't specify it." },
{ tenDST_NEEDED, "tenDST_NEEDED", "Destination not specified." },
{ tenDST_IS_SRC, "tenDST_IS_SRC", "Destination may not be source." },
{ tenBAD_GEN_AUTH, "tenBAD_GEN_AUTH", "Not authorized to claim generator." },
{ tenBAD_ADD_AUTH, "tenBAD_ADD_AUTH", "Not authorized to add account." },
{ tenBAD_CLAIM_ID, "tenBAD_CLAIM_ID", "Malformed." },
{ tenBAD_SET_ID, "tenBAD_SET_ID", "Malformed." },
{ tenDIRECT_XNS_ONLY, "tenDIRECT_XNS_ONLY", "Direct payments are non-ripple XNS only." },
{ tenRIPPLE_EMPTY, "tenRIPPLE_EMPTY", "PathSet with no paths." },
{ tenCLAIMED, "tenCLAIMED", "Can not claim a previously claimed account." },
{ tenCREATED, "tenCREATED", "Can't add an already created account." },
{ tenMSG_SET, "tenMSG_SET", "Can't change a message key." },
{ tenGEN_IN_USE, "tenGEN_IN_USE", "Generator already in use." },
{ tenCREATEXNS, "tenCREATEXNS", "Can not specify non XNS for Create." },
{ tenEXPLICITXNS, "tenEXPLICITXNS", "XNS is used by default, don't specify it." },
{ tenDST_NEEDED, "tenDST_NEEDED", "Destination not specified." },
{ tenDST_IS_SRC, "tenDST_IS_SRC", "Destination may not be source." },
{ tenBAD_GEN_AUTH, "tenBAD_GEN_AUTH", "Not authorized to claim generator." },
{ tenBAD_ADD_AUTH, "tenBAD_ADD_AUTH", "Not authorized to add account." },
{ tenBAD_CLAIM_ID, "tenBAD_CLAIM_ID", "Malformed." },
{ tenBAD_SET_ID, "tenBAD_SET_ID", "Malformed." },
{ tenDIRECT_XNS_ONLY, "tenDIRECT_XNS_ONLY", "Direct payments are non-ripple XNS only." },
{ tenRIPPLE_EMPTY, "tenRIPPLE_EMPTY", "PathSet with no paths." },
{ tenCLAIMED, "tenCLAIMED", "Can not claim a previously claimed account." },
{ tenCREATED, "tenCREATED", "Can't add an already created account." },
{ tenMSG_SET, "tenMSG_SET", "Can't change a message key." },
{ tenBAD_AUTH_MASTER, "tenBAD_AUTH_MASTER", "Auth for unclaimed account needs correct master key." },
{ tenBAD_RIPPLE, "tenBAD_RIPPLE", "Ledger prevents ripple from succeeding." },
{ tenBAD_RIPPLE, "tenBAD_RIPPLE", "Ledger prevents ripple from succeeding." },
{ terALREADY, "terALREADY", "The exact transaction was already in this ledger" },
{ tenFAILED, "tenFAILED", "Something broke horribly" },
{ tenFAILED, "tenFAILED", "Something broke horribly" },
{ tenUNKNOWN, "tenUNKNOWN", "The transactions requires logic not implemented yet" },
{ tenINSUF_FEE_P, "tenINSUF_FEE_P", "fee totally insufficient" },
{ tenINVALID, "tenINVALID", "The transaction is ill-formed" },
{ terSUCCESS, "terSUCCESS", "The transaction was applied" },
{ tenINSUF_FEE_P, "tenINSUF_FEE_P", "fee totally insufficient" },
{ tenINVALID, "tenINVALID", "The transaction is ill-formed" },
{ terSUCCESS, "terSUCCESS", "The transaction was applied" },
{ terBAD_SEQ, "terBAD_SEQ", "This sequence number should be zero for prepaid transactions." },
{ terCREATED, "terCREATED", "Can not create a previously created account." },
{ terDIR_FULL, "terDIR_FULL", "Can not add entry to full dir." },
{ terINSUF_FEE_B, "terINSUF_FEE_B", "Account balance can't pay fee" },
{ terCREATED, "terCREATED", "Can not create a previously created account." },
{ terDIR_FULL, "terDIR_FULL", "Can not add entry to full dir." },
{ terINSUF_FEE_B, "terINSUF_FEE_B", "Account balance can't pay fee" },
{ terINSUF_FEE_T, "terINSUF_FEE_T", "fee insufficient now (account doesn't exist, network load)" },
{ terNODE_NOT_FOUND, "terNODE_NOT_FOUND", "Can not delete a dir node." },
{ terNODE_NOT_MENTIONED, "terNODE_NOT_MENTIONED", "?"},
{ terNODE_NO_ROOT, "terNODE_NO_ROOT", "?"},
{ terNO_ACCOUNT, "terNO_ACCOUNT", "The source account does not exist" },
{ terNO_DST, "terNO_DST", "The destination does not exist" },
{ terNODE_NOT_FOUND, "terNODE_NOT_FOUND", "Can not delete a dir node." },
{ terNODE_NOT_MENTIONED, "terNODE_NOT_MENTIONED", "?" },
{ terNODE_NO_ROOT, "terNODE_NO_ROOT", "?" },
{ terNO_ACCOUNT, "terNO_ACCOUNT", "The source account does not exist" },
{ terNO_DST, "terNO_DST", "The destination does not exist" },
{ terNO_PATH, "terNO_PATH", "No path existed or met transaction/balance requirements" },
{ terPAST_LEDGER, "terPAST_LEDGER", "The transaction expired and can't be applied" },
{ terPAST_SEQ, "terPAST_SEQ", "This sequence number has already past" },
{ terPRE_SEQ, "terPRE_SEQ", "Missing/inapplicable prior transaction" },
{ terPAST_LEDGER, "terPAST_LEDGER", "The transaction expired and can't be applied" },
{ terPAST_SEQ, "terPAST_SEQ", "This sequence number has already past" },
{ terPRE_SEQ, "terPRE_SEQ", "Missing/inapplicable prior transaction" },
{ terUNFUNDED, "terUNFUNDED", "Source account had insufficient balance for transaction." },
{ terNO_LINE_NO_ZERO, "terNO_LINE_NO_ZERO", "Can't zero non-existant line, destination might make it." },
{ terSET_MISSING_DST, "terSET_MISSING_DST", "Can't set password, destination missing." },
{ terSET_MISSING_DST, "terSET_MISSING_DST", "Can't set password, destination missing." },
{ terFUNDS_SPENT, "terFUNDS_SPENT", "Can't set password, password set funds already spent." },
{ terUNCLAIMED, "terUNCLAIMED", "Can not use an unclaimed account." },
{ terBAD_AUTH, "terBAD_AUTH", "Transaction's public key is not authorized." },
{ terBAD_RIPPLE, "terBAD_RIPPLE", "No ripple path can be satisfied." },
{ terUNCLAIMED, "terUNCLAIMED", "Can not use an unclaimed account." },
{ terBAD_AUTH, "terBAD_AUTH", "Transaction's public key is not authorized." },
{ terBAD_RIPPLE, "terBAD_RIPPLE", "No ripple path can be satisfied." },
};
int iIndex = NUMBER(transResultInfoA);