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:
@@ -88,15 +88,17 @@ void Application::run()
|
||||
boost::thread t6(boost::bind(&InitDB, &mNetNodeDB, "netnode.db", NetNodeDBInit, NetNodeDBCount));
|
||||
t1.join(); t2.join(); t3.join(); t4.join(); t5.join(); t6.join();
|
||||
|
||||
if(theConfig.START_UP==Config::FRESH)
|
||||
if (theConfig.START_UP == Config::FRESH)
|
||||
{
|
||||
Log(lsINFO) << "Starting new Ledger";
|
||||
startNewLedger();
|
||||
}else if(theConfig.START_UP==Config::LOAD)
|
||||
}
|
||||
else if (theConfig.START_UP == Config::LOAD)
|
||||
{
|
||||
Log(lsINFO) << "Loading Old Ledger";
|
||||
loadOldLedger();
|
||||
}else
|
||||
}
|
||||
else
|
||||
{ // TODO: This should really not validate a ledger until it gets the current one from our peers
|
||||
// but I'll let david make this change since a lot of code assumes we have a ledger
|
||||
// for now just do what we always were doing
|
||||
@@ -173,6 +175,7 @@ Application::~Application()
|
||||
delete mHashNodeDB;
|
||||
delete mNetNodeDB;
|
||||
}
|
||||
|
||||
void Application::startNewLedger()
|
||||
{
|
||||
// New stuff.
|
||||
@@ -203,14 +206,17 @@ void Application::startNewLedger()
|
||||
|
||||
void Application::loadOldLedger()
|
||||
{
|
||||
Ledger::pointer lastLedger = Ledger::getSQL("SELECT * from Ledgers order by LedgerSeq desc limit 1;",true);
|
||||
Ledger::pointer lastLedger = Ledger::getSQL("SELECT * from Ledgers order by LedgerSeq desc limit 1;");
|
||||
|
||||
if(!lastLedger)
|
||||
if (!lastLedger)
|
||||
{
|
||||
std::cout << "No Ledger found?" << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
mMasterLedger.pushLedger(lastLedger);
|
||||
|
||||
lastLedger->setClosed();
|
||||
Ledger::pointer openLedger = boost::make_shared<Ledger>(false, boost::ref(*lastLedger));
|
||||
mMasterLedger.switchLedgers(lastLedger, openLedger);
|
||||
mNetOps.setLastCloseTime(lastLedger->getCloseTimeNC());
|
||||
}
|
||||
// vim:ts=4
|
||||
|
||||
@@ -391,7 +391,7 @@ void Ledger::saveAcceptedLedger(Ledger::ref ledger)
|
||||
theApp->getOPs().pubLedger(ledger);
|
||||
}
|
||||
|
||||
Ledger::pointer Ledger::getSQL(const std::string& sql,bool isMutable)
|
||||
Ledger::pointer Ledger::getSQL(const std::string& sql)
|
||||
{
|
||||
uint256 ledgerHash, prevHash, accountHash, transHash;
|
||||
uint64 totCoins;
|
||||
@@ -424,8 +424,8 @@ Ledger::pointer Ledger::getSQL(const std::string& sql,bool isMutable)
|
||||
db->endIterRows();
|
||||
}
|
||||
|
||||
Ledger::pointer ret =Ledger::pointer(new Ledger(prevHash, transHash, accountHash, totCoins, closingTime, prevClosingTime,
|
||||
closeFlags, closeResolution, ledgerSeq,isMutable));
|
||||
Ledger::pointer ret = Ledger::pointer(new Ledger(prevHash, transHash, accountHash, totCoins,
|
||||
closingTime, prevClosingTime, closeFlags, closeResolution, ledgerSeq, true));
|
||||
if (ret->getHash() != ledgerHash)
|
||||
{
|
||||
if (sLog(lsERROR))
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
|
||||
Ledger(const uint256 &parentHash, const uint256 &transHash, const uint256 &accountHash,
|
||||
uint64 totCoins, uint32 closeTime, uint32 parentCloseTime, int closeFlags, int closeResolution,
|
||||
uint32 ledgerSeq,bool immutable); // used for database ledgers
|
||||
uint32 ledgerSeq, bool immutable); // used for database ledgers
|
||||
|
||||
Ledger(const std::vector<unsigned char>& rawLedger);
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
|
||||
Ledger(Ledger& target, bool isMutable); // snapshot
|
||||
|
||||
static Ledger::pointer getSQL(const std::string& sqlStatement,bool immutable=false);
|
||||
static Ledger::pointer getSQL(const std::string& sqlStatement);
|
||||
|
||||
void updateHash();
|
||||
void setClosed() { mClosed = true; }
|
||||
@@ -116,10 +116,6 @@ public:
|
||||
void armDirty() { mTransactionMap->armDirty(); mAccountStateMap->armDirty(); }
|
||||
void disarmDirty() { mTransactionMap->disarmDirty(); mAccountStateMap->disarmDirty(); }
|
||||
|
||||
// This ledger has closed, will never be accepted, and is accepting
|
||||
// new transactions to be re-reprocessed when do accept a new last-closed ledger
|
||||
void bumpSeq() { mClosed = true; mLedgerSeq++; }
|
||||
|
||||
// ledger signature operations
|
||||
void addRaw(Serializer &s) const;
|
||||
void setRaw(const Serializer& s);
|
||||
|
||||
Reference in New Issue
Block a user