Charge for pathfinding updates.

This commit is contained in:
JoelKatz
2014-03-17 19:40:35 -07:00
committed by David Schwartz
parent 0442b3a683
commit 5d1aec6280
3 changed files with 11 additions and 5 deletions

View File

@@ -40,6 +40,7 @@ extern Charge const feeLightRPC; // A normal RPC command
extern Charge const feeLowBurdenRPC; // A slightly burdensome RPC load
extern Charge const feeMediumBurdenRPC; // A somewhat burdensome RPC load
extern Charge const feeHighBurdenRPC; // A very burdensome RPC load
extern Charge const feePathFindUpdate; // An update to an existing PF request
// Good things
extern Charge const feeNewTrustedNote; // A new transaction/validation/proposal we trust

View File

@@ -34,6 +34,7 @@ Charge const feeLightRPC ( 5, "light RPC" ); // DAVID: C
Charge const feeLowBurdenRPC ( 20, "low RPC" );
Charge const feeMediumBurdenRPC ( 40, "medium RPC" );
Charge const feeHighBurdenRPC ( 300, "heavy RPC" );
Charge const feePathFindUpdate ( 100, "path update" );
Charge const feeNewTrustedNote ( 10, "trusted note" );
Charge const feeNewValidTx ( 10, "valid tx" );

View File

@@ -86,11 +86,15 @@ void PathRequests::updateAll (Ledger::ref inLedger, CancelCallback shouldCancel)
InfoSub::pointer ipSub = pRequest->getSubscriber ();
if (ipSub)
{
Json::Value update = pRequest->doUpdate (cache, false);
update["type"] = "path_find";
ipSub->send (update, false);
remove = false;
++processed;
ipSub->getConsumer ().charge (Resource::feePathFindUpdate);
if (!ipSub->getConsumer ().warn ())
{
Json::Value update = pRequest->doUpdate (cache, false);
update["type"] = "path_find";
ipSub->send (update, false);
remove = false;
++processed;
}
}
}
}