mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-22 17:50:11 +02:00
routing: fix and enhance logging
This commit is contained in:
parent
b63e5decad
commit
0928ba0149
@ -424,7 +424,9 @@ func (p *PaymentControl) RegisterAttempt(paymentHash lntypes.Hash,
|
|||||||
// Ensure we aren't sending more than the total payment amount.
|
// Ensure we aren't sending more than the total payment amount.
|
||||||
sentAmt, _ := payment.SentAmt()
|
sentAmt, _ := payment.SentAmt()
|
||||||
if sentAmt+amt > payment.Info.Value {
|
if sentAmt+amt > payment.Info.Value {
|
||||||
return ErrValueExceedsAmt
|
return fmt.Errorf("%w: attempted=%v, payment amount="+
|
||||||
|
"%v", ErrValueExceedsAmt, sentAmt+amt,
|
||||||
|
payment.Info.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
htlcsBucket, err := bucket.CreateBucketIfNotExists(
|
htlcsBucket, err := bucket.CreateBucketIfNotExists(
|
||||||
|
@ -734,10 +734,7 @@ func TestPaymentControlMultiShard(t *testing.T) {
|
|||||||
b := *attempt
|
b := *attempt
|
||||||
b.AttemptID = 3
|
b.AttemptID = 3
|
||||||
_, err = pControl.RegisterAttempt(info.PaymentIdentifier, &b)
|
_, err = pControl.RegisterAttempt(info.PaymentIdentifier, &b)
|
||||||
if err != ErrValueExceedsAmt {
|
require.ErrorIs(t, err, ErrValueExceedsAmt)
|
||||||
t.Fatalf("expected ErrValueExceedsAmt, got: %v",
|
|
||||||
err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fail the second attempt.
|
// Fail the second attempt.
|
||||||
a := attempts[1]
|
a := attempts[1]
|
||||||
|
@ -179,7 +179,7 @@ func (p *paymentLifecycle) resumePayment(ctx context.Context) ([32]byte,
|
|||||||
for _, a := range payment.InFlightHTLCs() {
|
for _, a := range payment.InFlightHTLCs() {
|
||||||
a := a
|
a := a
|
||||||
|
|
||||||
log.Infof("Resuming payment shard %v for payment %v",
|
log.Infof("Resuming HTLC attempt %v for payment %v",
|
||||||
a.AttemptID, p.identifier)
|
a.AttemptID, p.identifier)
|
||||||
|
|
||||||
p.resultCollector(&a)
|
p.resultCollector(&a)
|
||||||
@ -463,6 +463,8 @@ func (p *paymentLifecycle) collectResultAsync(attempt *channeldb.HTLCAttempt) {
|
|||||||
func (p *paymentLifecycle) collectResult(attempt *channeldb.HTLCAttempt) (
|
func (p *paymentLifecycle) collectResult(attempt *channeldb.HTLCAttempt) (
|
||||||
*attemptResult, error) {
|
*attemptResult, error) {
|
||||||
|
|
||||||
|
log.Tracef("Collecting result for attempt %v", spew.Sdump(attempt))
|
||||||
|
|
||||||
// We'll retrieve the hash specific to this shard from the
|
// We'll retrieve the hash specific to this shard from the
|
||||||
// shardTracker, since it will be needed to regenerate the circuit
|
// shardTracker, since it will be needed to regenerate the circuit
|
||||||
// below.
|
// below.
|
||||||
@ -663,8 +665,8 @@ func (p *paymentLifecycle) createNewPaymentAttempt(rt *route.Route,
|
|||||||
func (p *paymentLifecycle) sendAttempt(
|
func (p *paymentLifecycle) sendAttempt(
|
||||||
attempt *channeldb.HTLCAttempt) (*attemptResult, error) {
|
attempt *channeldb.HTLCAttempt) (*attemptResult, error) {
|
||||||
|
|
||||||
log.Debugf("Attempting to send payment %v (pid=%v)", p.identifier,
|
log.Debugf("Sending HTLC attempt(id=%v, amt=%v) for payment %v",
|
||||||
attempt.AttemptID)
|
attempt.AttemptID, attempt.Route.TotalAmount, p.identifier)
|
||||||
|
|
||||||
rt := attempt.Route
|
rt := attempt.Route
|
||||||
|
|
||||||
|
@ -1133,6 +1133,9 @@ func (r *ChannelRouter) SendToRouteSkipTempErr(htlcHash lntypes.Hash,
|
|||||||
func (r *ChannelRouter) sendToRoute(htlcHash lntypes.Hash, rt *route.Route,
|
func (r *ChannelRouter) sendToRoute(htlcHash lntypes.Hash, rt *route.Route,
|
||||||
skipTempErr bool) (*channeldb.HTLCAttempt, error) {
|
skipTempErr bool) (*channeldb.HTLCAttempt, error) {
|
||||||
|
|
||||||
|
log.Debugf("SendToRoute for payment %v with skipTempErr=%v",
|
||||||
|
htlcHash, skipTempErr)
|
||||||
|
|
||||||
// Calculate amount paid to receiver.
|
// Calculate amount paid to receiver.
|
||||||
amt := rt.ReceiverAmt()
|
amt := rt.ReceiverAmt()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user