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
This commit is contained in:
@@ -321,7 +321,7 @@ Json::Value RPCServer::accountFromString(const uint256& uLedger, NewcoinAddress&
|
||||
naRegular0Public.setAccountPublic(naGenerator, 0);
|
||||
naRegular0Private.setAccountPrivate(naGenerator, naSeed, 0);
|
||||
|
||||
uint160 uGeneratorID = naRegular0Public.getAccountID();
|
||||
// uint160 uGeneratorID = naRegular0Public.getAccountID();
|
||||
SLE::pointer sleGen = mNetOps->getGenerator(uLedger, naRegular0Public.getAccountID());
|
||||
if (!sleGen)
|
||||
{
|
||||
@@ -1147,7 +1147,7 @@ Json::Value RPCServer::doPasswordSet(Json::Value& params)
|
||||
naRegular0Private.setAccountPrivate(naRegularGenerator, naRegularSeed, 0);
|
||||
|
||||
// Hash of regular account #0 public key.
|
||||
uint160 uGeneratorID = naRegular0Public.getAccountID();
|
||||
// uint160 uGeneratorID = naRegular0Public.getAccountID();
|
||||
std::vector<unsigned char> vucGeneratorCipher = naRegular0Private.accountPrivateEncrypt(naRegular0Public, naMasterGenerator.getFamilyGenerator());
|
||||
std::vector<unsigned char> vucGeneratorSig;
|
||||
|
||||
@@ -1453,7 +1453,7 @@ Json::Value RPCServer::doLedger(Json::Value& params)
|
||||
{
|
||||
return "invalid params";
|
||||
}
|
||||
else if (!mNetOps->available())
|
||||
if (!mNetOps->available())
|
||||
{
|
||||
return JSONRPCError(503, "network not available");
|
||||
}
|
||||
@@ -1499,6 +1499,84 @@ Json::Value RPCServer::doLedger(Json::Value& params)
|
||||
return ret;
|
||||
}
|
||||
|
||||
// account_tx <account> <minledger> <maxledger>
|
||||
// account_tx <account> <ledger>
|
||||
Json::Value RPCServer::doAccountTransactions(Json::Value& params)
|
||||
{
|
||||
std::string param;
|
||||
uint32 minLedger, maxLedger;
|
||||
|
||||
if ((params.size() < 2) || (params.size() > 3) || !extractString(param, params, 0))
|
||||
return "invalid params";
|
||||
|
||||
if (!mNetOps->available())
|
||||
{
|
||||
return JSONRPCError(503, "network not available");
|
||||
}
|
||||
|
||||
NewcoinAddress account;
|
||||
if (!account.setAccountID(param))
|
||||
return JSONRPCError(500, "invalid account");
|
||||
|
||||
if (!extractString(param, params, 1))
|
||||
return JSONRPCError(500, "invalid ledger index");
|
||||
minLedger = boost::lexical_cast<uint32>(param);
|
||||
|
||||
if ((params.size() == 3) && extractString(param, params, 2))
|
||||
maxLedger = boost::lexical_cast<uint32>(param);
|
||||
else
|
||||
maxLedger = minLedger;
|
||||
|
||||
if ((maxLedger < minLedger) || (minLedger == 0) || (maxLedger == 0))
|
||||
{
|
||||
std::cerr << "minL=" << minLedger << ", maxL=" << maxLedger << std::endl;
|
||||
return JSONRPCError(500, "invalid ledger indexes");
|
||||
}
|
||||
|
||||
#ifndef DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
std::vector< std::pair<uint32, uint256> > txns = mNetOps->getAffectedAccounts(account, minLedger, maxLedger);
|
||||
Json::Value ret(Json::objectValue);
|
||||
ret["Account"] = account.humanAccountID();
|
||||
Json::Value ledgers(Json::arrayValue);
|
||||
|
||||
uint32 currentLedger = 0;
|
||||
Json::Value ledger, jtxns;
|
||||
for (std::vector< std::pair<uint32, uint256> >::iterator it = txns.begin(), end = txns.end(); it != end; ++it)
|
||||
{
|
||||
if (it->first != currentLedger) // different/new ledger
|
||||
{
|
||||
if (currentLedger != 0) // add old ledger
|
||||
{
|
||||
ledger["Transactions"] = jtxns;
|
||||
ledgers.append(ledger);
|
||||
ledger = Json::objectValue;
|
||||
}
|
||||
currentLedger = it->first;
|
||||
ledger["LedgerSeq"] = currentLedger;
|
||||
jtxns = Json::arrayValue;
|
||||
}
|
||||
jtxns.append(it->second.GetHex());
|
||||
}
|
||||
if (currentLedger != 0)
|
||||
{
|
||||
ledger["Transactions"] = jtxns;
|
||||
ledgers.append(ledger);
|
||||
}
|
||||
|
||||
ret["Ledgers"] = ledgers;
|
||||
return ret;
|
||||
#ifndef DEBUG
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return JSONRPCError(500, "internal error");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// unl_add <domain>|<node_public> [<comment>]
|
||||
Json::Value RPCServer::doUnlAdd(Json::Value& params)
|
||||
{
|
||||
@@ -2178,13 +2256,13 @@ Json::Value RPCServer::doCommand(const std::string& command, Json::Value& params
|
||||
if (command == "wallet_propose") return doWalletPropose(params);
|
||||
if (command == "wallet_seed") return doWalletSeed(params);
|
||||
|
||||
if (command=="ledger") return doLedger(params);
|
||||
|
||||
if (command == "ledger") return doLedger(params);
|
||||
if (command == "account_tx") return doAccountTransactions(params);
|
||||
//
|
||||
// Obsolete or need rewrite:
|
||||
//
|
||||
|
||||
if (command=="tx") return doTx(params);
|
||||
if (command == "tx") return doTx(params);
|
||||
|
||||
return "unknown command";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user