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