@@ -32,27 +32,27 @@ trait PathFinding {
3232 private implicit def ec : ExecutionContext = actorSystem.dispatcher
3333
3434 val findRoute : Route = postRequest(" findroute" ) { implicit t =>
35- formFields(invoiceFormParam, amountMsatFormParam.? , " pathFindingExperimentName" .? , routeFormatFormParam.? , " includeLocalChannelCost" .as[Boolean ].? , ignoreNodeIdsFormParam.? , ignoreShortChannelIdsFormParam.? , maxFeeMsatFormParam.? ) {
36- case (invoice, None , pathFindingExperimentName_opt, routeFormat_opt, includeLocalChannelCost_opt, ignoreNodeIds_opt, ignoreChannels_opt, maxFee_opt) if invoice.amount_opt.nonEmpty =>
37- complete(eclairApi.findRoute(invoice.nodeId, invoice.amount_opt.get, pathFindingExperimentName_opt, invoice.extraEdges, includeLocalChannelCost_opt.getOrElse(false ), ignoreNodeIds = ignoreNodeIds_opt.getOrElse(Nil ), ignoreShortChannelIds = ignoreChannels_opt.getOrElse(Nil ), maxFee_opt = maxFee_opt).map(r => RouteFormat .format(r, routeFormat_opt)))
38- case (invoice, Some (overrideAmount), pathFindingExperimentName_opt, routeFormat_opt, includeLocalChannelCost_opt, ignoreNodeIds_opt, ignoreChannels_opt, maxFee_opt) =>
39- complete(eclairApi.findRoute(invoice.nodeId, overrideAmount, pathFindingExperimentName_opt, invoice.extraEdges, includeLocalChannelCost_opt.getOrElse(false ), ignoreNodeIds = ignoreNodeIds_opt.getOrElse(Nil ), ignoreShortChannelIds = ignoreChannels_opt.getOrElse(Nil ), maxFee_opt = maxFee_opt).map(r => RouteFormat .format(r, routeFormat_opt)))
40- case _ => reject(MalformedFormFieldRejection (
41- " invoice" , " The invoice must have an amount or you need to specify one using 'amountMsat'"
42- ))
35+ formFields(invoiceFormParam, amountMsatFormParam.? , " pathFindingExperimentName" .? , routeFormatFormParam.? , " includeLocalChannelCost" .as[Boolean ].? , ignoreNodeIdsFormParam.? , ignoreShortChannelIdsFormParam.? , maxFeeMsatFormParam.? , maxCltvExpiryDeltaFormParam.? ) {
36+ case (invoice, None , pathFindingExperimentName_opt, routeFormat_opt, includeLocalChannelCost_opt, ignoreNodeIds_opt, ignoreChannels_opt, maxFee_opt, maxCltv_opt) if invoice.amount_opt.nonEmpty =>
37+ complete(eclairApi.findRoute(invoice.nodeId, invoice.amount_opt.get, pathFindingExperimentName_opt, invoice.extraEdges, includeLocalChannelCost_opt.getOrElse(false ), ignoreNodeIds = ignoreNodeIds_opt.getOrElse(Nil ), ignoreShortChannelIds = ignoreChannels_opt.getOrElse(Nil ), maxFee_opt = maxFee_opt, maxCltvExpiryDelta_opt = maxCltv_opt).map(r => RouteFormat .format(r, routeFormat_opt)))
38+ case (invoice, Some (overrideAmount), pathFindingExperimentName_opt, routeFormat_opt, includeLocalChannelCost_opt, ignoreNodeIds_opt, ignoreChannels_opt, maxFee_opt, maxCltv_opt) =>
39+ complete(eclairApi.findRoute(invoice.nodeId, overrideAmount, pathFindingExperimentName_opt, invoice.extraEdges, includeLocalChannelCost_opt.getOrElse(false ), ignoreNodeIds = ignoreNodeIds_opt.getOrElse(Nil ), ignoreShortChannelIds = ignoreChannels_opt.getOrElse(Nil ), maxFee_opt = maxFee_opt, maxCltvExpiryDelta_opt = maxCltv_opt).map(r => RouteFormat .format(r, routeFormat_opt)))
40+ case _ =>
41+ reject(MalformedFormFieldRejection (" invoice" , " The invoice must have an amount or you need to specify one using 'amountMsat'" ))
4342 }
4443 }
4544
4645 val findRouteToNode : Route = postRequest(" findroutetonode" ) { implicit t =>
47- formFields(nodeIdFormParam, amountMsatFormParam, " pathFindingExperimentName" .? , routeFormatFormParam.? , " includeLocalChannelCost" .as[Boolean ].? , ignoreNodeIdsFormParam.? , ignoreShortChannelIdsFormParam.? , maxFeeMsatFormParam.? ) {
48- (nodeId, amount, pathFindingExperimentName_opt, routeFormat_opt, includeLocalChannelCost_opt, ignoreNodeIds_opt, ignoreChannels_opt, maxFee_opt) =>
49- complete(eclairApi.findRoute(nodeId, amount, pathFindingExperimentName_opt, includeLocalChannelCost = includeLocalChannelCost_opt.getOrElse(false ), ignoreNodeIds = ignoreNodeIds_opt.getOrElse(Nil ), ignoreShortChannelIds = ignoreChannels_opt.getOrElse(Nil ), maxFee_opt = maxFee_opt).map(r => RouteFormat .format(r, routeFormat_opt)))
46+ formFields(nodeIdFormParam, amountMsatFormParam, " pathFindingExperimentName" .? , routeFormatFormParam.? , " includeLocalChannelCost" .as[Boolean ].? , ignoreNodeIdsFormParam.? , ignoreShortChannelIdsFormParam.? , maxFeeMsatFormParam.? , maxCltvExpiryDeltaFormParam. ? ) {
47+ (nodeId, amount, pathFindingExperimentName_opt, routeFormat_opt, includeLocalChannelCost_opt, ignoreNodeIds_opt, ignoreChannels_opt, maxFee_opt, maxCltv_opt ) =>
48+ complete(eclairApi.findRoute(nodeId, amount, pathFindingExperimentName_opt, includeLocalChannelCost = includeLocalChannelCost_opt.getOrElse(false ), ignoreNodeIds = ignoreNodeIds_opt.getOrElse(Nil ), ignoreShortChannelIds = ignoreChannels_opt.getOrElse(Nil ), maxFee_opt = maxFee_opt, maxCltvExpiryDelta_opt = maxCltv_opt ).map(r => RouteFormat .format(r, routeFormat_opt)))
5049 }
5150 }
5251
5352 val findRouteBetweenNodes : Route = postRequest(" findroutebetweennodes" ) { implicit t =>
54- formFields(" sourceNodeId" .as[PublicKey ], " targetNodeId" .as[PublicKey ], amountMsatFormParam, " pathFindingExperimentName" .? , routeFormatFormParam.? , " includeLocalChannelCost" .as[Boolean ].? , ignoreNodeIdsFormParam.? , ignoreShortChannelIdsFormParam.? , maxFeeMsatFormParam.? ) { (sourceNodeId, targetNodeId, amount, pathFindingExperimentName_opt, routeFormat_opt, includeLocalChannelCost_opt, ignoreNodeIds_opt, ignoreChannels_opt, maxFee_opt) =>
55- complete(eclairApi.findRouteBetween(sourceNodeId, targetNodeId, amount, pathFindingExperimentName_opt, includeLocalChannelCost = includeLocalChannelCost_opt.getOrElse(false ), ignoreNodeIds = ignoreNodeIds_opt.getOrElse(Nil ), ignoreShortChannelIds = ignoreChannels_opt.getOrElse(Nil ), maxFee_opt = maxFee_opt).map(r => RouteFormat .format(r, routeFormat_opt)))
53+ formFields(" sourceNodeId" .as[PublicKey ], " targetNodeId" .as[PublicKey ], amountMsatFormParam, " pathFindingExperimentName" .? , routeFormatFormParam.? , " includeLocalChannelCost" .as[Boolean ].? , ignoreNodeIdsFormParam.? , ignoreShortChannelIdsFormParam.? , maxFeeMsatFormParam.? , maxCltvExpiryDeltaFormParam.? ) {
54+ (sourceNodeId, targetNodeId, amount, pathFindingExperimentName_opt, routeFormat_opt, includeLocalChannelCost_opt, ignoreNodeIds_opt, ignoreChannels_opt, maxFee_opt, maxCltv_opt) =>
55+ complete(eclairApi.findRouteBetween(sourceNodeId, targetNodeId, amount, pathFindingExperimentName_opt, includeLocalChannelCost = includeLocalChannelCost_opt.getOrElse(false ), ignoreNodeIds = ignoreNodeIds_opt.getOrElse(Nil ), ignoreShortChannelIds = ignoreChannels_opt.getOrElse(Nil ), maxFee_opt = maxFee_opt, maxCltvExpiryDelta_opt = maxCltv_opt).map(r => RouteFormat .format(r, routeFormat_opt)))
5656 }
5757 }
5858
0 commit comments