diff --git a/modules/ripple_data/crypto/ripple_Base58.cpp b/modules/ripple_data/crypto/ripple_Base58.cpp index 47361c74df..fc0fbb0baa 100644 --- a/modules/ripple_data/crypto/ripple_Base58.cpp +++ b/modules/ripple_data/crypto/ripple_Base58.cpp @@ -158,6 +158,8 @@ bool Base58::decode (const std::string& str, std::vector& vchRet) bool Base58::decodeWithCheck (const char* psz, std::vector& vchRet, const char* pAlphabet) { + if (pAlphabet == NULL) + pAlphabet = s_currentAlphabet; if (!decode (psz, vchRet, pAlphabet)) return false; if (vchRet.size() < 4) diff --git a/src/cpp/ripple/Ledger.cpp b/src/cpp/ripple/Ledger.cpp index 14c9430015..c2ea6aa917 100644 --- a/src/cpp/ripple/Ledger.cpp +++ b/src/cpp/ripple/Ledger.cpp @@ -190,6 +190,11 @@ void Ledger::setAccepted() setImmutable(); } +bool Ledger::hasAccount(const RippleAddress& accountID) +{ + return mAccountStateMap->hasItem(Ledger::getAccountRootIndex(accountID)); +} + AccountState::pointer Ledger::getAccountState(const RippleAddress& accountID) { #ifdef DEBUG diff --git a/src/cpp/ripple/Ledger.h b/src/cpp/ripple/Ledger.h index 3c8256a6e2..1c7e09c08a 100644 --- a/src/cpp/ripple/Ledger.h +++ b/src/cpp/ripple/Ledger.h @@ -183,6 +183,7 @@ public: TransactionMetaSet::pointer& txMeta); // high-level functions + bool hasAccount(const RippleAddress& acctID); AccountState::pointer getAccountState(const RippleAddress& acctID); LedgerStateParms writeBack(LedgerStateParms parms, SLE::ref); SLE::pointer getAccountRoot(const uint160& accountID); diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 2f3f0d9661..88d78a1f94 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1062,9 +1062,7 @@ Json::Value RPCHandler::doAccountLines(Json::Value jvRequest, int& cost, ScopedL return jvResult; } - AccountState::pointer as = mNetOps->getAccountState(lpLedger, raAccount); - - if (as) + if (lpLedger->hasAccount(raAccount)) { jvResult["account"] = raAccount.humanAccountID(); @@ -1140,9 +1138,7 @@ Json::Value RPCHandler::doAccountOffers(Json::Value jvRequest, int& cost, Scoped if (bIndex) jvResult["account_index"] = iIndex; - AccountState::pointer as = mNetOps->getAccountState(lpLedger, raAccount); - - if (as) + if (lpLedger->hasAccount(raAccount)) { Json::Value& jsonLines = (jvResult["offers"] = Json::arrayValue);