Structures to correctly handle both pre and post close wobble.

This commit is contained in:
JoelKatz
2012-06-03 12:24:10 -07:00
parent 56d883571a
commit d35bb54c06
5 changed files with 46 additions and 27 deletions

View File

@@ -291,8 +291,10 @@ int LedgerConsensus::statePreClose(int secondsSinceClose)
{ // it is shortly before ledger close time
if (secondsSinceClose >= 0)
{ // it is time to close the ledger
Log(lsINFO) << "Closing ledger";
mState = lcsPOST_CLOSE;
closeLedger();
Ledger::pointer initial = theApp->getMasterLedger().getCurrentLedger();
statusChange(newcoin::neCLOSING_LEDGER, mPreviousLedger);
}
return 1;
}
@@ -429,13 +431,6 @@ SHAMap::pointer LedgerConsensus::getTransactionTree(const uint256& hash, bool do
return it->second;
}
void LedgerConsensus::closeLedger()
{
Log(lsINFO) << "Closing ledger";
Ledger::pointer initial = theApp->getMasterLedger().getCurrentLedger();
statusChange(newcoin::neCLOSING_LEDGER, mPreviousLedger);
}
void LedgerConsensus::startAcquiring(TransactionAcquire::pointer acquire)
{
boost::unordered_map< uint256, std::vector< boost::weak_ptr<Peer> > >::iterator it =
@@ -602,7 +597,7 @@ void LedgerConsensus::applyTransactions(SHAMap::pointer set, Ledger::pointer led
#endif
SerializerIterator sit(item->peekSerializer());
SerializedTransaction::pointer txn = boost::make_shared<SerializedTransaction>(boost::ref(sit));
TransactionEngineResult result = engine.applyTransaction(*txn, tepNO_CHECK_FEE | tepUPDATE_TOTAL);
TransactionEngineResult result = engine.applyTransaction(*txn, tepNO_CHECK_FEE | tepUPDATE_TOTAL, 0);
if (result > 0)
{
Log(lsINFO) << " retry";
@@ -638,7 +633,7 @@ void LedgerConsensus::applyTransactions(SHAMap::pointer set, Ledger::pointer led
{
try
{
TransactionEngineResult result = engine.applyTransaction(**it, tepNO_CHECK_FEE | tepUPDATE_TOTAL);
TransactionEngineResult result = engine.applyTransaction(**it, tepNO_CHECK_FEE | tepUPDATE_TOTAL, 0);
if (result <= 0)
{
if (result == 0) ++successes;