routerrpc.proto 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  1. syntax = "proto3";
  2. package routerrpc;
  3. import "lnrpc.proto";
  4. option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc";
  5. /*
  6. * Comments in this file will be directly parsed into the API
  7. * Documentation as descriptions of the associated method, message, or field.
  8. * These descriptions should go right above the definition of the object, and
  9. * can be in either block or // comment format.
  10. *
  11. * An RPC method can be matched to an lncli command by placing a line in the
  12. * beginning of the description in exactly the following format:
  13. * lncli: `methodname`
  14. *
  15. * Failure to specify the exact name of the command will cause documentation
  16. * generation to fail.
  17. *
  18. * More information on how exactly the gRPC documentation is generated from
  19. * this proto file can be found here:
  20. * https://github.com/lightninglabs/lightning-api
  21. */
  22. // Router is a service that offers advanced interaction with the router
  23. // subsystem of the daemon.
  24. service Router {
  25. /*
  26. SendPaymentV2 attempts to route a payment described by the passed
  27. PaymentRequest to the final destination. The call returns a stream of
  28. payment updates. When using this RPC, make sure to set a fee limit, as the
  29. default routing fee limit is 0 sats. Without a non-zero fee limit only
  30. routes without fees will be attempted which often fails with
  31. FAILURE_REASON_NO_ROUTE.
  32. */
  33. rpc SendPaymentV2 (SendPaymentRequest) returns (stream lnrpc.Payment);
  34. /* lncli: `trackpayment`
  35. TrackPaymentV2 returns an update stream for the payment identified by the
  36. payment hash.
  37. */
  38. rpc TrackPaymentV2 (TrackPaymentRequest) returns (stream lnrpc.Payment);
  39. /*
  40. TrackPayments returns an update stream for every payment that is not in a
  41. terminal state. Note that if payments are in-flight while starting a new
  42. subscription, the start of the payment stream could produce out-of-order
  43. and/or duplicate events. In order to get updates for every in-flight
  44. payment attempt make sure to subscribe to this method before initiating any
  45. payments.
  46. */
  47. rpc TrackPayments (TrackPaymentsRequest) returns (stream lnrpc.Payment);
  48. /*
  49. EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
  50. may cost to send an HTLC to the target end destination.
  51. */
  52. rpc EstimateRouteFee (RouteFeeRequest) returns (RouteFeeResponse);
  53. /*
  54. Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
  55. the specified route. This method differs from SendPayment in that it
  56. allows users to specify a full route manually. This can be used for
  57. things like rebalancing, and atomic swaps. It differs from the newer
  58. SendToRouteV2 in that it doesn't return the full HTLC information.
  59. */
  60. rpc SendToRoute (SendToRouteRequest) returns (SendToRouteResponse) {
  61. option deprecated = true;
  62. }
  63. /*
  64. SendToRouteV2 attempts to make a payment via the specified route. This
  65. method differs from SendPayment in that it allows users to specify a full
  66. route manually. This can be used for things like rebalancing, and atomic
  67. swaps.
  68. */
  69. rpc SendToRouteV2 (SendToRouteRequest) returns (lnrpc.HTLCAttempt);
  70. /* lncli: `resetmc`
  71. ResetMissionControl clears all mission control state and starts with a clean
  72. slate.
  73. */
  74. rpc ResetMissionControl (ResetMissionControlRequest)
  75. returns (ResetMissionControlResponse);
  76. /* lncli: `querymc`
  77. QueryMissionControl exposes the internal mission control state to callers.
  78. It is a development feature.
  79. */
  80. rpc QueryMissionControl (QueryMissionControlRequest)
  81. returns (QueryMissionControlResponse);
  82. /* lncli: `importmc`
  83. XImportMissionControl is an experimental API that imports the state provided
  84. to the internal mission control's state, using all results which are more
  85. recent than our existing values. These values will only be imported
  86. in-memory, and will not be persisted across restarts.
  87. */
  88. rpc XImportMissionControl (XImportMissionControlRequest)
  89. returns (XImportMissionControlResponse);
  90. /* lncli: `getmccfg`
  91. GetMissionControlConfig returns mission control's current config.
  92. */
  93. rpc GetMissionControlConfig (GetMissionControlConfigRequest)
  94. returns (GetMissionControlConfigResponse);
  95. /* lncli: `setmccfg`
  96. SetMissionControlConfig will set mission control's config, if the config
  97. provided is valid.
  98. */
  99. rpc SetMissionControlConfig (SetMissionControlConfigRequest)
  100. returns (SetMissionControlConfigResponse);
  101. /* lncli: `queryprob`
  102. Deprecated. QueryProbability returns the current success probability
  103. estimate for a given node pair and amount. The call returns a zero success
  104. probability if no channel is available or if the amount violates min/max
  105. HTLC constraints.
  106. */
  107. rpc QueryProbability (QueryProbabilityRequest)
  108. returns (QueryProbabilityResponse);
  109. /* lncli: `buildroute`
  110. BuildRoute builds a fully specified route based on a list of hop public
  111. keys. It retrieves the relevant channel policies from the graph in order to
  112. calculate the correct fees and time locks.
  113. Note that LND will use its default final_cltv_delta if no value is supplied.
  114. Make sure to add the correct final_cltv_delta depending on the invoice
  115. restriction. Moreover the caller has to make sure to provide the
  116. payment_addr if the route is paying an invoice which signaled it.
  117. */
  118. rpc BuildRoute (BuildRouteRequest) returns (BuildRouteResponse);
  119. /*
  120. SubscribeHtlcEvents creates a uni-directional stream from the server to
  121. the client which delivers a stream of htlc events.
  122. */
  123. rpc SubscribeHtlcEvents (SubscribeHtlcEventsRequest)
  124. returns (stream HtlcEvent);
  125. /*
  126. Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
  127. described by the passed PaymentRequest to the final destination. The call
  128. returns a stream of payment status updates.
  129. */
  130. rpc SendPayment (SendPaymentRequest) returns (stream PaymentStatus) {
  131. option deprecated = true;
  132. }
  133. /*
  134. Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
  135. the payment identified by the payment hash.
  136. */
  137. rpc TrackPayment (TrackPaymentRequest) returns (stream PaymentStatus) {
  138. option deprecated = true;
  139. }
  140. /**
  141. HtlcInterceptor dispatches a bi-directional streaming RPC in which
  142. Forwarded HTLC requests are sent to the client and the client responds with
  143. a boolean that tells LND if this htlc should be intercepted.
  144. In case of interception, the htlc can be either settled, cancelled or
  145. resumed later by using the ResolveHoldForward endpoint.
  146. */
  147. rpc HtlcInterceptor (stream ForwardHtlcInterceptResponse)
  148. returns (stream ForwardHtlcInterceptRequest);
  149. /* lncli: `updatechanstatus`
  150. UpdateChanStatus attempts to manually set the state of a channel
  151. (enabled, disabled, or auto). A manual "disable" request will cause the
  152. channel to stay disabled until a subsequent manual request of either
  153. "enable" or "auto".
  154. */
  155. rpc UpdateChanStatus (UpdateChanStatusRequest)
  156. returns (UpdateChanStatusResponse);
  157. }
  158. message SendPaymentRequest {
  159. // The identity pubkey of the payment recipient
  160. bytes dest = 1;
  161. /*
  162. Number of satoshis to send.
  163. The fields amt and amt_msat are mutually exclusive.
  164. */
  165. int64 amt = 2;
  166. // The hash to use within the payment's HTLC
  167. bytes payment_hash = 3;
  168. /*
  169. The CLTV delta from the current height that should be used to set the
  170. timelock for the final hop.
  171. */
  172. int32 final_cltv_delta = 4;
  173. /*
  174. A bare-bones invoice for a payment within the Lightning Network. With the
  175. details of the invoice, the sender has all the data necessary to send a
  176. payment to the recipient. The amount in the payment request may be zero. In
  177. that case it is required to set the amt field as well. If no payment request
  178. is specified, the following fields are required: dest, amt and payment_hash.
  179. */
  180. string payment_request = 5;
  181. /*
  182. An upper limit on the amount of time we should spend when attempting to
  183. fulfill the payment. This is expressed in seconds. If we cannot make a
  184. successful payment within this time frame, an error will be returned.
  185. This field must be non-zero.
  186. */
  187. int32 timeout_seconds = 6;
  188. /*
  189. The maximum number of satoshis that will be paid as a fee of the payment.
  190. If this field is left to the default value of 0, only zero-fee routes will
  191. be considered. This usually means single hop routes connecting directly to
  192. the destination. To send the payment without a fee limit, use max int here.
  193. The fields fee_limit_sat and fee_limit_msat are mutually exclusive.
  194. */
  195. int64 fee_limit_sat = 7;
  196. /*
  197. Deprecated, use outgoing_chan_ids. The channel id of the channel that must
  198. be taken to the first hop. If zero, any channel may be used (unless
  199. outgoing_chan_ids are set).
  200. */
  201. uint64 outgoing_chan_id = 8 [jstype = JS_STRING, deprecated = true];
  202. /*
  203. An optional maximum total time lock for the route. This should not
  204. exceed lnd's `--max-cltv-expiry` setting. If zero, then the value of
  205. `--max-cltv-expiry` is enforced.
  206. */
  207. int32 cltv_limit = 9;
  208. /*
  209. Optional route hints to reach the destination through private channels.
  210. */
  211. repeated lnrpc.RouteHint route_hints = 10;
  212. /*
  213. An optional field that can be used to pass an arbitrary set of TLV records
  214. to a peer which understands the new records. This can be used to pass
  215. application specific data during the payment attempt. Record types are
  216. required to be in the custom range >= 65536. When using REST, the values
  217. must be encoded as base64.
  218. */
  219. map<uint64, bytes> dest_custom_records = 11;
  220. /*
  221. Number of millisatoshis to send.
  222. The fields amt and amt_msat are mutually exclusive.
  223. */
  224. int64 amt_msat = 12;
  225. /*
  226. The maximum number of millisatoshis that will be paid as a fee of the
  227. payment. If this field is left to the default value of 0, only zero-fee
  228. routes will be considered. This usually means single hop routes connecting
  229. directly to the destination. To send the payment without a fee limit, use
  230. max int here.
  231. The fields fee_limit_sat and fee_limit_msat are mutually exclusive.
  232. */
  233. int64 fee_limit_msat = 13;
  234. /*
  235. The pubkey of the last hop of the route. If empty, any hop may be used.
  236. */
  237. bytes last_hop_pubkey = 14;
  238. // If set, circular payments to self are permitted.
  239. bool allow_self_payment = 15;
  240. /*
  241. Features assumed to be supported by the final node. All transitive feature
  242. dependencies must also be set properly. For a given feature bit pair, either
  243. optional or remote may be set, but not both. If this field is nil or empty,
  244. the router will try to load destination features from the graph as a
  245. fallback.
  246. */
  247. repeated lnrpc.FeatureBit dest_features = 16;
  248. /*
  249. The maximum number of partial payments that may be use to complete the full
  250. amount.
  251. */
  252. uint32 max_parts = 17;
  253. /*
  254. If set, only the final payment update is streamed back. Intermediate updates
  255. that show which htlcs are still in flight are suppressed.
  256. */
  257. bool no_inflight_updates = 18;
  258. /*
  259. The channel ids of the channels are allowed for the first hop. If empty,
  260. any channel may be used.
  261. */
  262. repeated uint64 outgoing_chan_ids = 19;
  263. /*
  264. An optional payment addr to be included within the last hop of the route.
  265. This is also called payment secret in specifications (e.g. BOLT 11).
  266. */
  267. bytes payment_addr = 20;
  268. /*
  269. The largest payment split that should be attempted when making a payment if
  270. splitting is necessary. Setting this value will effectively cause lnd to
  271. split more aggressively, vs only when it thinks it needs to. Note that this
  272. value is in milli-satoshis.
  273. */
  274. uint64 max_shard_size_msat = 21;
  275. /*
  276. If set, an AMP-payment will be attempted.
  277. */
  278. bool amp = 22;
  279. /*
  280. The time preference for this payment. Set to -1 to optimize for fees
  281. only, to 1 to optimize for reliability only or a value inbetween for a mix.
  282. */
  283. double time_pref = 23;
  284. /*
  285. If set, the payment loop can be interrupted by manually canceling the
  286. payment context, even before the payment timeout is reached. Note that the
  287. payment may still succeed after cancellation, as in-flight attempts can
  288. still settle afterwards. Canceling will only prevent further attempts from
  289. being sent.
  290. */
  291. bool cancelable = 24;
  292. }
  293. message TrackPaymentRequest {
  294. // The hash of the payment to look up.
  295. bytes payment_hash = 1;
  296. /*
  297. If set, only the final payment update is streamed back. Intermediate updates
  298. that show which htlcs are still in flight are suppressed.
  299. */
  300. bool no_inflight_updates = 2;
  301. }
  302. message TrackPaymentsRequest {
  303. /*
  304. If set, only the final payment updates are streamed back. Intermediate
  305. updates that show which htlcs are still in flight are suppressed.
  306. */
  307. bool no_inflight_updates = 1;
  308. }
  309. message RouteFeeRequest {
  310. /*
  311. The destination one wishes to obtain a routing fee quote to. If set, this
  312. parameter requires the amt_sat parameter also to be set. This parameter
  313. combination triggers a graph based routing fee estimation as opposed to a
  314. payment probe based estimate in case a payment request is provided. The
  315. graph based estimation is an algorithm that is executed on the in memory
  316. graph. Hence its runtime is significantly shorter than a payment probe
  317. estimation that sends out actual payments to the network.
  318. */
  319. bytes dest = 1;
  320. /*
  321. The amount one wishes to send to the target destination. It is only to be
  322. used in combination with the dest parameter.
  323. */
  324. int64 amt_sat = 2;
  325. /*
  326. A payment request of the target node that the route fee request is intended
  327. for. Its parameters are input to probe payments that estimate routing fees.
  328. The timeout parameter can be specified to set a maximum time on the probing
  329. attempt. Cannot be used in combination with dest and amt_sat.
  330. */
  331. string payment_request = 3;
  332. /*
  333. A user preference of how long a probe payment should maximally be allowed to
  334. take, denoted in seconds. The probing payment loop is aborted if this
  335. timeout is reached. Note that the probing process itself can take longer
  336. than the timeout if the HTLC becomes delayed or stuck. Canceling the context
  337. of this call will not cancel the payment loop, the duration is only
  338. controlled by the timeout parameter.
  339. */
  340. uint32 timeout = 4;
  341. }
  342. message RouteFeeResponse {
  343. /*
  344. A lower bound of the estimated fee to the target destination within the
  345. network, expressed in milli-satoshis.
  346. */
  347. int64 routing_fee_msat = 1;
  348. /*
  349. An estimate of the worst case time delay that can occur. Note that callers
  350. will still need to factor in the final CLTV delta of the last hop into this
  351. value.
  352. */
  353. int64 time_lock_delay = 2;
  354. /*
  355. An indication whether a probing payment succeeded or whether and why it
  356. failed. FAILURE_REASON_NONE indicates success.
  357. */
  358. lnrpc.PaymentFailureReason failure_reason = 5;
  359. }
  360. message SendToRouteRequest {
  361. // The payment hash to use for the HTLC.
  362. bytes payment_hash = 1;
  363. // Route that should be used to attempt to complete the payment.
  364. lnrpc.Route route = 2;
  365. /*
  366. Whether the payment should be marked as failed when a temporary error is
  367. returned from the given route. Set it to true so the payment won't be
  368. failed unless a terminal error is occurred, such as payment timeout, no
  369. routes, incorrect payment details, or insufficient funds.
  370. */
  371. bool skip_temp_err = 3;
  372. }
  373. message SendToRouteResponse {
  374. // The preimage obtained by making the payment.
  375. bytes preimage = 1;
  376. // The failure message in case the payment failed.
  377. lnrpc.Failure failure = 2;
  378. }
  379. message ResetMissionControlRequest {
  380. }
  381. message ResetMissionControlResponse {
  382. }
  383. message QueryMissionControlRequest {
  384. }
  385. // QueryMissionControlResponse contains mission control state.
  386. message QueryMissionControlResponse {
  387. reserved 1;
  388. // Node pair-level mission control state.
  389. repeated PairHistory pairs = 2;
  390. }
  391. message XImportMissionControlRequest {
  392. // Node pair-level mission control state to be imported.
  393. repeated PairHistory pairs = 1;
  394. // Whether to force override MC pair history. Note that even with force
  395. // override the failure pair is imported before the success pair and both
  396. // still clamp existing failure/success amounts.
  397. bool force = 2;
  398. }
  399. message XImportMissionControlResponse {
  400. }
  401. // PairHistory contains the mission control state for a particular node pair.
  402. message PairHistory {
  403. // The source node pubkey of the pair.
  404. bytes node_from = 1;
  405. // The destination node pubkey of the pair.
  406. bytes node_to = 2;
  407. reserved 3, 4, 5, 6;
  408. PairData history = 7;
  409. }
  410. message PairData {
  411. // Time of last failure.
  412. int64 fail_time = 1;
  413. /*
  414. Lowest amount that failed to forward rounded to whole sats. This may be
  415. set to zero if the failure is independent of amount.
  416. */
  417. int64 fail_amt_sat = 2;
  418. /*
  419. Lowest amount that failed to forward in millisats. This may be
  420. set to zero if the failure is independent of amount.
  421. */
  422. int64 fail_amt_msat = 4;
  423. reserved 3;
  424. // Time of last success.
  425. int64 success_time = 5;
  426. // Highest amount that we could successfully forward rounded to whole sats.
  427. int64 success_amt_sat = 6;
  428. // Highest amount that we could successfully forward in millisats.
  429. int64 success_amt_msat = 7;
  430. }
  431. message GetMissionControlConfigRequest {
  432. }
  433. message GetMissionControlConfigResponse {
  434. /*
  435. Mission control's currently active config.
  436. */
  437. MissionControlConfig config = 1;
  438. }
  439. message SetMissionControlConfigRequest {
  440. /*
  441. The config to set for mission control. Note that all values *must* be set,
  442. because the full config will be applied.
  443. */
  444. MissionControlConfig config = 1;
  445. }
  446. message SetMissionControlConfigResponse {
  447. }
  448. message MissionControlConfig {
  449. /*
  450. Deprecated, use AprioriParameters. The amount of time mission control will
  451. take to restore a penalized node or channel back to 50% success probability,
  452. expressed in seconds. Setting this value to a higher value will penalize
  453. failures for longer, making mission control less likely to route through
  454. nodes and channels that we have previously recorded failures for.
  455. */
  456. uint64 half_life_seconds = 1 [deprecated = true];
  457. /*
  458. Deprecated, use AprioriParameters. The probability of success mission
  459. control should assign to hop in a route where it has no other information
  460. available. Higher values will make mission control more willing to try hops
  461. that we have no information about, lower values will discourage trying these
  462. hops.
  463. */
  464. float hop_probability = 2 [deprecated = true];
  465. /*
  466. Deprecated, use AprioriParameters. The importance that mission control
  467. should place on historical results, expressed as a value in [0;1]. Setting
  468. this value to 1 will ignore all historical payments and just use the hop
  469. probability to assess the probability of success for each hop. A zero value
  470. ignores hop probability completely and relies entirely on historical
  471. results, unless none are available.
  472. */
  473. float weight = 3 [deprecated = true];
  474. /*
  475. The maximum number of payment results that mission control will store.
  476. */
  477. uint32 maximum_payment_results = 4;
  478. /*
  479. The minimum time that must have passed since the previously recorded failure
  480. before we raise the failure amount.
  481. */
  482. uint64 minimum_failure_relax_interval = 5;
  483. enum ProbabilityModel {
  484. APRIORI = 0;
  485. BIMODAL = 1;
  486. }
  487. /*
  488. ProbabilityModel defines which probability estimator should be used in
  489. pathfinding. Note that the bimodal estimator is experimental.
  490. */
  491. ProbabilityModel model = 6;
  492. /*
  493. EstimatorConfig is populated dependent on the estimator type.
  494. */
  495. oneof EstimatorConfig {
  496. AprioriParameters apriori = 7;
  497. BimodalParameters bimodal = 8;
  498. }
  499. }
  500. message BimodalParameters {
  501. /*
  502. NodeWeight defines how strongly other previous forwardings on channels of a
  503. router should be taken into account when computing a channel's probability
  504. to route. The allowed values are in the range [0, 1], where a value of 0
  505. means that only direct information about a channel is taken into account.
  506. */
  507. double node_weight = 1;
  508. /*
  509. ScaleMsat describes the scale over which channels statistically have some
  510. liquidity left. The value determines how quickly the bimodal distribution
  511. drops off from the edges of a channel. A larger value (compared to typical
  512. channel capacities) means that the drop off is slow and that channel
  513. balances are distributed more uniformly. A small value leads to the
  514. assumption of very unbalanced channels.
  515. */
  516. uint64 scale_msat = 2;
  517. /*
  518. DecayTime describes the information decay of knowledge about previous
  519. successes and failures in channels. The smaller the decay time, the quicker
  520. we forget about past forwardings.
  521. */
  522. uint64 decay_time = 3;
  523. }
  524. message AprioriParameters {
  525. /*
  526. The amount of time mission control will take to restore a penalized node
  527. or channel back to 50% success probability, expressed in seconds. Setting
  528. this value to a higher value will penalize failures for longer, making
  529. mission control less likely to route through nodes and channels that we
  530. have previously recorded failures for.
  531. */
  532. uint64 half_life_seconds = 1;
  533. /*
  534. The probability of success mission control should assign to hop in a route
  535. where it has no other information available. Higher values will make mission
  536. control more willing to try hops that we have no information about, lower
  537. values will discourage trying these hops.
  538. */
  539. double hop_probability = 2;
  540. /*
  541. The importance that mission control should place on historical results,
  542. expressed as a value in [0;1]. Setting this value to 1 will ignore all
  543. historical payments and just use the hop probability to assess the
  544. probability of success for each hop. A zero value ignores hop probability
  545. completely and relies entirely on historical results, unless none are
  546. available.
  547. */
  548. double weight = 3;
  549. /*
  550. The fraction of a channel's capacity that we consider to have liquidity. For
  551. amounts that come close to or exceed the fraction, an additional penalty is
  552. applied. A value of 1.0 disables the capacity factor. Allowed values are in
  553. [0.75, 1.0].
  554. */
  555. double capacity_fraction = 4;
  556. }
  557. message QueryProbabilityRequest {
  558. // The source node pubkey of the pair.
  559. bytes from_node = 1;
  560. // The destination node pubkey of the pair.
  561. bytes to_node = 2;
  562. // The amount for which to calculate a probability.
  563. int64 amt_msat = 3;
  564. }
  565. message QueryProbabilityResponse {
  566. // The success probability for the requested pair.
  567. double probability = 1;
  568. // The historical data for the requested pair.
  569. PairData history = 2;
  570. }
  571. message BuildRouteRequest {
  572. /*
  573. The amount to send expressed in msat. If set to zero, the minimum routable
  574. amount is used.
  575. */
  576. int64 amt_msat = 1;
  577. /*
  578. CLTV delta from the current height that should be used for the timelock
  579. of the final hop
  580. */
  581. int32 final_cltv_delta = 2;
  582. /*
  583. The channel id of the channel that must be taken to the first hop. If zero,
  584. any channel may be used.
  585. */
  586. uint64 outgoing_chan_id = 3 [jstype = JS_STRING];
  587. /*
  588. A list of hops that defines the route. This does not include the source hop
  589. pubkey.
  590. */
  591. repeated bytes hop_pubkeys = 4;
  592. /*
  593. An optional payment addr to be included within the last hop of the route.
  594. This is also called payment secret in specifications (e.g. BOLT 11).
  595. */
  596. bytes payment_addr = 5;
  597. }
  598. message BuildRouteResponse {
  599. /*
  600. Fully specified route that can be used to execute the payment.
  601. */
  602. lnrpc.Route route = 1;
  603. }
  604. message SubscribeHtlcEventsRequest {
  605. }
  606. /*
  607. HtlcEvent contains the htlc event that was processed. These are served on a
  608. best-effort basis; events are not persisted, delivery is not guaranteed
  609. (in the event of a crash in the switch, forward events may be lost) and
  610. some events may be replayed upon restart. Events consumed from this package
  611. should be de-duplicated by the htlc's unique combination of incoming and
  612. outgoing channel id and htlc id. [EXPERIMENTAL]
  613. */
  614. message HtlcEvent {
  615. /*
  616. The short channel id that the incoming htlc arrived at our node on. This
  617. value is zero for sends.
  618. */
  619. uint64 incoming_channel_id = 1;
  620. /*
  621. The short channel id that the outgoing htlc left our node on. This value
  622. is zero for receives.
  623. */
  624. uint64 outgoing_channel_id = 2;
  625. /*
  626. Incoming id is the index of the incoming htlc in the incoming channel.
  627. This value is zero for sends.
  628. */
  629. uint64 incoming_htlc_id = 3;
  630. /*
  631. Outgoing id is the index of the outgoing htlc in the outgoing channel.
  632. This value is zero for receives.
  633. */
  634. uint64 outgoing_htlc_id = 4;
  635. /*
  636. The time in unix nanoseconds that the event occurred.
  637. */
  638. uint64 timestamp_ns = 5;
  639. enum EventType {
  640. UNKNOWN = 0;
  641. SEND = 1;
  642. RECEIVE = 2;
  643. FORWARD = 3;
  644. }
  645. /*
  646. The event type indicates whether the htlc was part of a send, receive or
  647. forward.
  648. */
  649. EventType event_type = 6;
  650. oneof event {
  651. ForwardEvent forward_event = 7;
  652. ForwardFailEvent forward_fail_event = 8;
  653. SettleEvent settle_event = 9;
  654. LinkFailEvent link_fail_event = 10;
  655. SubscribedEvent subscribed_event = 11;
  656. FinalHtlcEvent final_htlc_event = 12;
  657. }
  658. }
  659. message HtlcInfo {
  660. // The timelock on the incoming htlc.
  661. uint32 incoming_timelock = 1;
  662. // The timelock on the outgoing htlc.
  663. uint32 outgoing_timelock = 2;
  664. // The amount of the incoming htlc.
  665. uint64 incoming_amt_msat = 3;
  666. // The amount of the outgoing htlc.
  667. uint64 outgoing_amt_msat = 4;
  668. }
  669. message ForwardEvent {
  670. // Info contains details about the htlc that was forwarded.
  671. HtlcInfo info = 1;
  672. }
  673. message ForwardFailEvent {
  674. }
  675. message SettleEvent {
  676. // The revealed preimage.
  677. bytes preimage = 1;
  678. }
  679. message FinalHtlcEvent {
  680. bool settled = 1;
  681. bool offchain = 2;
  682. }
  683. message SubscribedEvent {
  684. }
  685. message LinkFailEvent {
  686. // Info contains details about the htlc that we failed.
  687. HtlcInfo info = 1;
  688. // FailureCode is the BOLT error code for the failure.
  689. lnrpc.Failure.FailureCode wire_failure = 2;
  690. /*
  691. FailureDetail provides additional information about the reason for the
  692. failure. This detail enriches the information provided by the wire message
  693. and may be 'no detail' if the wire message requires no additional metadata.
  694. */
  695. FailureDetail failure_detail = 3;
  696. // A string representation of the link failure.
  697. string failure_string = 4;
  698. }
  699. enum FailureDetail {
  700. UNKNOWN = 0;
  701. NO_DETAIL = 1;
  702. ONION_DECODE = 2;
  703. LINK_NOT_ELIGIBLE = 3;
  704. ON_CHAIN_TIMEOUT = 4;
  705. HTLC_EXCEEDS_MAX = 5;
  706. INSUFFICIENT_BALANCE = 6;
  707. INCOMPLETE_FORWARD = 7;
  708. HTLC_ADD_FAILED = 8;
  709. FORWARDS_DISABLED = 9;
  710. INVOICE_CANCELED = 10;
  711. INVOICE_UNDERPAID = 11;
  712. INVOICE_EXPIRY_TOO_SOON = 12;
  713. INVOICE_NOT_OPEN = 13;
  714. MPP_INVOICE_TIMEOUT = 14;
  715. ADDRESS_MISMATCH = 15;
  716. SET_TOTAL_MISMATCH = 16;
  717. SET_TOTAL_TOO_LOW = 17;
  718. SET_OVERPAID = 18;
  719. UNKNOWN_INVOICE = 19;
  720. INVALID_KEYSEND = 20;
  721. MPP_IN_PROGRESS = 21;
  722. CIRCULAR_ROUTE = 22;
  723. }
  724. enum PaymentState {
  725. /*
  726. Payment is still in flight.
  727. */
  728. IN_FLIGHT = 0;
  729. /*
  730. Payment completed successfully.
  731. */
  732. SUCCEEDED = 1;
  733. /*
  734. There are more routes to try, but the payment timeout was exceeded.
  735. */
  736. FAILED_TIMEOUT = 2;
  737. /*
  738. All possible routes were tried and failed permanently. Or were no
  739. routes to the destination at all.
  740. */
  741. FAILED_NO_ROUTE = 3;
  742. /*
  743. A non-recoverable error has occurred.
  744. */
  745. FAILED_ERROR = 4;
  746. /*
  747. Payment details incorrect (unknown hash, invalid amt or
  748. invalid final cltv delta)
  749. */
  750. FAILED_INCORRECT_PAYMENT_DETAILS = 5;
  751. /*
  752. Insufficient local balance.
  753. */
  754. FAILED_INSUFFICIENT_BALANCE = 6;
  755. }
  756. message PaymentStatus {
  757. // Current state the payment is in.
  758. PaymentState state = 1;
  759. /*
  760. The pre-image of the payment when state is SUCCEEDED.
  761. */
  762. bytes preimage = 2;
  763. reserved 3;
  764. /*
  765. The HTLCs made in attempt to settle the payment [EXPERIMENTAL].
  766. */
  767. repeated lnrpc.HTLCAttempt htlcs = 4;
  768. }
  769. message CircuitKey {
  770. /// The id of the channel that the is part of this circuit.
  771. uint64 chan_id = 1;
  772. /// The index of the incoming htlc in the incoming channel.
  773. uint64 htlc_id = 2;
  774. }
  775. message ForwardHtlcInterceptRequest {
  776. /*
  777. The key of this forwarded htlc. It defines the incoming channel id and
  778. the index in this channel.
  779. */
  780. CircuitKey incoming_circuit_key = 1;
  781. // The incoming htlc amount.
  782. uint64 incoming_amount_msat = 5;
  783. // The incoming htlc expiry.
  784. uint32 incoming_expiry = 6;
  785. /*
  786. The htlc payment hash. This value is not guaranteed to be unique per
  787. request.
  788. */
  789. bytes payment_hash = 2;
  790. // The requested outgoing channel id for this forwarded htlc. Because of
  791. // non-strict forwarding, this isn't necessarily the channel over which the
  792. // packet will be forwarded eventually. A different channel to the same peer
  793. // may be selected as well.
  794. uint64 outgoing_requested_chan_id = 7;
  795. // The outgoing htlc amount.
  796. uint64 outgoing_amount_msat = 3;
  797. // The outgoing htlc expiry.
  798. uint32 outgoing_expiry = 4;
  799. // Any custom records that were present in the payload.
  800. map<uint64, bytes> custom_records = 8;
  801. // The onion blob for the next hop
  802. bytes onion_blob = 9;
  803. // The block height at which this htlc will be auto-failed to prevent the
  804. // channel from force-closing.
  805. int32 auto_fail_height = 10;
  806. }
  807. /**
  808. ForwardHtlcInterceptResponse enables the caller to resolve a previously hold
  809. forward. The caller can choose either to:
  810. - `Resume`: Execute the default behavior (usually forward).
  811. - `Reject`: Fail the htlc backwards.
  812. - `Settle`: Settle this htlc with a given preimage.
  813. */
  814. message ForwardHtlcInterceptResponse {
  815. /**
  816. The key of this forwarded htlc. It defines the incoming channel id and
  817. the index in this channel.
  818. */
  819. CircuitKey incoming_circuit_key = 1;
  820. // The resolve action for this intercepted htlc.
  821. ResolveHoldForwardAction action = 2;
  822. // The preimage in case the resolve action is Settle.
  823. bytes preimage = 3;
  824. // Encrypted failure message in case the resolve action is Fail.
  825. //
  826. // If failure_message is specified, the failure_code field must be set
  827. // to zero.
  828. bytes failure_message = 4;
  829. // Return the specified failure code in case the resolve action is Fail. The
  830. // message data fields are populated automatically.
  831. //
  832. // If a non-zero failure_code is specified, failure_message must not be set.
  833. //
  834. // For backwards-compatibility reasons, TEMPORARY_CHANNEL_FAILURE is the
  835. // default value for this field.
  836. lnrpc.Failure.FailureCode failure_code = 5;
  837. }
  838. enum ResolveHoldForwardAction {
  839. SETTLE = 0;
  840. FAIL = 1;
  841. RESUME = 2;
  842. }
  843. message UpdateChanStatusRequest {
  844. lnrpc.ChannelPoint chan_point = 1;
  845. ChanStatusAction action = 2;
  846. }
  847. enum ChanStatusAction {
  848. ENABLE = 0;
  849. DISABLE = 1;
  850. AUTO = 2;
  851. }
  852. message UpdateChanStatusResponse {
  853. }