Skip to content

Commit

Permalink
add decent logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwiidb committed Jul 28, 2023
1 parent 7b88e40 commit 8c12945
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion reconciliation_lost_invoices/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,22 @@ func main() {
if err != nil {
// - if not found, dump invoice json
if errors.Is(err, sql.ErrNoRows) {
fmt.Printf("keysend: %t hex: %s\n", lndInvoice.IsKeysend, hex.EncodeToString(lndInvoice.RHash))

firstHtlc := &lnrpc.InvoiceHTLC{}
if len(lndInvoice.Htlcs) > 0 {
firstHtlc = lndInvoice.Htlcs[0]
}
messageJson := map[string]interface{}{
"message": "reconciliation: potential missing invoice",
"r_hash": hex.EncodeToString(lndInvoice.RHash),
"keysend": lndInvoice.IsKeysend,
"custom_records": firstHtlc.CustomRecords,
}
msgBytes, err := json.Marshal(messageJson)
if err != nil {
svc.Logger.Fatal(err)
}
fmt.Printf(string(msgBytes))
marshalled, err := json.Marshal(lndInvoice)
if err != nil {
svc.Logger.Fatal(err)
Expand Down

0 comments on commit 8c12945

Please sign in to comment.