mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 22:15:52 +00:00
Merge branch 'develop' into feature
This commit is contained in:
@@ -243,6 +243,9 @@ void Application::setup()
|
|||||||
mValidations.tune(theConfig.getSize(siValidationsSize), theConfig.getSize(siValidationsAge));
|
mValidations.tune(theConfig.getSize(siValidationsSize), theConfig.getSize(siValidationsAge));
|
||||||
mHashedObjectStore.tune(theConfig.getSize(siNodeCacheSize), theConfig.getSize(siNodeCacheAge));
|
mHashedObjectStore.tune(theConfig.getSize(siNodeCacheSize), theConfig.getSize(siNodeCacheAge));
|
||||||
mLedgerMaster.tune(theConfig.getSize(siLedgerSize), theConfig.getSize(siLedgerAge));
|
mLedgerMaster.tune(theConfig.getSize(siLedgerSize), theConfig.getSize(siLedgerAge));
|
||||||
|
mSLECache.setTargetSize(theConfig.getSize(siSLECacheSize));
|
||||||
|
mSLECache.setTargetAge(theConfig.getSize(siSLECacheAge));
|
||||||
|
|
||||||
mLedgerMaster.setMinValidations(theConfig.VALIDATION_QUORUM);
|
mLedgerMaster.setMinValidations(theConfig.VALIDATION_QUORUM);
|
||||||
|
|
||||||
#ifdef USE_LEVELDB
|
#ifdef USE_LEVELDB
|
||||||
|
|||||||
@@ -510,14 +510,23 @@ void Config::load()
|
|||||||
int Config::getSize(SizedItemName item)
|
int Config::getSize(SizedItemName item)
|
||||||
{
|
{
|
||||||
SizedItem sizeTable[] = { // tiny small medium large huge
|
SizedItem sizeTable[] = { // tiny small medium large huge
|
||||||
|
|
||||||
{ siSweepInterval, { 10, 30, 60, 90, 120 } },
|
{ siSweepInterval, { 10, 30, 60, 90, 120 } },
|
||||||
|
|
||||||
{ siLedgerFetch, { 2, 2, 3, 3, 3 } },
|
{ siLedgerFetch, { 2, 2, 3, 3, 3 } },
|
||||||
|
|
||||||
{ siValidationsSize, { 256, 256, 512, 1024, 1024 } },
|
{ siValidationsSize, { 256, 256, 512, 1024, 1024 } },
|
||||||
{ siValidationsAge, { 500, 500, 500, 500, 500 } },
|
{ siValidationsAge, { 500, 500, 500, 500, 500 } },
|
||||||
|
|
||||||
{ siNodeCacheSize, { 8192, 65536, 262144, 2097152, 0 } },
|
{ siNodeCacheSize, { 8192, 65536, 262144, 2097152, 0 } },
|
||||||
{ siNodeCacheAge, { 30, 60, 90, 300, 900 } },
|
{ siNodeCacheAge, { 30, 60, 90, 300, 900 } },
|
||||||
|
|
||||||
|
{ siSLECacheSize, { 4096, 8192, 16384, 65536, 0 } },
|
||||||
|
{ siSLECacheAge, { 30, 60, 90, 120, 300 } },
|
||||||
|
|
||||||
{ siLedgerSize, { 32, 128, 256, 2048, 0 } },
|
{ siLedgerSize, { 32, 128, 256, 2048, 0 } },
|
||||||
{ siLedgerAge, { 30, 90, 180, 300, 900 } },
|
{ siLedgerAge, { 30, 90, 180, 300, 900 } },
|
||||||
|
|
||||||
{ siHashNodeDBCache, { 4, 12, 24, 32, 64 } },
|
{ siHashNodeDBCache, { 4, 12, 24, 32, 64 } },
|
||||||
{ siTxnDBCache, { 4, 12, 24, 32, 32 } },
|
{ siTxnDBCache, { 4, 12, 24, 32, 32 } },
|
||||||
{ siLgrDBCache, { 4, 8, 16, 16, 16 } },
|
{ siLgrDBCache, { 4, 8, 16, 16, 16 } },
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ enum SizedItemName
|
|||||||
siValidationsAge,
|
siValidationsAge,
|
||||||
siNodeCacheSize,
|
siNodeCacheSize,
|
||||||
siNodeCacheAge,
|
siNodeCacheAge,
|
||||||
|
siSLECacheSize,
|
||||||
|
siSLECacheAge,
|
||||||
siLedgerSize,
|
siLedgerSize,
|
||||||
siLedgerAge,
|
siLedgerAge,
|
||||||
siLedgerFetch,
|
siLedgerFetch,
|
||||||
|
|||||||
@@ -1020,6 +1020,31 @@ SLE::pointer Ledger::getSLEi(const uint256& uId)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ledger::visitAccountItems(const uint160& accountID, FUNCTION_TYPE<void(SLE::ref)> func)
|
||||||
|
{ // Visit each item in this account's owner directory
|
||||||
|
uint256 rootIndex = Ledger::getOwnerDirIndex(accountID);
|
||||||
|
uint256 currentIndex = rootIndex;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
SLE::pointer ownerDir = getSLEi(currentIndex);
|
||||||
|
if (!ownerDir || (ownerDir->getType() != ltDIR_NODE))
|
||||||
|
return;
|
||||||
|
|
||||||
|
BOOST_FOREACH(const uint256& uNode, ownerDir->getFieldV256(sfIndexes).peekValue())
|
||||||
|
{
|
||||||
|
func(getSLEi(uNode));
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64 uNodeNext = ownerDir->getFieldU64(sfIndexNext);
|
||||||
|
if (!uNodeNext)
|
||||||
|
return;
|
||||||
|
|
||||||
|
currentIndex = Ledger::getDirNodeIndex(rootIndex, uNodeNext);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
uint256 Ledger::getFirstLedgerIndex()
|
uint256 Ledger::getFirstLedgerIndex()
|
||||||
{
|
{
|
||||||
SHAMapItem::pointer node = mAccountStateMap->peekFirstItem();
|
SHAMapItem::pointer node = mAccountStateMap->peekFirstItem();
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ public:
|
|||||||
SLE::pointer getAccountRoot(const uint160& accountID);
|
SLE::pointer getAccountRoot(const uint160& accountID);
|
||||||
SLE::pointer getAccountRoot(const RippleAddress& naAccountID);
|
SLE::pointer getAccountRoot(const RippleAddress& naAccountID);
|
||||||
void updateSkipList();
|
void updateSkipList();
|
||||||
|
void visitAccountItems(const uint160& acctID, FUNCTION_TYPE<void(SLE::ref)>);
|
||||||
|
|
||||||
// database functions (low-level)
|
// database functions (low-level)
|
||||||
static Ledger::pointer loadByIndex(uint32 ledgerIndex);
|
static Ledger::pointer loadByIndex(uint32 ledgerIndex);
|
||||||
|
|||||||
@@ -1101,6 +1101,17 @@ Json::Value RPCHandler::doAccountLines(Json::Value jvRequest, int& cost, ScopedL
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void offerAdder(Json::Value& jvLines, SLE::ref offer)
|
||||||
|
{
|
||||||
|
if (offer->getType() == ltOFFER)
|
||||||
|
{
|
||||||
|
Json::Value& obj = jvLines.append(Json::objectValue);
|
||||||
|
offer->getFieldAmount(sfTakerPays).setJson(obj["taker_pays"]);
|
||||||
|
offer->getFieldAmount(sfTakerGets).setJson(obj["taker_gets"]);
|
||||||
|
obj["seq"] = offer->getFieldU32(sfSequence);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// account: <account>|<nickname>|<account_public_key>
|
// account: <account>|<nickname>|<account_public_key>
|
||||||
// account_index: <number> // optional, defaults to 0.
|
// account_index: <number> // optional, defaults to 0.
|
||||||
@@ -1139,26 +1150,10 @@ Json::Value RPCHandler::doAccountOffers(Json::Value jvRequest, int& cost, Scoped
|
|||||||
jvResult["account_index"] = iIndex;
|
jvResult["account_index"] = iIndex;
|
||||||
|
|
||||||
if (lpLedger->hasAccount(raAccount))
|
if (lpLedger->hasAccount(raAccount))
|
||||||
{
|
lpLedger->visitAccountItems(raAccount.getAccountID(),
|
||||||
Json::Value& jsonLines = (jvResult["offers"] = Json::arrayValue);
|
BIND_TYPE(&offerAdder, boost::ref(jvResult["offers"] = Json::arrayValue), P_1));
|
||||||
|
|
||||||
AccountItems offers(raAccount.getAccountID(), lpLedger, AccountItem::pointer(new Offer()));
|
|
||||||
BOOST_FOREACH(AccountItem::ref item, offers.getItems())
|
|
||||||
{
|
|
||||||
Offer* offer=(Offer*)item.get();
|
|
||||||
|
|
||||||
Json::Value& obj = jsonLines.append(Json::objectValue);
|
|
||||||
|
|
||||||
offer->getTakerPays().setJson(obj["taker_pays"]);
|
|
||||||
offer->getTakerGets().setJson(obj["taker_gets"]);
|
|
||||||
obj["seq"] = offer->getSeq();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
jvResult = rpcError(rpcACT_NOT_FOUND);
|
jvResult = rpcError(rpcACT_NOT_FOUND);
|
||||||
}
|
|
||||||
|
|
||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user