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:
@@ -92,11 +92,13 @@ void Application::run()
|
|||||||
{
|
{
|
||||||
Log(lsINFO) << "Starting new Ledger";
|
Log(lsINFO) << "Starting new Ledger";
|
||||||
startNewLedger();
|
startNewLedger();
|
||||||
}else if(theConfig.START_UP==Config::LOAD)
|
}
|
||||||
|
else if (theConfig.START_UP == Config::LOAD)
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "Loading Old Ledger";
|
Log(lsINFO) << "Loading Old Ledger";
|
||||||
loadOldLedger();
|
loadOldLedger();
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{ // TODO: This should really not validate a ledger until it gets the current one from our peers
|
{ // 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
|
// 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
|
// for now just do what we always were doing
|
||||||
@@ -173,6 +175,7 @@ Application::~Application()
|
|||||||
delete mHashNodeDB;
|
delete mHashNodeDB;
|
||||||
delete mNetNodeDB;
|
delete mNetNodeDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::startNewLedger()
|
void Application::startNewLedger()
|
||||||
{
|
{
|
||||||
// New stuff.
|
// New stuff.
|
||||||
@@ -203,14 +206,17 @@ void Application::startNewLedger()
|
|||||||
|
|
||||||
void Application::loadOldLedger()
|
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;
|
std::cout << "No Ledger found?" << std::endl;
|
||||||
exit(-1);
|
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());
|
mNetOps.setLastCloseTime(lastLedger->getCloseTimeNC());
|
||||||
}
|
}
|
||||||
// vim:ts=4
|
// vim:ts=4
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ void Ledger::saveAcceptedLedger(Ledger::ref ledger)
|
|||||||
theApp->getOPs().pubLedger(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;
|
uint256 ledgerHash, prevHash, accountHash, transHash;
|
||||||
uint64 totCoins;
|
uint64 totCoins;
|
||||||
@@ -424,8 +424,8 @@ Ledger::pointer Ledger::getSQL(const std::string& sql,bool isMutable)
|
|||||||
db->endIterRows();
|
db->endIterRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ledger::pointer ret =Ledger::pointer(new Ledger(prevHash, transHash, accountHash, totCoins, closingTime, prevClosingTime,
|
Ledger::pointer ret = Ledger::pointer(new Ledger(prevHash, transHash, accountHash, totCoins,
|
||||||
closeFlags, closeResolution, ledgerSeq,isMutable));
|
closingTime, prevClosingTime, closeFlags, closeResolution, ledgerSeq, true));
|
||||||
if (ret->getHash() != ledgerHash)
|
if (ret->getHash() != ledgerHash)
|
||||||
{
|
{
|
||||||
if (sLog(lsERROR))
|
if (sLog(lsERROR))
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
Ledger(Ledger& target, bool isMutable); // snapshot
|
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 updateHash();
|
||||||
void setClosed() { mClosed = true; }
|
void setClosed() { mClosed = true; }
|
||||||
@@ -116,10 +116,6 @@ public:
|
|||||||
void armDirty() { mTransactionMap->armDirty(); mAccountStateMap->armDirty(); }
|
void armDirty() { mTransactionMap->armDirty(); mAccountStateMap->armDirty(); }
|
||||||
void disarmDirty() { mTransactionMap->disarmDirty(); mAccountStateMap->disarmDirty(); }
|
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
|
// ledger signature operations
|
||||||
void addRaw(Serializer &s) const;
|
void addRaw(Serializer &s) const;
|
||||||
void setRaw(const Serializer& s);
|
void setRaw(const Serializer& s);
|
||||||
|
|||||||
Reference in New Issue
Block a user