mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-23 15:00:34 +01:00
This appears in listsendpays / listpays, and is useful information (if we know!). This doesn't fix old payments, but means that xpay can use this for new payments. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
166 lines
8.5 KiB
JSON
166 lines
8.5 KiB
JSON
{
|
|
"$schema": "../rpc-schema-draft.json",
|
|
"type": "object",
|
|
"rpc": "injectpaymentonion",
|
|
"title": "Send a payment with a custom onion packet",
|
|
"description": [
|
|
"The **injectpaymentonion** RPC command causes the node to receive a payment attempt similar to the way it would receive one from a peer. The onion packet is unwrapped, then handled normally: either as a local payment, or forwarded to the next peer.",
|
|
"Compared to lightning-sendonion(7): the handling of blinded paths and self-payments is trivial, and the interface blocks until the payment succeeds or fails. The call also fails if this payment_hash has already been successfully paid."
|
|
],
|
|
"request": {
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"onion",
|
|
"payment_hash",
|
|
"amount_msat",
|
|
"cltv_expiry",
|
|
"partid",
|
|
"groupid"
|
|
],
|
|
"properties": {
|
|
"onion": {
|
|
"type": "hex",
|
|
"description": [
|
|
"Hex-encoded 1366 bytes long blob that was returned by either of the tools that can generate onions. It contains the payloads destined for each hop and some metadata. Please refer to [BOLT 04][bolt04] for further details. If is specific to the route that is being used and the *payment_hash* used to construct, and therefore cannot be reused for other payments or to attempt a separate route. The custom onion can generally be created using the `devtools/onion` CLI tool, or the **createonion** RPC command."
|
|
]
|
|
},
|
|
"payment_hash": {
|
|
"type": "hash",
|
|
"description": [
|
|
"Specifies the 32 byte hex-encoded hash to use as a challenge to the HTLC that we are sending. It is specific to the onion and has to match the one the onion was created with."
|
|
]
|
|
},
|
|
"amount_msat": {
|
|
"type": "msat",
|
|
"description": [
|
|
"The amount for the first HTLC in millisatoshis. This is also the amount which will be forwarded to the first peer (if any) as we do not charge fees on our own payments. Note: this is shown in listsendpays as `amount_sent_msat`."
|
|
]
|
|
},
|
|
"cltv_expiry": {
|
|
"type": "u16",
|
|
"description": [
|
|
"The cltv_expiry for the first HTLC in blocks. This must be greater than the current blockheight."
|
|
]
|
|
},
|
|
"partid": {
|
|
"type": "u64",
|
|
"description": [
|
|
"The non-zero identifier for multiple parallel partial payments with the same *payment_hash*."
|
|
]
|
|
},
|
|
"groupid": {
|
|
"type": "u64",
|
|
"description": [
|
|
"Grouping key to disambiguate multiple attempts to pay the same *payment_hash*. All payments in other groups must be completed before starting a new group."
|
|
]
|
|
},
|
|
"label": {
|
|
"type": "string",
|
|
"description": [
|
|
"Can be used to provide a human readable reference to retrieve the payment at a later time."
|
|
]
|
|
},
|
|
"invstring": {
|
|
"type": "string",
|
|
"description": [
|
|
"Usually a bolt11 or bolt12 string, which, it will be returned in *waitsendpay* and *listsendpays* results."
|
|
]
|
|
},
|
|
"localinvreqid": {
|
|
"type": "hash",
|
|
"description": [
|
|
"`localinvreqid` is used by offers to link a payment attempt to a local `invoice_request` offer created by lightningd-invoicerequest(7)."
|
|
]
|
|
},
|
|
"destination_msat": {
|
|
"type": "msat",
|
|
"added": "v24.11.1",
|
|
"description": [
|
|
"Amount that is actually delivered to the destination (i.e. `amount_msat` minus fees), for showing in listsendpays (confusingly, as `amount_msat`)."
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"response": {
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"created_index",
|
|
"created_at",
|
|
"completed_at",
|
|
"payment_preimage"
|
|
],
|
|
"properties": {
|
|
"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."
|
|
]
|
|
},
|
|
"created_index": {
|
|
"type": "u64",
|
|
"description": [
|
|
"1-based index indicating order this payment was created in."
|
|
]
|
|
},
|
|
"payment_preimage": {
|
|
"added": "v24.11",
|
|
"type": "secret",
|
|
"description": [
|
|
"The proof of payment: SHA256 of this is the invoice's **payment_hash**."
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"errors": [
|
|
"The following error codes may occur:",
|
|
"",
|
|
"- 218: injectpaymentonion failed",
|
|
"",
|
|
"The *onionreply* is returned in the error *data*, which can be unwrapped to discover the error",
|
|
"",
|
|
"- 219: injectpaymentonion already succeeded",
|
|
"",
|
|
"The *data* object contains the previous success, as per lightning-sendpay."
|
|
],
|
|
"author": [
|
|
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
|
|
],
|
|
"see_also": [
|
|
"lightning-createonion(7)",
|
|
"lightning-sendonion(7)",
|
|
"lightning-listsendpays(7)"
|
|
],
|
|
"resources": [
|
|
"Main web site: <https://github.com/ElementsProject/lightning>",
|
|
"",
|
|
"[bolt04]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md"
|
|
],
|
|
"examples": [
|
|
{
|
|
"request": {
|
|
"id": "example:injectpaymentonion#1",
|
|
"method": "injectpaymentonion",
|
|
"params": {
|
|
"onion": "onion30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030",
|
|
"payment_hash": "paymenthashinvl0270027002700270027002700270027002700270027002700",
|
|
"amount_msat": 1000,
|
|
"cltv_expiry": 144,
|
|
"partid": 1,
|
|
"groupid": 0
|
|
}
|
|
},
|
|
"response": {
|
|
"created_index": 12,
|
|
"created_at": 1738000000,
|
|
"completed_at": 1739000000,
|
|
"payment_preimage": "paymentpreimgio1030303030303030303030303030303030303030303030303"
|
|
}
|
|
}
|
|
]
|
|
}
|