mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-18 18:15:50 +00:00
Compare commits
5 Commits
ximinez/le
...
ximinez/em
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c3f169dec | ||
|
|
23565405ee | ||
|
|
a5d08b0cd5 | ||
|
|
7bf3f543b3 | ||
|
|
c773288df5 |
@@ -191,6 +191,7 @@ ApplyView::dirRemove(
|
|||||||
uint256 const& key,
|
uint256 const& key,
|
||||||
bool keepRoot)
|
bool keepRoot)
|
||||||
{
|
{
|
||||||
|
keepRoot = false;
|
||||||
auto node = peek(keylet::page(directory, page));
|
auto node = peek(keylet::page(directory, page));
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
|
|||||||
@@ -3096,4 +3096,42 @@ ValidVault::finalize(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void
|
||||||
|
NoEmptyDirectory::visitEntry(
|
||||||
|
bool isDelete,
|
||||||
|
std::shared_ptr<SLE const> const& before,
|
||||||
|
std::shared_ptr<SLE const> const& after)
|
||||||
|
{
|
||||||
|
if (isDelete)
|
||||||
|
return;
|
||||||
|
if (before && before->getType() != ltDIR_NODE)
|
||||||
|
return;
|
||||||
|
if (after && after->getType() != ltDIR_NODE)
|
||||||
|
return;
|
||||||
|
if (!after->isFieldPresent(sfOwner))
|
||||||
|
// Not an account dir
|
||||||
|
return;
|
||||||
|
|
||||||
|
bad_ = after->at(sfIndexes).empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
NoEmptyDirectory::finalize(
|
||||||
|
STTx const& tx,
|
||||||
|
TER const result,
|
||||||
|
XRPAmount const,
|
||||||
|
ReadView const& view,
|
||||||
|
beast::Journal const& j)
|
||||||
|
{
|
||||||
|
if (bad_)
|
||||||
|
{
|
||||||
|
JLOG(j.fatal()) << "Invariant failed: empty owner directory.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -783,6 +783,30 @@ public:
|
|||||||
beast::Journal const&);
|
beast::Journal const&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Invariants: An account's directory should never be empty
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class NoEmptyDirectory
|
||||||
|
{
|
||||||
|
bool bad_ = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void
|
||||||
|
visitEntry(
|
||||||
|
bool,
|
||||||
|
std::shared_ptr<SLE const> const&,
|
||||||
|
std::shared_ptr<SLE const> const&);
|
||||||
|
|
||||||
|
bool
|
||||||
|
finalize(
|
||||||
|
STTx const&,
|
||||||
|
TER const,
|
||||||
|
XRPAmount const,
|
||||||
|
ReadView const&,
|
||||||
|
beast::Journal const&);
|
||||||
|
};
|
||||||
|
|
||||||
// additional invariant checks can be declared above and then added to this
|
// additional invariant checks can be declared above and then added to this
|
||||||
// tuple
|
// tuple
|
||||||
using InvariantChecks = std::tuple<
|
using InvariantChecks = std::tuple<
|
||||||
@@ -806,7 +830,8 @@ using InvariantChecks = std::tuple<
|
|||||||
ValidPermissionedDEX,
|
ValidPermissionedDEX,
|
||||||
ValidAMM,
|
ValidAMM,
|
||||||
ValidPseudoAccounts,
|
ValidPseudoAccounts,
|
||||||
ValidVault>;
|
ValidVault,
|
||||||
|
NoEmptyDirectory>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get a tuple of all invariant checks
|
* @brief get a tuple of all invariant checks
|
||||||
|
|||||||
Reference in New Issue
Block a user