mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Remove useless NetworkOPs::getClosedLedger.
This commit is contained in:
@@ -69,7 +69,9 @@ void NetworkOPs::closeTimeOffset(int offset)
|
|||||||
|
|
||||||
uint32 NetworkOPs::getLedgerID(const uint256& hash)
|
uint32 NetworkOPs::getLedgerID(const uint256& hash)
|
||||||
{
|
{
|
||||||
return mLedgerMaster->getLedgerByHash(hash)->getLedgerSeq();
|
Ledger::ref lrLedger = mLedgerMaster->getLedgerByHash(hash);
|
||||||
|
|
||||||
|
return lrLedger ? lrLedger->getLedgerSeq() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 NetworkOPs::getCurrentLedgerID()
|
uint32 NetworkOPs::getCurrentLedgerID()
|
||||||
|
|||||||
@@ -107,11 +107,6 @@ public:
|
|||||||
uint256 getClosedLedger()
|
uint256 getClosedLedger()
|
||||||
{ return mLedgerMaster->getClosedLedger()->getHash(); }
|
{ return mLedgerMaster->getClosedLedger()->getHash(); }
|
||||||
|
|
||||||
// FIXME: This function is basically useless since the hash is constantly changing and the ledger
|
|
||||||
// is ephemeral and mutable.
|
|
||||||
uint256 getCurrentLedger()
|
|
||||||
{ return mLedgerMaster->getCurrentLedger()->getHash(); }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Transaction operations
|
// Transaction operations
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -422,7 +422,6 @@ Json::Value RPCServer::doAccountDomainSet(const Json::Value ¶ms)
|
|||||||
{
|
{
|
||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -438,7 +437,7 @@ Json::Value RPCServer::doAccountDomainSet(const Json::Value ¶ms)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -476,7 +475,6 @@ Json::Value RPCServer::doAccountEmailSet(const Json::Value ¶ms)
|
|||||||
{
|
{
|
||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -492,7 +490,7 @@ Json::Value RPCServer::doAccountEmailSet(const Json::Value ¶ms)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -569,12 +567,11 @@ Json::Value RPCServer::doAccountInfo(const Json::Value ¶ms)
|
|||||||
|
|
||||||
ret["accepted"] = jAccepted;
|
ret["accepted"] = jAccepted;
|
||||||
|
|
||||||
uint256 uCurrent = mNetOps->getCurrentLedger();
|
Json::Value jCurrent = accountFromString(uint256(0), naAccount, bIndex, strIdent, iIndex);
|
||||||
Json::Value jCurrent = accountFromString(uCurrent, naAccount, bIndex, strIdent, iIndex);
|
|
||||||
|
|
||||||
if (jCurrent.empty())
|
if (jCurrent.empty())
|
||||||
{
|
{
|
||||||
AccountState::pointer asCurrent = mNetOps->getAccountState(uCurrent, naAccount);
|
AccountState::pointer asCurrent = mNetOps->getAccountState(uint256(0), naAccount);
|
||||||
|
|
||||||
if (asCurrent)
|
if (asCurrent)
|
||||||
asCurrent->addJson(jCurrent);
|
asCurrent->addJson(jCurrent);
|
||||||
@@ -598,7 +595,6 @@ Json::Value RPCServer::doAccountInfo(const Json::Value ¶ms)
|
|||||||
Json::Value RPCServer::doAccountMessageSet(const Json::Value& params) {
|
Json::Value RPCServer::doAccountMessageSet(const Json::Value& params) {
|
||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
NewcoinAddress naMessagePubKey;
|
NewcoinAddress naMessagePubKey;
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
@@ -619,7 +615,7 @@ Json::Value RPCServer::doAccountMessageSet(const Json::Value& params) {
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
||||||
std::vector<unsigned char> vucDomain;
|
std::vector<unsigned char> vucDomain;
|
||||||
|
|
||||||
@@ -659,7 +655,6 @@ Json::Value RPCServer::doAccountPublishSet(const Json::Value ¶ms)
|
|||||||
{
|
{
|
||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -675,7 +670,7 @@ Json::Value RPCServer::doAccountPublishSet(const Json::Value ¶ms)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -717,7 +712,6 @@ Json::Value RPCServer::doAccountRateSet(const Json::Value ¶ms)
|
|||||||
{
|
{
|
||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -733,7 +727,7 @@ Json::Value RPCServer::doAccountRateSet(const Json::Value ¶ms)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naVerifyGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -773,7 +767,6 @@ Json::Value RPCServer::doAccountRateSet(const Json::Value ¶ms)
|
|||||||
Json::Value RPCServer::doAccountWalletSet(const Json::Value& params) {
|
Json::Value RPCServer::doAccountWalletSet(const Json::Value& params) {
|
||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -789,7 +782,7 @@ Json::Value RPCServer::doAccountWalletSet(const Json::Value& params) {
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
||||||
std::vector<unsigned char> vucDomain;
|
std::vector<unsigned char> vucDomain;
|
||||||
|
|
||||||
@@ -921,8 +914,6 @@ Json::Value RPCServer::doDataStore(const Json::Value& params)
|
|||||||
// Note: Nicknames are not automatically looked up by commands as they are advisory and can be changed.
|
// Note: Nicknames are not automatically looked up by commands as they are advisory and can be changed.
|
||||||
Json::Value RPCServer::doNicknameInfo(const Json::Value& params)
|
Json::Value RPCServer::doNicknameInfo(const Json::Value& params)
|
||||||
{
|
{
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
std::string strNickname = params[0u].asString();
|
std::string strNickname = params[0u].asString();
|
||||||
boost::trim(strNickname);
|
boost::trim(strNickname);
|
||||||
|
|
||||||
@@ -931,7 +922,7 @@ Json::Value RPCServer::doNicknameInfo(const Json::Value& params)
|
|||||||
return RPCError(rpcNICKNAME_MALFORMED);
|
return RPCError(rpcNICKNAME_MALFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
NicknameState::pointer nsSrc = mNetOps->getNicknameState(uLedger, strNickname);
|
NicknameState::pointer nsSrc = mNetOps->getNicknameState(uint256(0), strNickname);
|
||||||
if (!nsSrc)
|
if (!nsSrc)
|
||||||
{
|
{
|
||||||
return RPCError(rpcNICKNAME_MISSING);
|
return RPCError(rpcNICKNAME_MISSING);
|
||||||
@@ -951,7 +942,6 @@ Json::Value RPCServer::doNicknameSet(const Json::Value& params)
|
|||||||
{
|
{
|
||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -979,7 +969,7 @@ Json::Value RPCServer::doNicknameSet(const Json::Value& params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
STAmount saFee;
|
STAmount saFee;
|
||||||
NicknameState::pointer nsSrc = mNetOps->getNicknameState(uLedger, strNickname);
|
NicknameState::pointer nsSrc = mNetOps->getNicknameState(uint256(0), strNickname);
|
||||||
|
|
||||||
if (!nsSrc)
|
if (!nsSrc)
|
||||||
{
|
{
|
||||||
@@ -1002,7 +992,7 @@ Json::Value RPCServer::doNicknameSet(const Json::Value& params)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, saFee, asSrc, naMasterGenerator);
|
saSrcBalance, saFee, asSrc, naMasterGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -1068,7 +1058,7 @@ Json::Value RPCServer::doOfferCreate(const Json::Value ¶ms)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(mNetOps->getCurrentLedger(), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -1114,7 +1104,7 @@ Json::Value RPCServer::doOfferCancel(const Json::Value ¶ms)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(mNetOps->getCurrentLedger(), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -1154,10 +1144,9 @@ Json::Value RPCServer::doOwnerInfo(const Json::Value& params)
|
|||||||
|
|
||||||
ret["accepted"] = jAccepted.empty() ? mNetOps->getOwnerInfo(uAccepted, naAccount) : jAccepted;
|
ret["accepted"] = jAccepted.empty() ? mNetOps->getOwnerInfo(uAccepted, naAccount) : jAccepted;
|
||||||
|
|
||||||
uint256 uCurrent = mNetOps->getCurrentLedger();
|
Json::Value jCurrent = accountFromString(uint256(0), naAccount, bIndex, strIdent, iIndex);
|
||||||
Json::Value jCurrent = accountFromString(uCurrent, naAccount, bIndex, strIdent, iIndex);
|
|
||||||
|
|
||||||
ret["current"] = jCurrent.empty() ? mNetOps->getOwnerInfo(uCurrent, naAccount) : jCurrent;
|
ret["current"] = jCurrent.empty() ? mNetOps->getOwnerInfo(uint256(0), naAccount) : jCurrent;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -1168,7 +1157,6 @@ Json::Value RPCServer::doPasswordFund(const Json::Value ¶ms)
|
|||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naDstAccountID;
|
NewcoinAddress naDstAccountID;
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -1188,7 +1176,7 @@ Json::Value RPCServer::doPasswordFund(const Json::Value ¶ms)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -1494,8 +1482,7 @@ Json::Value RPCServer::doRipple(const Json::Value ¶ms)
|
|||||||
return RPCError(rpcDST_AMT_MALFORMED);
|
return RPCError(rpcDST_AMT_MALFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
AccountState::pointer asDst = mNetOps->getAccountState(uint256(0), naDstAccountID);
|
||||||
AccountState::pointer asDst = mNetOps->getAccountState(uLedger, naDstAccountID);
|
|
||||||
STAmount saFee = theConfig.FEE_DEFAULT;
|
STAmount saFee = theConfig.FEE_DEFAULT;
|
||||||
|
|
||||||
NewcoinAddress naVerifyGenerator;
|
NewcoinAddress naVerifyGenerator;
|
||||||
@@ -1503,7 +1490,7 @@ Json::Value RPCServer::doRipple(const Json::Value ¶ms)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, saFee, asSrc, naVerifyGenerator);
|
saSrcBalance, saFee, asSrc, naVerifyGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -1556,7 +1543,6 @@ Json::Value RPCServer::doRippleLineSet(const Json::Value& params)
|
|||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naDstAccountID;
|
NewcoinAddress naDstAccountID;
|
||||||
STAmount saLimitAmount;
|
STAmount saLimitAmount;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
bool bLimitAmount = true;
|
bool bLimitAmount = true;
|
||||||
bool bQualityIn = params.size() >= 6;
|
bool bQualityIn = params.size() >= 6;
|
||||||
bool bQualityOut = params.size() >= 7;
|
bool bQualityOut = params.size() >= 7;
|
||||||
@@ -1594,7 +1580,7 @@ Json::Value RPCServer::doRippleLineSet(const Json::Value& params)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
saSrcBalance, theConfig.FEE_DEFAULT, asSrc, naMasterGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -1627,7 +1613,6 @@ Json::Value RPCServer::doRippleLineSet(const Json::Value& params)
|
|||||||
Json::Value RPCServer::doRippleLinesGet(const Json::Value ¶ms)
|
Json::Value RPCServer::doRippleLinesGet(const Json::Value ¶ms)
|
||||||
{
|
{
|
||||||
// uint256 uAccepted = mNetOps->getClosedLedger();
|
// uint256 uAccepted = mNetOps->getClosedLedger();
|
||||||
uint256 uCurrent = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
std::string strIdent = params[0u].asString();
|
std::string strIdent = params[0u].asString();
|
||||||
bool bIndex;
|
bool bIndex;
|
||||||
@@ -1637,7 +1622,7 @@ Json::Value RPCServer::doRippleLinesGet(const Json::Value ¶ms)
|
|||||||
|
|
||||||
Json::Value ret;
|
Json::Value ret;
|
||||||
|
|
||||||
ret = accountFromString(uCurrent, naAccount, bIndex, strIdent, iIndex);
|
ret = accountFromString(uint256(0), naAccount, bIndex, strIdent, iIndex);
|
||||||
|
|
||||||
if (!ret.empty())
|
if (!ret.empty())
|
||||||
return ret;
|
return ret;
|
||||||
@@ -1649,7 +1634,7 @@ Json::Value RPCServer::doRippleLinesGet(const Json::Value ¶ms)
|
|||||||
if (bIndex)
|
if (bIndex)
|
||||||
ret["index"] = iIndex;
|
ret["index"] = iIndex;
|
||||||
|
|
||||||
AccountState::pointer as = mNetOps->getAccountState(uCurrent, naAccount);
|
AccountState::pointer as = mNetOps->getAccountState(uint256(0), naAccount);
|
||||||
if (as)
|
if (as)
|
||||||
{
|
{
|
||||||
Json::Value jsonLines(Json::arrayValue);
|
Json::Value jsonLines(Json::arrayValue);
|
||||||
@@ -1739,8 +1724,7 @@ Json::Value RPCServer::doSend(const Json::Value& params)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
AccountState::pointer asDst = mNetOps->getAccountState(uint256(0), naDstAccountID);
|
||||||
AccountState::pointer asDst = mNetOps->getAccountState(uLedger, naDstAccountID);
|
|
||||||
bool bCreate = !asDst;
|
bool bCreate = !asDst;
|
||||||
STAmount saFee = bCreate ? theConfig.FEE_ACCOUNT_CREATE : theConfig.FEE_DEFAULT;
|
STAmount saFee = bCreate ? theConfig.FEE_ACCOUNT_CREATE : theConfig.FEE_DEFAULT;
|
||||||
|
|
||||||
@@ -1749,7 +1733,7 @@ Json::Value RPCServer::doSend(const Json::Value& params)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, saFee, asSrc, naVerifyGenerator);
|
saSrcBalance, saFee, asSrc, naVerifyGenerator);
|
||||||
|
|
||||||
// Log(lsINFO) << boost::str(boost::format("doSend: sSrcIssuer=%s sDstIssuer=%s saSrcAmountMax=%s saDstAmount=%s")
|
// Log(lsINFO) << boost::str(boost::format("doSend: sSrcIssuer=%s sDstIssuer=%s saSrcAmountMax=%s saDstAmount=%s")
|
||||||
@@ -2081,7 +2065,6 @@ Json::Value RPCServer::accounts(const uint256& uLedger, const NewcoinAddress& na
|
|||||||
Json::Value RPCServer::doWalletAccounts(const Json::Value& params)
|
Json::Value RPCServer::doWalletAccounts(const Json::Value& params)
|
||||||
{
|
{
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -2091,17 +2074,17 @@ Json::Value RPCServer::doWalletAccounts(const Json::Value& params)
|
|||||||
// Try the seed as a master seed.
|
// Try the seed as a master seed.
|
||||||
NewcoinAddress naMasterGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
NewcoinAddress naMasterGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
||||||
|
|
||||||
Json::Value jsonAccounts = accounts(uLedger, naMasterGenerator);
|
Json::Value jsonAccounts = accounts(uint256(0), naMasterGenerator);
|
||||||
|
|
||||||
if (jsonAccounts.empty())
|
if (jsonAccounts.empty())
|
||||||
{
|
{
|
||||||
// No account via seed as master, try seed a regular.
|
// No account via seed as master, try seed a regular.
|
||||||
Json::Value ret = getMasterGenerator(uLedger, naSeed, naMasterGenerator);
|
Json::Value ret = getMasterGenerator(uint256(0), naSeed, naMasterGenerator);
|
||||||
|
|
||||||
if (!ret.empty())
|
if (!ret.empty())
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret["accounts"] = accounts(uLedger, naMasterGenerator);
|
ret["accounts"] = accounts(uint256(0), naMasterGenerator);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -2124,7 +2107,6 @@ Json::Value RPCServer::doWalletAdd(const Json::Value& params)
|
|||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
STAmount saAmount;
|
STAmount saAmount;
|
||||||
std::string sDstCurrency;
|
std::string sDstCurrency;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naRegularSeed.setSeedGeneric(params[0u].asString()))
|
if (!naRegularSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -2151,7 +2133,7 @@ Json::Value RPCServer::doWalletAdd(const Json::Value& params)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naRegularSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naRegularSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_ACCOUNT_CREATE, asSrc, naMasterGenerator);
|
saSrcBalance, theConfig.FEE_ACCOUNT_CREATE, asSrc, naMasterGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -2177,7 +2159,7 @@ Json::Value RPCServer::doWalletAdd(const Json::Value& params)
|
|||||||
++iIndex;
|
++iIndex;
|
||||||
naNewAccountPublic.setAccountPublic(naMasterGenerator, iIndex);
|
naNewAccountPublic.setAccountPublic(naMasterGenerator, iIndex);
|
||||||
|
|
||||||
asNew = mNetOps->getAccountState(uLedger, naNewAccountPublic);
|
asNew = mNetOps->getAccountState(uint256(0), naNewAccountPublic);
|
||||||
if (!asNew)
|
if (!asNew)
|
||||||
bAgain = false;
|
bAgain = false;
|
||||||
} while (bAgain);
|
} while (bAgain);
|
||||||
@@ -2312,7 +2294,6 @@ Json::Value RPCServer::doWalletCreate(const Json::Value& params)
|
|||||||
NewcoinAddress naSrcAccountID;
|
NewcoinAddress naSrcAccountID;
|
||||||
NewcoinAddress naDstAccountID;
|
NewcoinAddress naDstAccountID;
|
||||||
NewcoinAddress naSeed;
|
NewcoinAddress naSeed;
|
||||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
|
||||||
|
|
||||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||||
{
|
{
|
||||||
@@ -2326,7 +2307,7 @@ Json::Value RPCServer::doWalletCreate(const Json::Value& params)
|
|||||||
{
|
{
|
||||||
return RPCError(rpcDST_ACT_MALFORMED);
|
return RPCError(rpcDST_ACT_MALFORMED);
|
||||||
}
|
}
|
||||||
else if (mNetOps->getAccountState(uLedger, naDstAccountID))
|
else if (mNetOps->getAccountState(uint256(0), naDstAccountID))
|
||||||
{
|
{
|
||||||
return RPCError(rpcACT_EXISTS);
|
return RPCError(rpcACT_EXISTS);
|
||||||
}
|
}
|
||||||
@@ -2339,7 +2320,7 @@ Json::Value RPCServer::doWalletCreate(const Json::Value& params)
|
|||||||
NewcoinAddress naAccountPrivate;
|
NewcoinAddress naAccountPrivate;
|
||||||
AccountState::pointer asSrc;
|
AccountState::pointer asSrc;
|
||||||
STAmount saSrcBalance;
|
STAmount saSrcBalance;
|
||||||
Json::Value obj = authorize(uLedger, naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||||
saSrcBalance, theConfig.FEE_ACCOUNT_CREATE, asSrc, naMasterGenerator);
|
saSrcBalance, theConfig.FEE_ACCOUNT_CREATE, asSrc, naMasterGenerator);
|
||||||
|
|
||||||
if (!obj.empty())
|
if (!obj.empty())
|
||||||
@@ -2602,7 +2583,8 @@ Json::Value RPCServer::doCommand(const std::string& command, Json::Value& params
|
|||||||
{
|
{
|
||||||
return RPCError(rpcNO_NETWORK);
|
return RPCError(rpcNO_NETWORK);
|
||||||
}
|
}
|
||||||
else if ((commandsA[i].iOptions & optCurrent) && mNetOps->getCurrentLedger().isZero())
|
// XXX Should verify we have a current ledger.
|
||||||
|
else if ((commandsA[i].iOptions & optCurrent) && false)
|
||||||
{
|
{
|
||||||
return RPCError(rpcNO_CURRENT);
|
return RPCError(rpcNO_CURRENT);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user