mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Limit passes in the payment engine to prevent endless looping:
This adds a limit of 1,000 passes to the payment engine. It protects against possible cases where the execution of a pass fails to exhaust the liquidity that made the pass possible or cases where two passes alternate providing liquidity for each other.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/paths/Tuning.h>
|
||||
#include <ripple/app/paths/RippleCalc.h>
|
||||
#include <ripple/app/paths/cursor/PathCursor.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
@@ -374,6 +375,16 @@ TER RippleCalc::rippleCalculate ()
|
||||
mumSource_.insert (
|
||||
pathState->reverse().begin (), pathState->reverse().end ());
|
||||
|
||||
if (iPass >= PAYMENT_MAX_LOOPS)
|
||||
{
|
||||
// This payment is taking too many passes
|
||||
|
||||
WriteLog (lsERROR, RippleCalc)
|
||||
<< "rippleCalc: pass limit";
|
||||
|
||||
resultCode = telFAILED_PROCESSING;
|
||||
}
|
||||
|
||||
}
|
||||
else if (!inputFlags.partialPaymentAllowed)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace ripple {
|
||||
|
||||
int const CALC_NODE_DELIVER_MAX_LOOPS = 40;
|
||||
int const NODE_ADVANCE_MAX_LOOPS = 100;
|
||||
int const PAYMENT_MAX_LOOPS = 1000;
|
||||
int const PATHFINDER_HIGH_PRIORITY = 100000;
|
||||
int const PATHFINDER_MAX_PATHS = 50;
|
||||
int const PATHFINDER_MAX_COMPLETE_PATHS = 1000;
|
||||
|
||||
Reference in New Issue
Block a user