mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin into continuousClose
This commit is contained in:
@@ -191,6 +191,7 @@ STVector256 NetworkOPs::getDirNodeInfo(
|
||||
|
||||
uNodePrevious = sleNode->getIFieldU64(sfIndexPrevious);
|
||||
uNodeNext = sleNode->getIFieldU64(sfIndexNext);
|
||||
svIndexes = sleNode->getIFieldV256(sfIndexes);
|
||||
|
||||
Log(lsTRACE) << "getDirNodeInfo: first: " << strHex(uNodePrevious);
|
||||
Log(lsTRACE) << "getDirNodeInfo: last: " << strHex(uNodeNext);
|
||||
@@ -198,6 +199,9 @@ STVector256 NetworkOPs::getDirNodeInfo(
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "getDirNodeInfo: node index: NOT FOUND: " << uNodeIndex.ToString();
|
||||
|
||||
uNodePrevious = 0;
|
||||
uNodeNext = 0;
|
||||
}
|
||||
|
||||
return svIndexes;
|
||||
|
||||
@@ -264,6 +264,7 @@ Json::Value RPCServer::getMasterGenerator(const uint256& uLedger, const NewcoinA
|
||||
// <-- naAccountPrivate : Regular private key for naSrcAccountID
|
||||
// <-- saSrcBalance: Balance minus fee.
|
||||
// --> naVerifyGenerator : If provided, the found master public generator must match.
|
||||
// XXX Be more lenient, allow use of master generator on claimed accounts.
|
||||
Json::Value RPCServer::authorize(const uint256& uLedger,
|
||||
const NewcoinAddress& naRegularSeed, const NewcoinAddress& naSrcAccountID,
|
||||
NewcoinAddress& naAccountPublic, NewcoinAddress& naAccountPrivate,
|
||||
@@ -303,7 +304,6 @@ Json::Value RPCServer::authorize(const uint256& uLedger,
|
||||
unsigned int iIndex = 0;
|
||||
bool bFound = false;
|
||||
|
||||
// XXX Stop after Config.account_probe_max
|
||||
// Don't look at ledger entries to determine if the account exists. Don't want to leak to thin server that these accounts are
|
||||
// related.
|
||||
while (!bFound && iIndex != theConfig.ACCOUNT_PROBE_MAX)
|
||||
@@ -1082,15 +1082,17 @@ Json::Value RPCServer::doRippleLinesGet(const Json::Value ¶ms)
|
||||
AccountState::pointer as = mNetOps->getAccountState(uCurrent, naAccount);
|
||||
if (as)
|
||||
{
|
||||
Json::Value jsonLines = Json::Value(Json::objectValue);
|
||||
Json::Value jsonLines(Json::arrayValue);
|
||||
|
||||
ret["account"] = naAccount.humanAccountID();
|
||||
|
||||
// XXX This is wrong, we do access the current ledger and do need to worry about changes.
|
||||
// We access a committed ledger and need not worry about changes.
|
||||
uint256 uRootIndex;
|
||||
|
||||
if (mNetOps->getDirLineInfo(uCurrent, naAccount, uRootIndex))
|
||||
{
|
||||
Log(lsINFO) << "doRippleLinesGet: dir root index: " << uRootIndex.ToString();
|
||||
bool bDone = false;
|
||||
|
||||
while (!bDone)
|
||||
@@ -1099,12 +1101,13 @@ Json::Value RPCServer::doRippleLinesGet(const Json::Value ¶ms)
|
||||
uint64 uNodeNext;
|
||||
STVector256 svRippleNodes = mNetOps->getDirNodeInfo(uCurrent, uRootIndex, uNodePrevious, uNodeNext);
|
||||
|
||||
Log(lsINFO) << "doRippleLinesGet: previous: " << strHex(uNodePrevious);
|
||||
Log(lsINFO) << "doRippleLinesGet: next: " << strHex(uNodeNext);
|
||||
Log(lsINFO) << "doRippleLinesGet: lines: " << svRippleNodes.peekValue().size();
|
||||
|
||||
BOOST_FOREACH(uint256& uNode, svRippleNodes.peekValue())
|
||||
{
|
||||
NewcoinAddress naAccountPeer;
|
||||
STAmount saBalance;
|
||||
STAmount saLimit;
|
||||
STAmount saLimitPeer;
|
||||
Log(lsINFO) << "doRippleLinesGet: line index: " << uNode.ToString();
|
||||
|
||||
RippleState::pointer rsLine = mNetOps->getRippleState(uCurrent, uNode);
|
||||
|
||||
@@ -1112,25 +1115,25 @@ Json::Value RPCServer::doRippleLinesGet(const Json::Value ¶ms)
|
||||
{
|
||||
rsLine->setViewAccount(naAccount);
|
||||
|
||||
naAccountPeer = rsLine->getAccountIDPeer();
|
||||
saBalance = rsLine->getBalance();
|
||||
saLimit = rsLine->getLimit();
|
||||
saLimitPeer = rsLine->getLimitPeer();
|
||||
STAmount saBalance = rsLine->getBalance();
|
||||
STAmount saLimit = rsLine->getLimit();
|
||||
STAmount saLimitPeer = rsLine->getLimitPeer();
|
||||
|
||||
Json::Value jPeer = Json::Value(Json::objectValue);
|
||||
Json::Value jPeer = Json::Value(Json::objectValue);
|
||||
|
||||
jPeer["node"] = uNode.ToString();
|
||||
|
||||
jPeer["account"] = rsLine->getAccountIDPeer().humanAccountID();
|
||||
jPeer["balance"] = saBalance.getText();
|
||||
jPeer["currency"] = saBalance.getCurrencyHuman();
|
||||
jPeer["limit"] = saLimit.getJson(0);
|
||||
jPeer["limit_peer"] = saLimitPeer.getJson(0);
|
||||
|
||||
jsonLines[naAccountPeer.humanAccountID()] = jPeer;
|
||||
jsonLines.append(jPeer);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "doAccountLines: Bad index: " << uNode.ToString() << std::endl;
|
||||
Log(lsWARNING) << "doRippleLinesGet: Bad index: " << uNode.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1144,11 +1147,15 @@ Json::Value RPCServer::doRippleLinesGet(const Json::Value ¶ms)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lsINFO) << "doRippleLinesGet: no directory: " << uRootIndex.ToString();
|
||||
}
|
||||
ret["lines"] = jsonLines;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret["status"] = "NotFound";
|
||||
ret = RPCError(rpcACT_NOT_FOUND);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1234,6 +1241,7 @@ Json::Value RPCServer::doSend(const Json::Value& params)
|
||||
|
||||
return RPCError(rpcINSUF_FUNDS);
|
||||
}
|
||||
// XXX Don't allow send to self of same currency.
|
||||
|
||||
Transaction::pointer trans;
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ STVector256* STVector256::construct(SerializerIterator& u, const char *name)
|
||||
{
|
||||
unsigned int uEnd = uStart+(256/8);
|
||||
|
||||
value.push_back(uint256(std::vector<unsigned char>(&data[uStart], &data[uEnd])));
|
||||
value.push_back(uint256(std::vector<unsigned char>(data.begin()+uStart, data.begin()+(uStart+32))));
|
||||
|
||||
uStart = uEnd;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ bool transResultInfo(TransactionEngineResult terCode, std::string& strToken, std
|
||||
} transResultInfoA[] = {
|
||||
{ tenBAD_ADD_AUTH, "tenBAD_ADD_AUTH", "Not authorized to add account." },
|
||||
{ tenBAD_AMOUNT, "tenBAD_AMOUNT", "Can only send positive amounts." },
|
||||
{ tenBAD_AUTH_MASTER, "tenBAD_AUTH_MASTER", "Auth for unclaimed account needs correct master key." },
|
||||
{ tenBAD_CLAIM_ID, "tenBAD_CLAIM_ID", "Malformed." },
|
||||
{ tenBAD_EXPIRATION, "tenBAD_EXPIRATION", "Malformed." },
|
||||
{ tenBAD_GEN_AUTH, "tenBAD_GEN_AUTH", "Not authorized to claim generator." },
|
||||
@@ -51,6 +50,7 @@ bool transResultInfo(TransactionEngineResult terCode, std::string& strToken, std
|
||||
{ tenUNKNOWN, "tenUNKNOWN", "The transactions requires logic not implemented yet" },
|
||||
{ terALREADY, "terALREADY", "The exact transaction was already in this ledger" },
|
||||
{ terBAD_AUTH, "terBAD_AUTH", "Transaction's public key is not authorized." },
|
||||
{ terBAD_AUTH_MASTER, "terBAD_AUTH_MASTER", "Auth for unclaimed account needs correct master key." },
|
||||
{ terBAD_LEDGER, "terBAD_LEDGER", "Ledger in unexpected state." },
|
||||
{ terBAD_RIPPLE, "terBAD_RIPPLE", "No ripple path can be satisfied." },
|
||||
{ terBAD_SEQ, "terBAD_SEQ", "This sequence number should be zero for prepaid transactions." },
|
||||
@@ -124,10 +124,10 @@ TransactionEngineResult TransactionEngine::dirAdd(
|
||||
}
|
||||
else
|
||||
{
|
||||
uNodeDir = sleRoot->getIFieldU64(sfIndexPrevious);
|
||||
uNodeDir = sleRoot->getIFieldU64(sfIndexPrevious); // Get index to last directory node.
|
||||
|
||||
uint64 uNodePrevious = uNodeDir;
|
||||
uint256 uNodeIndex;
|
||||
uint256 uNodeIndex; // Index of node.
|
||||
|
||||
if (uNodeDir)
|
||||
{
|
||||
@@ -135,11 +135,14 @@ TransactionEngineResult TransactionEngine::dirAdd(
|
||||
uNodeIndex = Ledger::getDirNodeIndex(uRootIndex, uNodeDir);
|
||||
lspRoot = lepNONE;
|
||||
sleNode = mLedger->getDirNode(lspRoot, uNodeIndex);
|
||||
|
||||
assert(sleNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try adding to root.
|
||||
uNodeIndex = uRootIndex;
|
||||
uNodeIndex = uRootIndex;
|
||||
sleNode = sleRoot;
|
||||
}
|
||||
|
||||
svIndexes = sleNode->getIFieldV256(sfIndexes);
|
||||
@@ -695,7 +698,7 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
|
||||
{
|
||||
std::cerr << "applyTransaction: Invalid: Not authorized to use account." << std::endl;
|
||||
|
||||
result = tenBAD_AUTH_MASTER;
|
||||
result = terBAD_AUTH_MASTER;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ enum TransactionEngineResult
|
||||
|
||||
// Invalid: Ledger won't allow.
|
||||
tenCLAIMED = -200,
|
||||
tenBAD_AUTH_MASTER,
|
||||
tenBAD_RIPPLE,
|
||||
tenCREATED,
|
||||
tenEXPIRED,
|
||||
@@ -52,6 +51,7 @@ enum TransactionEngineResult
|
||||
// Conflict with ledger database: Fee claimed
|
||||
// Might succeed if not conflict is not caused by transaction ordering.
|
||||
terBAD_AUTH,
|
||||
terBAD_AUTH_MASTER,
|
||||
terBAD_LEDGER,
|
||||
terBAD_RIPPLE,
|
||||
terBAD_SEQ,
|
||||
|
||||
Reference in New Issue
Block a user