'\" t
. \" Title: lightning-sendpay
. \" Author: [see the "AUTHOR" section]
. \" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
. \" Date: 02/06/2018
. \" Manual: \ \&
. \" Source: \ \&
. \" Language: English
. \"
.TH "LIGHTNING\-SENDPAY" "7" "02/06/2018" "\ \&" "\ \&"
. \" -----------------------------------------------------------------
. \" * Define some portability stuff
. \" -----------------------------------------------------------------
. \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. \" http://bugs.debian.org/507673
. \" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
. \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n (.g .ds Aq \(aq
.el .ds Aq '
. \" -----------------------------------------------------------------
. \" * set default formatting
. \" -----------------------------------------------------------------
. \" disable hyphenation
.nh
. \" disable justification (adjust text to left margin only)
.ad l
. \" -----------------------------------------------------------------
. \" * MAIN CONTENT STARTS HERE *
. \" -----------------------------------------------------------------
.SH "NAME"
lightning-sendpay \- Protocol for sending a payment via a route\& .
.SH "SYNOPSIS"
.sp
\fB sendpay\fR \fI route\fR \fI hash\fR
.SH "DESCRIPTION"
.sp
The \fB sendpay\fR RPC command attempts to send funds associated with the given \fI hash\fR , along a route to the final destination in the route\& .
.sp
Generally, a client would call getroute(7) to resolve a route, then use \fB sendpay\fR to send it\& . If it fails, it would call getroute(7) again to retry\& .
.sp
The response will occur when the payment fails or succeeds\& . Once a payment has succeeded, calls to \fB sendpay\fR with the same \fI hash\fR will fail; this prevents accidental multiple payments\& .
.SH "RETURN VALUE"
.sp
On success, a \fI preimage\fR hex string is returned as proof that the destination received the payment\& . The \fI preimage\fR will SHA256 to the \fI hash\fR given by the caller\& .
.sp
On error, if the error occurred from a node other than the final destination, the route table will be updated so that getroute(7) should return an alternate route (if any)\& . An error from the final destination implies the payment should not be retried\& .
.sp
The following error codes may occur:
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\- 1\& . Catchall nonspecific error\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
200\& . A previous
\fB sendpay\fR
or
\fB pay\fR
is in progress\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
201\& . Already paid with this
\fI hash\fR
using different amount or destination\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
202\& . Unparseable onion reply\& . The
\fI data\fR
field of the error will have an
\fI onionreply\fR
field, a hex string representation of the raw onion reply\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
203\& . Permanent failure at destination\& . The
\fI data\fR
field of the error will be routing failure object\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
204\& . Failure along route; retry a different route\& . The
\fI data\fR
field of the error will be routing failure object\& .
.RE
.sp
A routing failure object has the fields below:
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI erring_index\fR \& . 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\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI erring_node\fR \& . The hex string of the pubkey id of the node that reported the error\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI erring_channel\fR \& . The short channel ID of the channel that has the error, or
\fI 0:0:0\fR
if the destination node raised the error\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI failcode\fR \& . The failure code, as per BOLT #4\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI channel_update\fR \& . The hex string of the
\fI channel_update\fR
message received from the remote node\& . Only present if error is from the remote node and the
\fI failcode\fR
has the UPDATE bit set, as per BOLT #4\& .
.RE
.SH "AUTHOR"
.sp
Rusty Russell <rusty@rustcorp\& .com\& .au> is mainly responsible\& .
.SH "SEE ALSO"
.sp
lightning\- listinvoice(7), lightning\- delinvoice(7), lightning\- getroute(7), lightning\- invoice(7)\& .
.SH "RESOURCES"
.sp
Main web site: https://github\& .com/ElementsProject/lightning