mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-09 20:33:45 +01:00
channeldb+routing: store all payment htlcs
This commit converts the database structure of a payment so that it can not just store the last htlc attempt, but all attempts that have been made. This is a preparation for mpp sending. In addition to that, we now also persist the fail time of an htlc. In a later commit, the full failure reason will be added as well. A key change is made to the control tower interface. Previously the control tower wasn't aware of individual htlc outcomes. The payment remained in-flight with the latest attempt recorded, but an outcome was only set when the payment finished. With this commit, the outcome of every htlc is expected by the control tower and recorded in the database. Co-authored-by: Johan T. Halseth <johanth@gmail.com>
This commit is contained in:
@@ -541,7 +541,14 @@ func (r *ChannelRouter) Start() error {
|
||||
PaymentHash: payment.Info.PaymentHash,
|
||||
}
|
||||
|
||||
_, _, err := r.sendPayment(payment.Attempt, lPayment, paySession)
|
||||
// TODO(joostjager): For mpp, possibly relaunch multiple
|
||||
// in-flight htlcs here.
|
||||
var attempt *channeldb.HTLCAttemptInfo
|
||||
if len(payment.Attempts) > 0 {
|
||||
attempt = &payment.Attempts[0]
|
||||
}
|
||||
|
||||
_, _, err := r.sendPayment(attempt, lPayment, paySession)
|
||||
if err != nil {
|
||||
log.Errorf("Resuming payment with hash %v "+
|
||||
"failed: %v.", payment.Info.PaymentHash, err)
|
||||
|
||||
Reference in New Issue
Block a user