mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Bugfixes.
This commit is contained in:
@@ -37,7 +37,7 @@ DatabaseCon::~DatabaseCon()
|
||||
|
||||
Application::Application() :
|
||||
mUNL(mIOService),
|
||||
mNetOps(mIOService, &mMasterLedger), mNodeCache(16384, 600), mHashedObjectStore(16384, 300),
|
||||
mNetOps(mIOService, &mMasterLedger), mTempNodeCache(16384, 90), mHashedObjectStore(16384, 300),
|
||||
mTxnDB(NULL), mLedgerDB(NULL), mWalletDB(NULL), mHashNodeDB(NULL), mNetNodeDB(NULL),
|
||||
mConnectionPool(mIOService), mPeerDoor(NULL), mRPCDoor(NULL)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ class Application
|
||||
LedgerAcquireMaster mMasterLedgerAcquire;
|
||||
TransactionMaster mMasterTransaction;
|
||||
NetworkOPs mNetOps;
|
||||
NodeCache mNodeCache;
|
||||
NodeCache mTempNodeCache;
|
||||
ValidationCollection mValidations;
|
||||
SuppressionTable mSuppressions;
|
||||
HashedObjectStore mHashedObjectStore;
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
LedgerMaster& getMasterLedger() { return mMasterLedger; }
|
||||
LedgerAcquireMaster& getMasterLedgerAcquire() { return mMasterLedgerAcquire; }
|
||||
TransactionMaster& getMasterTransaction() { return mMasterTransaction; }
|
||||
NodeCache& getNodeCache() { return mNodeCache; }
|
||||
NodeCache& getTempNodeCache() { return mTempNodeCache; }
|
||||
HashedObjectStore& getHashedObjectStore() { return mHashedObjectStore; }
|
||||
ValidationCollection& getValidations() { return mValidations; }
|
||||
bool isNew(const uint256& s) { return mSuppressions.addSuppression(s); }
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "../json/writer.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "Ledger.h"
|
||||
#include "utils.h"
|
||||
@@ -350,6 +352,11 @@ Ledger::pointer Ledger::getSQL(const std::string& sql)
|
||||
boost::make_shared<Ledger>(prevHash, transHash, accountHash, totCoins, closingTime, ledgerSeq);
|
||||
if (ret->getHash() != ledgerHash)
|
||||
{
|
||||
Json::StyledStreamWriter ssw;
|
||||
Log(lsERROR) << "Failed on ledger";
|
||||
Json::Value p;
|
||||
ret->addJson(p, LEDGER_JSON_FULL);
|
||||
ssw.write(Log(lsERROR).ref(), p);
|
||||
assert(false);
|
||||
return Ledger::pointer();
|
||||
}
|
||||
@@ -379,7 +386,8 @@ void Ledger::addJson(Json::Value& ret, int options)
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
ledger["parentHash"] = mParentHash.GetHex();
|
||||
|
||||
if(mClosed)
|
||||
bool full = (options & LEDGER_JSON_FULL) != 0;
|
||||
if(mClosed || full)
|
||||
{
|
||||
ledger["hash"] = mHash.GetHex();
|
||||
ledger["transactionHash"] = mTransHash.GetHex();
|
||||
@@ -391,8 +399,7 @@ void Ledger::addJson(Json::Value& ret, int options)
|
||||
else ledger["closed"] = false;
|
||||
if (mCloseTime != 0)
|
||||
ledger["closeTime"] = boost::posix_time::to_simple_string(ptFromSeconds(mCloseTime));
|
||||
bool full = (options & LEDGER_JSON_FULL) != 0;
|
||||
if (full || ((options & LEDGER_JSON_DUMP_TXNS) != 0))
|
||||
if (mTransactionMap && (full || ((options & LEDGER_JSON_DUMP_TXNS) != 0)))
|
||||
{
|
||||
Json::Value txns(Json::arrayValue);
|
||||
for (SHAMapItem::pointer item = mTransactionMap->peekFirstItem(); !!item;
|
||||
@@ -408,7 +415,7 @@ void Ledger::addJson(Json::Value& ret, int options)
|
||||
}
|
||||
ledger["transactions"] = txns;
|
||||
}
|
||||
if (full || ((options & LEDGER_JSON_DUMP_STATE) != 0))
|
||||
if (mAccountStateMap && (full || ((options & LEDGER_JSON_DUMP_STATE) != 0)))
|
||||
{
|
||||
Json::Value state(Json::arrayValue);
|
||||
for (SHAMapItem::pointer item = mAccountStateMap->peekFirstItem(); !!item;
|
||||
|
||||
@@ -60,9 +60,11 @@ Ledger::pointer LedgerHistory::getLedgerByHash(const uint256& hash)
|
||||
Ledger::pointer ret = mLedgersByHash.fetch(hash);
|
||||
if (ret) return ret;
|
||||
|
||||
ret = Ledger::loadByHash(hash);
|
||||
if (!ret) return ret;
|
||||
assert(ret->getHash() == hash);
|
||||
// FIXME: A ledger without SHA maps isn't very useful
|
||||
// This code will need to build them
|
||||
// ret = Ledger::loadByHash(hash);
|
||||
// if (!ret) return ret;
|
||||
// assert(ret->getHash() == hash);
|
||||
|
||||
boost::recursive_mutex::scoped_lock sl(mLedgersByHash.peekMutex());
|
||||
mLedgersByHash.canonicalize(hash, ret);
|
||||
|
||||
@@ -15,12 +15,12 @@ public:
|
||||
const std::vector<unsigned char>& nodeData, bool isLeaf)
|
||||
{
|
||||
// WRITEME: If 'isLeaf' is true, this is a transaction
|
||||
theApp->getNodeCache().store(nodeHash, nodeData);
|
||||
theApp->getTempNodeCache().store(nodeHash, nodeData);
|
||||
}
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData)
|
||||
{
|
||||
// WRITEME: We could check our own map, we could check transaction tables
|
||||
return theApp->getNodeCache().retrieve(nodeHash, nodeData);
|
||||
return theApp->getTempNodeCache().retrieve(nodeHash, nodeData);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -40,11 +40,8 @@ public:
|
||||
theApp->getHashedObjectStore().store(ACCOUNT_NODE, mLedgerSeq, nodeData, nodeHash);
|
||||
}
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData)
|
||||
{
|
||||
HashedObject::pointer node = theApp->getHashedObjectStore().retrieve(nodeHash);
|
||||
if (!node) return false;
|
||||
nodeData = node->getData();
|
||||
return true;
|
||||
{ // fetchNode already tried
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -64,11 +61,8 @@ public:
|
||||
theApp->getHashedObjectStore().store(isLeaf ? TRANSACTION : TRANSACTION_NODE, mLedgerSeq, nodeData, nodeHash);
|
||||
}
|
||||
virtual bool haveNode(const SHAMapNode& id, const uint256& nodeHash, std::vector<unsigned char>& nodeData)
|
||||
{
|
||||
HashedObject::pointer node = theApp->getHashedObjectStore().retrieve(nodeHash);
|
||||
if (!node) return false;
|
||||
nodeData = node->getData();
|
||||
return true;
|
||||
{ // fetchNode already tried
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user