mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-21 14:20:56 +00:00
Impose a local limit on path lengths (RIPD-350)
This commit is contained in:
committed by
Vinnie Falco
parent
6842277977
commit
9c390f6da4
@@ -240,9 +240,14 @@ TER Payment::doApply ()
|
||||
try
|
||||
{
|
||||
bool const openLedger = (mParams & tapOPEN_LEDGER);
|
||||
bool const tooManyPaths = spsPaths.size () > MaxPathSize;
|
||||
|
||||
terResult = openLedger && tooManyPaths
|
||||
bool pathTooBig = spsPaths.size () > MaxPathSize;
|
||||
|
||||
for (auto const& path : spsPaths)
|
||||
if (path.size () > MaxPathLength)
|
||||
pathTooBig = true;
|
||||
|
||||
terResult = openLedger && pathTooBig
|
||||
? telBAD_PATH_COUNT // Too many paths for proposed ledger.
|
||||
: path::rippleCalculate (
|
||||
mEngine->view (),
|
||||
|
||||
@@ -28,6 +28,9 @@ class Payment
|
||||
/* The largest number of paths we allow */
|
||||
static std::size_t const MaxPathSize = 6;
|
||||
|
||||
/* The longest path we allow */
|
||||
static std::size_t const MaxPathLength = 8;
|
||||
|
||||
public:
|
||||
Payment (
|
||||
SerializedTransaction const& txn,
|
||||
|
||||
Reference in New Issue
Block a user