Impose a local limit on path lengths (RIPD-350)

This commit is contained in:
David Schwartz
2014-07-04 00:47:40 +00:00
committed by Vinnie Falco
parent 6842277977
commit 9c390f6da4
2 changed files with 10 additions and 2 deletions

View File

@@ -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 (),

View File

@@ -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,