mirror of
https://github.com/XRPLF/rippled.git
synced 2026-01-14 03:35:28 +00:00
Compare commits
26 Commits
ximinez/pa
...
ximinez/em
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0162143985 | ||
|
|
c94ea3f6a3 | ||
|
|
ba1845a251 | ||
|
|
5def664681 | ||
|
|
efb8b1c99f | ||
|
|
a6a69ad977 | ||
|
|
bd665f6280 | ||
|
|
2245964a47 | ||
|
|
d43e7bb852 | ||
|
|
017ade8f45 | ||
|
|
a48b12fdf7 | ||
|
|
8f267c3bc9 | ||
|
|
bface8d5d6 | ||
|
|
24174f6ea7 | ||
|
|
cf3ad16bdf | ||
|
|
a4046aa135 | ||
|
|
46f6332e60 | ||
|
|
ff3c2bf2f9 | ||
|
|
379e1ed555 | ||
|
|
e9fb99056b | ||
|
|
e9fa9d7aa6 | ||
|
|
2c3f169dec | ||
|
|
23565405ee | ||
|
|
a5d08b0cd5 | ||
|
|
7bf3f543b3 | ||
|
|
c773288df5 |
@@ -254,6 +254,7 @@ ApplyView::dirRemove(
|
||||
uint256 const& key,
|
||||
bool keepRoot)
|
||||
{
|
||||
keepRoot = false;
|
||||
auto node = peek(keylet::page(directory, page));
|
||||
|
||||
if (!node)
|
||||
|
||||
@@ -427,7 +427,6 @@ class Batch_test : public beast::unit_test::suite
|
||||
auto const batchFee = batch::calcBatchFee(env, 0, 2);
|
||||
auto tx1 = batch::inner(pay(alice, bob, XRP(1)), seq + 1);
|
||||
tx1[jss::Fee] = "1.5";
|
||||
env.set_parse_failure_expected(true);
|
||||
try
|
||||
{
|
||||
env(batch::outer(alice, seq, batchFee, tfAllOrNothing),
|
||||
@@ -439,7 +438,6 @@ class Batch_test : public beast::unit_test::suite
|
||||
{
|
||||
BEAST_EXPECT(true);
|
||||
}
|
||||
env.set_parse_failure_expected(false);
|
||||
}
|
||||
|
||||
// temSEQ_AND_TICKET: Batch: inner txn cannot have both Sequence
|
||||
|
||||
@@ -1084,7 +1084,7 @@ ValidNewAccountRoot::finalize(
|
||||
|
||||
JLOG(j.fatal()) << "Invariant failed: account root created illegally";
|
||||
return false;
|
||||
} // namespace xrpl
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -3566,4 +3566,42 @@ ValidVault::finalize(
|
||||
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 xrpl
|
||||
|
||||
@@ -902,6 +902,30 @@ public:
|
||||
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
|
||||
// tuple
|
||||
using InvariantChecks = std::tuple<
|
||||
@@ -928,7 +952,8 @@ using InvariantChecks = std::tuple<
|
||||
ValidPseudoAccounts,
|
||||
ValidLoanBroker,
|
||||
ValidLoan,
|
||||
ValidVault>;
|
||||
ValidVault,
|
||||
NoEmptyDirectory>;
|
||||
|
||||
/**
|
||||
* @brief get a tuple of all invariant checks
|
||||
|
||||
Reference in New Issue
Block a user