mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Limit changed node count
This commit is contained in:
@@ -532,7 +532,11 @@ Transactor::operator()()
|
||||
bool didApply = isTesSuccess (terResult);
|
||||
auto fee = tx().getTransactionFee ();
|
||||
|
||||
if (isTecClaim (terResult) && !(view().flags() & tapRETRY))
|
||||
if (view().size() > 5200)
|
||||
terResult = tecOVERSIZE;
|
||||
|
||||
if ((terResult == tecOVERSIZE) ||
|
||||
(isTecClaim (terResult) && !(view().flags() & tapRETRY)))
|
||||
{
|
||||
// only claim the transaction fee
|
||||
JLOG(j_.debug) <<
|
||||
|
||||
@@ -196,6 +196,12 @@ public:
|
||||
void
|
||||
update (std::shared_ptr<SLE> const& sle) = 0;
|
||||
|
||||
/** Get the number of modified entries
|
||||
*/
|
||||
virtual
|
||||
std::size_t
|
||||
size () = 0;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Called when a credit is made to an account
|
||||
|
||||
@@ -80,6 +80,11 @@ public:
|
||||
deliver_ = amount;
|
||||
}
|
||||
|
||||
/** Get the number of modified entries
|
||||
*/
|
||||
std::size_t
|
||||
size ();
|
||||
|
||||
private:
|
||||
boost::optional<STAmount> deliver_;
|
||||
};
|
||||
|
||||
@@ -94,6 +94,9 @@ public:
|
||||
peek (ReadView const& base,
|
||||
Keylet const& k);
|
||||
|
||||
std::size_t
|
||||
size ();
|
||||
|
||||
void
|
||||
erase (ReadView const& base,
|
||||
std::shared_ptr<SLE> const& sle);
|
||||
|
||||
@@ -132,6 +132,9 @@ public:
|
||||
rawDestroyXRP (
|
||||
std::uint64_t feeDrops) override;
|
||||
|
||||
std::size_t
|
||||
size () override;
|
||||
|
||||
protected:
|
||||
ApplyFlags flags_;
|
||||
ReadView const* base_;
|
||||
|
||||
@@ -53,6 +53,25 @@ ApplyStateTable::apply (RawView& to) const
|
||||
}
|
||||
}
|
||||
|
||||
std::size_t
|
||||
ApplyStateTable::size ()
|
||||
{
|
||||
std::size_t ret = 0;
|
||||
for (auto& item : items_)
|
||||
{
|
||||
switch (item.second.first)
|
||||
{
|
||||
case Action::erase:
|
||||
case Action::insert:
|
||||
case Action::modify:
|
||||
++ret;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
ApplyStateTable::apply (OpenView& to,
|
||||
STTx const& tx, TER ter,
|
||||
|
||||
@@ -148,6 +148,13 @@ ApplyViewBase::update(
|
||||
items_.update(*base_, sle);
|
||||
}
|
||||
|
||||
std::size_t
|
||||
ApplyViewBase::size ()
|
||||
{
|
||||
return items_.size ();
|
||||
}
|
||||
|
||||
|
||||
//---
|
||||
|
||||
void
|
||||
|
||||
@@ -38,4 +38,10 @@ ApplyViewImpl::apply (OpenView& to,
|
||||
items_.apply(to, tx, ter, deliver_, j);
|
||||
}
|
||||
|
||||
std::size_t
|
||||
ApplyViewImpl::size ()
|
||||
{
|
||||
return items_.size ();
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -200,6 +200,7 @@ enum TER
|
||||
tecNEED_MASTER_KEY = 142,
|
||||
tecDST_TAG_NEEDED = 143,
|
||||
tecINTERNAL = 144,
|
||||
tecOVERSIZE = 145,
|
||||
};
|
||||
|
||||
inline bool isTelLocal(TER x)
|
||||
|
||||
@@ -50,6 +50,7 @@ bool transResultInfo (TER code, std::string& token, std::string& text)
|
||||
{ tecPATH_PARTIAL, "tecPATH_PARTIAL", "Path could not send full amount." },
|
||||
{ tecNO_ALTERNATIVE_KEY, "tecNO_ALTERNATIVE_KEY", "The operation would remove the last way to sign a transaction."},
|
||||
{ tecNO_REGULAR_KEY, "tecNO_REGULAR_KEY", "Regular key is not set." },
|
||||
{ tecOVERSIZE, "tecOVERSIZE", "Object exceeded serialization limits." },
|
||||
|
||||
{ tecUNFUNDED, "tecUNFUNDED", "One of _ADD, _OFFER, or _SEND. Deprecated." },
|
||||
{ tecUNFUNDED_ADD, "tecUNFUNDED_ADD", "Insufficient XRP balance for WalletAdd." },
|
||||
|
||||
Reference in New Issue
Block a user