htlcswitch+router: define PaymentResult, GetPaymentResult
This lets us distinguish an critical error from a actual payment result (success or failure). This is important since we know that we can only attempt another payment when a final result from the previous payment attempt is received.
This commit is contained in:
7 files changed
+251
-68
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package htlcswitch
|
||||
|
||||
import "errors"
|
||||
|
||||
var (
|
||||
// ErrPaymentIDNotFound is an error returned if the given paymentID is
|
||||
// not found.
|
||||
ErrPaymentIDNotFound = errors.New("paymentID not found")
|
||||
|
||||
// ErrPaymentIDAlreadyExists is returned if we try to write a pending
|
||||
// payment whose paymentID already exists.
|
||||
ErrPaymentIDAlreadyExists = errors.New("paymentID already exists")
|
||||
)
|
||||
|
||||
// PaymentResult wraps a result received from the network after a payment
|
||||
// attempt was made.
|
||||
type PaymentResult struct {
|
||||
// Preimage is set by the switch in case a sent HTLC was settled.
|
||||
Preimage [32]byte
|
||||
|
||||
// Error is non-nil in case a HTLC send failed, and the HTLC is now
|
||||
// irrevocably cancelled. If the payment failed during forwarding, this
|
||||
// error will be a *ForwardingError.
|
||||
Error error
|
||||
}
|
||||
Reference in new issue
Block a user