Merge pull request #4801 from halseth/router-lifecycle-logs
[logging] add more logging for failed payment shards
This commit is contained in:
commit
ef503bf14e
@ -128,6 +128,8 @@ func (store *networkResultStore) storeResult(paymentID uint64,
|
|||||||
store.paymentIDMtx.Lock(paymentID)
|
store.paymentIDMtx.Lock(paymentID)
|
||||||
defer store.paymentIDMtx.Unlock(paymentID)
|
defer store.paymentIDMtx.Unlock(paymentID)
|
||||||
|
|
||||||
|
log.Debugf("Storing result for paymentID=%v", paymentID)
|
||||||
|
|
||||||
// Serialize the payment result.
|
// Serialize the payment result.
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
if err := serializeNetworkResult(&b, result); err != nil {
|
if err := serializeNetworkResult(&b, result); err != nil {
|
||||||
@ -175,6 +177,8 @@ func (store *networkResultStore) subscribeResult(paymentID uint64) (
|
|||||||
store.paymentIDMtx.Lock(paymentID)
|
store.paymentIDMtx.Lock(paymentID)
|
||||||
defer store.paymentIDMtx.Unlock(paymentID)
|
defer store.paymentIDMtx.Unlock(paymentID)
|
||||||
|
|
||||||
|
log.Debugf("Subscribing to result for paymentID=%v", paymentID)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
result *networkResult
|
result *networkResult
|
||||||
resultChan = make(chan *networkResult, 1)
|
resultChan = make(chan *networkResult, 1)
|
||||||
|
@ -420,6 +420,9 @@ func (s *Switch) GetPaymentResult(paymentID uint64, paymentHash lntypes.Hash,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debugf("Received network result %T for paymentID=%v", n.msg,
|
||||||
|
paymentID)
|
||||||
|
|
||||||
// Extract the result and pass it to the result channel.
|
// Extract the result and pass it to the result channel.
|
||||||
result, err := s.extractResult(
|
result, err := s.extractResult(
|
||||||
deobfuscator, n, paymentID, paymentHash,
|
deobfuscator, n, paymentID, paymentHash,
|
||||||
|
@ -14,6 +14,9 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/routing/route"
|
"github.com/lightningnetwork/lnd/routing/route"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// errShardHandlerExiting is returned from the shardHandler when it exits.
|
||||||
|
var errShardHandlerExiting = fmt.Errorf("shard handler exiting")
|
||||||
|
|
||||||
// paymentLifecycle holds all information about the current state of a payment
|
// paymentLifecycle holds all information about the current state of a payment
|
||||||
// needed to resume if from any point.
|
// needed to resume if from any point.
|
||||||
type paymentLifecycle struct {
|
type paymentLifecycle struct {
|
||||||
@ -104,7 +107,7 @@ func (p *paymentLifecycle) resumePayment() ([32]byte, *route.Route, error) {
|
|||||||
for _, a := range payment.InFlightHTLCs() {
|
for _, a := range payment.InFlightHTLCs() {
|
||||||
a := a
|
a := a
|
||||||
|
|
||||||
log.Debugf("Resuming payment shard %v for hash %v",
|
log.Infof("Resuming payment shard %v for hash %v",
|
||||||
a.AttemptID, p.paymentHash)
|
a.AttemptID, p.paymentHash)
|
||||||
|
|
||||||
shardHandler.collectResultAsync(&a.HTLCAttemptInfo)
|
shardHandler.collectResultAsync(&a.HTLCAttemptInfo)
|
||||||
@ -308,7 +311,7 @@ func (p *shardHandler) waitForShard() error {
|
|||||||
return err
|
return err
|
||||||
|
|
||||||
case <-p.quit:
|
case <-p.quit:
|
||||||
return fmt.Errorf("shard handler quitting")
|
return errShardHandlerExiting
|
||||||
|
|
||||||
case <-p.router.quit:
|
case <-p.router.quit:
|
||||||
return ErrRouterShuttingDown
|
return ErrRouterShuttingDown
|
||||||
@ -326,7 +329,7 @@ func (p *shardHandler) checkShards() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case <-p.quit:
|
case <-p.quit:
|
||||||
return fmt.Errorf("shard handler quitting")
|
return errShardHandlerExiting
|
||||||
|
|
||||||
case <-p.router.quit:
|
case <-p.router.quit:
|
||||||
return ErrRouterShuttingDown
|
return ErrRouterShuttingDown
|
||||||
@ -421,7 +424,8 @@ func (p *shardHandler) collectResultAsync(attempt *channeldb.HTLCAttemptInfo) {
|
|||||||
result, err := p.collectResult(attempt)
|
result, err := p.collectResult(attempt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != ErrRouterShuttingDown &&
|
if err != ErrRouterShuttingDown &&
|
||||||
err != htlcswitch.ErrSwitchExiting {
|
err != htlcswitch.ErrSwitchExiting &&
|
||||||
|
err != errShardHandlerExiting {
|
||||||
|
|
||||||
log.Errorf("Error collecting result for "+
|
log.Errorf("Error collecting result for "+
|
||||||
"shard %v for payment %v: %v",
|
"shard %v for payment %v: %v",
|
||||||
@ -531,7 +535,7 @@ func (p *shardHandler) collectResult(attempt *channeldb.HTLCAttemptInfo) (
|
|||||||
return nil, ErrRouterShuttingDown
|
return nil, ErrRouterShuttingDown
|
||||||
|
|
||||||
case <-p.quit:
|
case <-p.quit:
|
||||||
return nil, fmt.Errorf("shard handler exiting")
|
return nil, errShardHandlerExiting
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case of a payment failure, fail the attempt with the control
|
// In case of a payment failure, fail the attempt with the control
|
||||||
@ -683,7 +687,7 @@ func (p *shardHandler) handleSendError(attempt *channeldb.HTLCAttemptInfo,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Payment %v failed: final_outcome=%v, raw_err=%v",
|
log.Infof("Payment %v failed: final_outcome=%v, raw_err=%v",
|
||||||
p.paymentHash, *reason, sendErr)
|
p.paymentHash, *reason, sendErr)
|
||||||
|
|
||||||
err := p.router.cfg.Control.Fail(p.paymentHash, *reason)
|
err := p.router.cfg.Control.Fail(p.paymentHash, *reason)
|
||||||
|
@ -2006,8 +2006,8 @@ func (r *ChannelRouter) tryApplyChannelUpdate(rt *route.Route,
|
|||||||
// processSendError analyzes the error for the payment attempt received from the
|
// processSendError analyzes the error for the payment attempt received from the
|
||||||
// switch and updates mission control and/or channel policies. Depending on the
|
// switch and updates mission control and/or channel policies. Depending on the
|
||||||
// error type, this error is either the final outcome of the payment or we need
|
// error type, this error is either the final outcome of the payment or we need
|
||||||
// to continue with an alternative route. This is indicated by the boolean
|
// to continue with an alternative route. A final outcome is indicated by a
|
||||||
// return value.
|
// non-nil return value.
|
||||||
func (r *ChannelRouter) processSendError(paymentID uint64, rt *route.Route,
|
func (r *ChannelRouter) processSendError(paymentID uint64, rt *route.Route,
|
||||||
sendErr error) *channeldb.FailureReason {
|
sendErr error) *channeldb.FailureReason {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user