channeldb: rename PaymentAttemptInfo to HTLCAttemptInfo

To better distinguish payments from HTLCs, we rename the attempt info
struct to HTLCAttemptInfo. We also embed it into the HTLCAttempt struct,
to avoid having to duplicate this information.

The paymentID term is renamed to attemptID.
This commit is contained in:
Johan T. Halseth authored and Joost Jager committed 2020-03-09 11:43:26 +01:00
1 parent 967b4b2dc3
commit bee2380441
10 files changed
+75 -88

No files matched your search

+15 -9
View File
@@ -8,16 +8,15 @@ import (
"github.com/lightningnetwork/lnd/routing/route"
)
// HTLCAttempt contains information about a specific HTLC attempt for a given
// payment. This information is used by the router to handle any errors coming
// back after an attempt is made, and to query the switch about the status of a
// payment. For settled payment this will be the information for the succeeding
// payment attempt.
type HTLCAttempt struct {
// PaymentID is the unique ID used for this attempt.
PaymentID uint64
// HTLCAttemptInfo contains static information about a specific HTLC attempt
// for a payment. This information is used by the router to handle any errors
// coming back after an attempt is made, and to query the switch about the
// status of the attempt.
type HTLCAttemptInfo struct {
// AttemptID is the unique ID used for this attempt.
AttemptID uint64
// SessionKey is the ephemeral key used for this payment attempt.
// SessionKey is the ephemeral key used for this attempt.
SessionKey *btcec.PrivateKey
// Route is the route attempted to send the HTLC.
@@ -25,6 +24,13 @@ type HTLCAttempt struct {
// AttemptTime is the time at which this HTLC was attempted.
AttemptTime time.Time
}
// HTLCAttempt contains information about a specific HTLC attempt for a given
// payment. It contains the HTLCAttemptInfo used to send the HTLC, as well
// as a timestamp and any known outcome of the attempt.
type HTLCAttempt struct {
HTLCAttemptInfo
// Settle is the preimage of a successful payment. This serves as a
// proof of payment. It will only be non-nil for settled payments.