mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix OpenLedger::empty:
* Fix logic of OpenLedger::empty * Add regression test * Remove some dead code
This commit is contained in:
@@ -1132,12 +1132,6 @@ void LedgerConsensusImp::accept (std::shared_ptr<SHAMap> set)
|
|||||||
// See if we can accept a ledger as fully-validated
|
// See if we can accept a ledger as fully-validated
|
||||||
ledgerMaster_.consensusBuilt (newLCL);
|
ledgerMaster_.consensusBuilt (newLCL);
|
||||||
|
|
||||||
// Build new open ledger
|
|
||||||
auto newOL = std::make_shared<Ledger>(
|
|
||||||
open_ledger, *newLCL, app_.timeKeeper().closeTime());
|
|
||||||
OpenView accum(&*newOL);
|
|
||||||
assert(accum.open());
|
|
||||||
|
|
||||||
// Apply disputed transactions that didn't get in
|
// Apply disputed transactions that didn't get in
|
||||||
//
|
//
|
||||||
// The first crack of transactions to get into the new
|
// The first crack of transactions to get into the new
|
||||||
@@ -1177,6 +1171,8 @@ void LedgerConsensusImp::accept (std::shared_ptr<SHAMap> set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// Build new open ledger
|
||||||
|
|
||||||
auto lock = beast::make_lock(
|
auto lock = beast::make_lock(
|
||||||
app_.getMasterMutex(), std::defer_lock);
|
app_.getMasterMutex(), std::defer_lock);
|
||||||
LedgerMaster::ScopedLockType sl (
|
LedgerMaster::ScopedLockType sl (
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ OpenLedger::empty() const
|
|||||||
{
|
{
|
||||||
std::lock_guard<
|
std::lock_guard<
|
||||||
std::mutex> lock(modify_mutex_);
|
std::mutex> lock(modify_mutex_);
|
||||||
return current_->txCount() != 0;
|
return current_->txCount() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ReadView const>
|
std::shared_ptr<ReadView const>
|
||||||
|
|||||||
@@ -551,6 +551,14 @@ class View_test
|
|||||||
}
|
}
|
||||||
expect(! v1.exists(k(1)));
|
expect(! v1.exists(k(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure OpenLedger::empty works
|
||||||
|
{
|
||||||
|
Env env(*this);
|
||||||
|
expect(env.openLedger.empty());
|
||||||
|
env.fund(XRP(10000), Account("test"));
|
||||||
|
expect(!env.openLedger.empty());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void run()
|
void run()
|
||||||
|
|||||||
Reference in New Issue
Block a user