Skip to content

Commit

Permalink
add info for invoice events
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwiidb committed Sep 7, 2023
1 parent 6202547 commit f973c3e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ func (client *DefaultClient) FinalizeInitializedPayments(ctx context.Context, sv

continue
}
client.logger.Infoj(log.JSON{
"subroutine": "payment finalizer",
"payment_hash": invoice.RHash,
"message": "updating payment",
})

switch payment.Status {
case lnrpc.Payment_SUCCEEDED:
Expand All @@ -222,7 +227,11 @@ func (client *DefaultClient) FinalizeInitializedPayments(ctx context.Context, sv
continue
}

client.logger.Infof("Payment finalizer: updated successful payment with hash: %s", payment.PaymentHash)
client.logger.Infoj(log.JSON{
"subroutine": "payment finalizer",
"message": "updated succesful payment",
"payment_hash": payment.PaymentHash,
})
delete(pendingInvoices, payment.PaymentHash)

case lnrpc.Payment_FAILED:
Expand All @@ -236,8 +245,11 @@ func (client *DefaultClient) FinalizeInitializedPayments(ctx context.Context, sv

continue
}

client.logger.Infof("Payment finalizer: updated failed payment with hash: %s", payment.PaymentHash)
client.logger.Infoj(log.JSON{
"subroutine": "payment finalizer",
"message": "updated failed payment",
"payment_hash": payment.PaymentHash,
})
delete(pendingInvoices, payment.PaymentHash)
}
}
Expand Down Expand Up @@ -288,6 +300,11 @@ func (client *DefaultClient) SubscribeToLndInvoices(ctx context.Context, handler

continue
}
log.Infoj(log.JSON{
"subroutine": "invoice consumer",
"message": "adding invoice",
"payment_hash": invoice.RHash,
})

err = handler(ctx, &invoice)
if err != nil {
Expand Down

0 comments on commit f973c3e

Please sign in to comment.