2024-01-15 13:35:14 -08:00
{
"$schema" : "../rpc-schema-draft.json" ,
"type" : "object" ,
"rpc" : "sendpay" ,
"title" : "Low-level command for sending a payment via a route" ,
"description" : [
"The **sendpay** RPC command attempts to send funds associated with the given *payment_hash*, along a route to the final destination in the route." ,
"" ,
"Generally, a client would call lightning-getroute(7) to resolve a route, then use **sendpay** to send it. If it fails, it would call lightning-getroute(7) again to retry. If the route is empty, a payment-to-self is attempted." ,
"" ,
"The response will occur when the payment is on its way to the destination. The **sendpay** RPC command does not wait for definite success or definite failure of the payment (except for already-succeeded payments, or to-self payments). Instead, use the **waitsendpay** RPC command to poll or wait for definite success or definite failure." ,
"" ,
"Once a payment has succeeded, calls to **sendpay** with the same *payment_hash* but a different *amount_msat* or destination will fail; this prevents accidental multiple payments. Calls to **sendpay** with the same *payment_hash*, *amount_msat*, and destination as a previous successful payment (even if a different route or *partid*) will return immediately with success."
] ,
"request" : {
"required" : [
"route" ,
"payment_hash"
] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"properties" : {
"route" : {
"type" : "array" ,
"items" : {
"type" : "object" ,
"required" : [
"amount_msat" ,
"id" ,
"delay" ,
"channel"
] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : true ,
2024-01-15 13:35:14 -08:00
"properties" : {
"id" : {
"type" : "pubkey" ,
"description" : [
"The node at the end of this hop."
]
} ,
"channel" : {
"type" : "short_channel_id" ,
"description" : [
"The channel joining these nodes."
]
} ,
"delay" : {
"type" : "u32" ,
"description" : [
"The total CLTV expected by the node at the end of this hop."
]
} ,
"amount_msat" : {
"type" : "msat" ,
"description" : [
"The amount expected by the node at the end of this hop."
]
}
}
}
} ,
"payment_hash" : {
"type" : "hash" ,
"description" : [
"The hash of the payment_preimage."
]
} ,
"label" : {
"type" : "string" ,
"description" : [
"The label provided when creating the invoice_request."
]
} ,
"amount_msat" : {
"type" : "msat" ,
"description" : [
"Amount must be provided if *partid* is non-zero, or the payment is to-self, otherwise it must be equal to the final amount to the destination. it can be a whole number, or a whole number ending in *msat* or *sat*, or a number with three decimal places ending in *sat*, or a number with 1 to 11 decimal places ending in *btc*."
] ,
"default" : "in millisatoshi precision"
} ,
"bolt11" : {
"type" : "string" ,
"description" : [
"Bolt11 invoice to pay. If provided, will be returned in *waitsendpay* and *listsendpays* results."
]
} ,
"payment_secret" : {
"type" : "secret" ,
"description" : [
"Value that the final recipient requires to accept the payment, as defined by the `payment_data` field in BOLT 4 and the `s` field in the BOLT 11 invoice format. It is required if *partid* is non-zero."
]
} ,
"partid" : {
"type" : "u64" ,
"description" : [
"Must not be provided for self-payments. If provided and non-zero, allows for multiple parallel partial payments with the same *payment_hash*. The *amount_msat* amount (which must be provided) for each **sendpay** with matching *payment_hash* must be equal, and **sendpay** will fail if there are differing values given."
]
} ,
"localinvreqid" : {
"type" : "hex" ,
"description" : [
"Indicates that this payment is being made for a local invoice_request. This ensures that we only send a payment for a single-use invoice_request once."
]
} ,
"groupid" : {
"type" : "u64" ,
"description" : [
"Allows you to attach a number which appears in **listsendpays** so payments can be identified as part of a logical group. The *pay* plugin uses this to identify one attempt at a MPP payment, for example."
]
} ,
"payment_metadata" : {
"added" : "v0.11.0" ,
"type" : "hex" ,
"description" : [
"Placed in the final onion hop TLV."
]
} ,
"description" : {
"added" : "v0.11.0" ,
"type" : "string" ,
"description" : [
"Description used in the invoice."
]
doc: fix up missing fields from schemas.
This allows the next patch (which makes the schemas stricter) to not
break our tests.
We add some missing fields (including dev fields, but they're empty and hidden),
and add a few minor clarifications and a spelling fix. Most of these are new
schemas for this release, so no mention in Changelog.
Here is the difference in the man pages:
--- doc/lightning-askrene-inform-channel.7.md.old 2024-10-29 17:33:07.714521584 +1030
+++ doc/lightning-askrene-inform-channel.7.md 2024-10-29 17:42:37.434280109 +1030
@@ -24,6 +24,8 @@
- **short\_channel\_id\_dir** (short\_channel\_id\_dir): The short channel id and direction
+- **layer** (string): The name of the layer to apply this change to.
+- **timestamp** (u64): The UNIX timestamp when this constraint was created.
- **maximum\_msat** (msat, optional): The maximum value which this channel could pass.
--- doc/lightning-askrene-listlayers.7.md.old 2024-10-29 17:33:07.716521571 +1030
+++ doc/lightning-askrene-listlayers.7.md 2024-10-29 17:42:37.424280316 +1030
@@ -29,13 +29,16 @@
- **channel\_updates** (array of objects):
+ - **short\_channel\_id\_dir** (short\_channel\_id\_dir): The short channel id and direction this update applies to.
+ - **enabled** (boolean, optional): True if this can be used, false otherwise.
- **htlc\_minimum\_msat** (msat, optional): The minimum value allowed in this direction.
- **htlc\_maximum\_msat** (msat, optional): The maximum value allowed in this direction.
- **fee\_base\_msat** (msat, optional): The base fee to apply to use the channel in this direction.
- **fee\_proportional\_millionths** (u32, optional): The proportional fee (in parts per million) to apply to use the channel in this direction.
- - **delay** (u16, optional): The CLTV delay required for this direction.
+ - **cltv\_expiry\_delta** (u16, optional): The CLTV delay required for this direction.
- **constraints** (array of objects):
- **short\_channel\_id\_dir** (short\_channel\_id\_dir): The short channel id and direction
+ - **timestamp** (u64, optional): The UNIX timestamp when this constraint was created.
- **maximum\_msat** (msat, optional): The maximum value which this channel could pass.
--- doc/lightning-askrene-listreservations.7.md.old 2024-10-29 17:33:07.719521550 +1030
+++ doc/lightning-askrene-listreservations.7.md 2024-10-29 17:42:37.428280233 +1030
@@ -16,7 +16,7 @@
-On success, an object containing **layers** is returned. It is an array of objects, where each object contains:
+On success, an object containing **reservations** is returned. It is an array of objects, where each object contains:
--- doc/lightning-autoclean-status.7.md.old 2024-10-29 17:33:07.732521462 +1030
+++ doc/lightning-autoclean-status.7.md 2024-10-29 17:42:37.441279965 +1030
@@ -9,7 +9,7 @@
-The **autoclean-status** RPC command tells you about the status of the autclean plugin, optionally for only one subsystem.
+The **autoclean-status** RPC command tells you about the status of the autoclean plugin, optionally for only one subsystem.
--- doc/lightning-renepay.7.md.old 2024-10-29 17:33:07.927520140 +1030
+++ doc/lightning-renepay.7.md 2024-10-29 17:42:37.996268504 +1030
@@ -58,6 +58,9 @@
- **status** (string) (one of "complete", "pending", "failed"): Status of payment.
+- **bolt11** (string, optional): The bolt11 invoice paid. *(added v23.08)*
+- **bolt12** (string, optional): The bolt12 invoice paid. *(added v23.08)*
+- **groupid** (u64, optional): The groupid used for these payment parts (as can be seen in listsendpays) *(added v23.08)*
- **destination** (pubkey, optional): The final destination of the payment.
--- doc/lightning-sendonion.7.md.old 2024-10-29 17:33:07.937520073 +1030
+++ doc/lightning-sendonion.7.md 2024-10-29 17:42:37.957269309 +1030
@@ -22,7 +22,7 @@
-- **first\_hop** (object): Instructs Core Lightning which peer to send the onion to. It is a JSON dictionary that corresponds to the first element of the route array returned by *getroute*.:
+- **first\_hop** (object): Instructs Core Lightning which peer to send the onion to. It is a JSON dictionary that corresponds to the first element of the route array returned by *getroute* (so fields not mentioned here are ignored).:
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: `renepay` return fields documented in schema (`bolt11`, `bolt12` and `groupid`)
2024-10-29 17:50:40 +10:30
} ,
"dev_legacy_hop" : {
"hidden" : true
2024-01-15 13:35:14 -08:00
}
}
} ,
"response" : {
"required" : [
"id" ,
"created_index" ,
"payment_hash" ,
"status" ,
"created_at" ,
"amount_sent_msat"
] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"properties" : {
"created_index" : {
"added" : "v23.11" ,
"type" : "u64" ,
"description" : [
"1-based index indicating order this payment was created in."
]
} ,
"updated_index" : {
"added" : "v23.11" ,
"type" : "u64" ,
"description" : [
"1-based index indicating order this payment was changed (only present if it has changed since creation)."
]
} ,
"id" : {
"type" : "u64" ,
"description" : [
"Old synonym for created_index."
]
} ,
"groupid" : {
"type" : "u64" ,
"description" : [
"Grouping key to disambiguate multiple attempts to pay an invoice or the same payment_hash."
]
} ,
"payment_hash" : {
"type" : "hash" ,
"description" : [
"The hash of the *payment_preimage* which will prove payment."
]
} ,
"status" : {
"type" : "string" ,
"enum" : [
"pending" ,
"complete"
] ,
"description" : [
"Status of the payment (could be complete if already sent previously)."
]
} ,
"amount_msat" : {
"type" : "msat" ,
"description" : [
"The amount delivered to destination (if known)."
]
} ,
"destination" : {
"type" : "pubkey" ,
"description" : [
"The final destination of the payment if known."
]
} ,
"created_at" : {
"type" : "u64" ,
"description" : [
"The UNIX timestamp showing when this payment was initiated."
]
} ,
"completed_at" : {
"type" : "u64" ,
"description" : [
"The UNIX timestamp showing when this payment was completed."
]
} ,
"amount_sent_msat" : {
"type" : "msat" ,
"description" : [
"The amount sent."
]
} ,
"label" : {
"type" : "string" ,
"description" : [
"The *label*, if given to sendpay."
]
} ,
"partid" : {
"type" : "u64" ,
"description" : [
"The *partid*, if given to sendpay."
]
} ,
"bolt11" : {
"type" : "string" ,
"description" : [
"The bolt11 string (if supplied)."
]
} ,
"bolt12" : {
"type" : "string" ,
"description" : [
"The bolt12 string (if supplied: **experimental-offers** only)."
]
doc: fix up missing fields from schemas.
This allows the next patch (which makes the schemas stricter) to not
break our tests.
We add some missing fields (including dev fields, but they're empty and hidden),
and add a few minor clarifications and a spelling fix. Most of these are new
schemas for this release, so no mention in Changelog.
Here is the difference in the man pages:
--- doc/lightning-askrene-inform-channel.7.md.old 2024-10-29 17:33:07.714521584 +1030
+++ doc/lightning-askrene-inform-channel.7.md 2024-10-29 17:42:37.434280109 +1030
@@ -24,6 +24,8 @@
- **short\_channel\_id\_dir** (short\_channel\_id\_dir): The short channel id and direction
+- **layer** (string): The name of the layer to apply this change to.
+- **timestamp** (u64): The UNIX timestamp when this constraint was created.
- **maximum\_msat** (msat, optional): The maximum value which this channel could pass.
--- doc/lightning-askrene-listlayers.7.md.old 2024-10-29 17:33:07.716521571 +1030
+++ doc/lightning-askrene-listlayers.7.md 2024-10-29 17:42:37.424280316 +1030
@@ -29,13 +29,16 @@
- **channel\_updates** (array of objects):
+ - **short\_channel\_id\_dir** (short\_channel\_id\_dir): The short channel id and direction this update applies to.
+ - **enabled** (boolean, optional): True if this can be used, false otherwise.
- **htlc\_minimum\_msat** (msat, optional): The minimum value allowed in this direction.
- **htlc\_maximum\_msat** (msat, optional): The maximum value allowed in this direction.
- **fee\_base\_msat** (msat, optional): The base fee to apply to use the channel in this direction.
- **fee\_proportional\_millionths** (u32, optional): The proportional fee (in parts per million) to apply to use the channel in this direction.
- - **delay** (u16, optional): The CLTV delay required for this direction.
+ - **cltv\_expiry\_delta** (u16, optional): The CLTV delay required for this direction.
- **constraints** (array of objects):
- **short\_channel\_id\_dir** (short\_channel\_id\_dir): The short channel id and direction
+ - **timestamp** (u64, optional): The UNIX timestamp when this constraint was created.
- **maximum\_msat** (msat, optional): The maximum value which this channel could pass.
--- doc/lightning-askrene-listreservations.7.md.old 2024-10-29 17:33:07.719521550 +1030
+++ doc/lightning-askrene-listreservations.7.md 2024-10-29 17:42:37.428280233 +1030
@@ -16,7 +16,7 @@
-On success, an object containing **layers** is returned. It is an array of objects, where each object contains:
+On success, an object containing **reservations** is returned. It is an array of objects, where each object contains:
--- doc/lightning-autoclean-status.7.md.old 2024-10-29 17:33:07.732521462 +1030
+++ doc/lightning-autoclean-status.7.md 2024-10-29 17:42:37.441279965 +1030
@@ -9,7 +9,7 @@
-The **autoclean-status** RPC command tells you about the status of the autclean plugin, optionally for only one subsystem.
+The **autoclean-status** RPC command tells you about the status of the autoclean plugin, optionally for only one subsystem.
--- doc/lightning-renepay.7.md.old 2024-10-29 17:33:07.927520140 +1030
+++ doc/lightning-renepay.7.md 2024-10-29 17:42:37.996268504 +1030
@@ -58,6 +58,9 @@
- **status** (string) (one of "complete", "pending", "failed"): Status of payment.
+- **bolt11** (string, optional): The bolt11 invoice paid. *(added v23.08)*
+- **bolt12** (string, optional): The bolt12 invoice paid. *(added v23.08)*
+- **groupid** (u64, optional): The groupid used for these payment parts (as can be seen in listsendpays) *(added v23.08)*
- **destination** (pubkey, optional): The final destination of the payment.
--- doc/lightning-sendonion.7.md.old 2024-10-29 17:33:07.937520073 +1030
+++ doc/lightning-sendonion.7.md 2024-10-29 17:42:37.957269309 +1030
@@ -22,7 +22,7 @@
-- **first\_hop** (object): Instructs Core Lightning which peer to send the onion to. It is a JSON dictionary that corresponds to the first element of the route array returned by *getroute*.:
+- **first\_hop** (object): Instructs Core Lightning which peer to send the onion to. It is a JSON dictionary that corresponds to the first element of the route array returned by *getroute* (so fields not mentioned here are ignored).:
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: `renepay` return fields documented in schema (`bolt11`, `bolt12` and `groupid`)
2024-10-29 17:50:40 +10:30
} ,
"message" : { } ,
"payment_preimage" : { }
2024-01-15 13:35:14 -08:00
} ,
"allOf" : [
{
"if" : {
2024-10-30 09:38:42 +10:30
"additionalProperties" : true ,
2024-01-15 13:35:14 -08:00
"properties" : {
"status" : {
"type" : "string" ,
"enum" : [
"complete"
]
}
}
} ,
"then" : {
"additionalProperties" : false ,
"required" : [
"payment_preimage"
] ,
"properties" : {
"id" : { } ,
"created_index" : { } ,
"updated_index" : { } ,
"groupid" : { } ,
"payment_hash" : { } ,
"status" : { } ,
"msatoshi" : { } ,
"amount_msat" : { } ,
"destination" : { } ,
"created_at" : { } ,
"completed_at" : { } ,
"msatoshi_sent" : { } ,
"amount_sent_msat" : { } ,
"label" : { } ,
"partid" : { } ,
"bolt11" : { } ,
"bolt12" : { } ,
"payment_preimage" : {
"type" : "secret" ,
"description" : [
"The proof of payment: SHA256 of this **payment_hash**."
]
}
}
}
} ,
{
"if" : {
2024-10-30 09:38:42 +10:30
"additionalProperties" : true ,
2024-01-15 13:35:14 -08:00
"properties" : {
"status" : {
"type" : "string" ,
"enum" : [
"pending"
]
}
}
} ,
"then" : {
"additionalProperties" : false ,
"required" : [
"message"
] ,
"properties" : {
"id" : { } ,
"created_index" : { } ,
"updated_index" : { } ,
"groupid" : { } ,
"payment_hash" : { } ,
"status" : { } ,
"msatoshi" : { } ,
"amount_msat" : { } ,
"destination" : { } ,
"created_at" : { } ,
"completed_at" : { } ,
"msatoshi_sent" : { } ,
"amount_sent_msat" : { } ,
"label" : { } ,
"partid" : { } ,
"bolt11" : { } ,
"bolt12" : { } ,
"message" : {
"type" : "string" ,
"description" : [
"Monitor status with listpays or waitsendpay."
]
}
}
}
}
]
} ,
"errors" : [
"On error, if the error occurred from a node other than the final destination, the route table will be updated so that lightning-getroute(7) should return an alternate route (if any). An error from the final destination implies the payment should not be retried." ,
"" ,
"- -1: Catchall nonspecific error." ,
"- 201: Already paid with this *hash* using different amount or destination." ,
"- 202: Unparseable onion reply. The *data* field of the error will have an *onionreply* field, a hex string representation of the raw onion reply." ,
"- 203: Permanent failure at destination. The *data* field of the error will be routing failure object." ,
"- 204: Failure along route; retry a different route. The *data* field of the error will be routing failure object." ,
"- 212: *localinvreqid* refers to an invalid, or used, local invoice_request." ,
"" ,
"A routing failure object has the fields below:" ,
"" ,
"*erring_index*: The index of the node along the route that reported the error. 0 for the local node, 1 for the first hop, and so on." ,
"*erring_node*: The hex string of the pubkey id of the node that reported the error." ,
"*erring_channel*: The short channel ID of the channel that has the error, or *0:0:0* if the destination node raised the error. In addition *erring_direction* will indicate which direction of the channel caused the failure." ,
"*failcode*: The failure code, as per BOLT #4." ,
"*channel_update*: The hex string of the *channel_update* message received from the remote node. Only present if error is from the remote node and the *failcode* has the UPDATE bit set, as per BOLT #4."
] ,
2024-06-20 14:57:02 -07:00
"author" : [
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
] ,
"see_also" : [
"lightning-listinvoices(7)" ,
"lightning-delinvoice(7)" ,
"lightning-getroute(7)" ,
"lightning-invoice(7)" ,
"lightning-pay(7)" ,
"lightning-waitsendpay(7)"
] ,
"resources" : [
"Main web site: <https://github.com/ElementsProject/lightning>"
] ,
"examples" : [
2024-01-15 13:35:14 -08:00
{
2024-03-27 18:45:18 -07:00
"request" : {
"id" : "example:sendpay#1" ,
"method" : "sendpay" ,
"params" : {
"route" : [
{
"id" : "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59" ,
2024-07-18 00:28:22 -07:00
"channel" : "109x1x1" ,
2024-03-27 18:45:18 -07:00
"direction" : 1 ,
2024-07-18 00:28:22 -07:00
"amount_msat" : 10001 ,
"delay" : 15 ,
"style" : "tlv"
2024-03-27 18:45:18 -07:00
} ,
{
"id" : "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d" ,
2024-07-18 00:28:22 -07:00
"channel" : "111x1x0" ,
2024-03-27 18:45:18 -07:00
"direction" : 0 ,
2024-07-18 00:28:22 -07:00
"amount_msat" : 10000 ,
"delay" : 9 ,
"style" : "tlv"
2024-03-27 18:45:18 -07:00
}
] ,
2024-07-18 00:28:22 -07:00
"payment_hash" : "d598cfc62da16b381b8fb8af9833a24005f730e54cc32c317fecc511ffc6d2a2" ,
"payment_secret" : "64733783b118ff27576f72c473c0c52814f1f47c4de41492194ddd7855486024"
2024-03-27 18:45:18 -07:00
}
} ,
"response" : {
"message" : "Monitor status with listpays or waitsendpay" ,
"created_index" : 2 ,
"id" : 2 ,
2024-07-18 00:28:22 -07:00
"payment_hash" : "d598cfc62da16b381b8fb8af9833a24005f730e54cc32c317fecc511ffc6d2a2" ,
2024-03-27 18:45:18 -07:00
"groupid" : 1 ,
2024-07-18 00:28:22 -07:00
"destination" : "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d" ,
"amount_msat" : 10000 ,
"amount_sent_msat" : 10001 ,
"created_at" : 1722303675 ,
2024-03-27 18:45:18 -07:00
"status" : "pending"
2024-01-15 13:35:14 -08:00
}
}
]
}