blink
blink copied to clipboard
add payment metadata to medici_transactions
lnd 0.14 will have the capability to delete individual payments.
in the interest of making our node database smaller, we should take advance of this features and delete payment after they complete.
that said, we will loose some data that we need to store beforehands.
Currently, for data analysis (ie: to know where payment are most frequently sent to), we are getting the individual payment using trackpayment (using listpayments would get better but our node is currently failing with that)
now if we want to delete succesful payments, we need to store this metadata somewhere. I'm suggesting to store it alongside the medici transactions. we could store the json as a blob, and will extract/handle the data manually at a later stage in a data pipeline/data exploration environment.
I think both postgres and mongodb accept having a field as a json (mongodb even more so than postgres. the point is we don't need a structured schema for it)
maybe also @vindard or @dolcalmi can look over this
Adding implementation notes here, I believe we'd be persisting values from the returns of these two functions:
- https://github.com/alexbosworth/ln-service#payViaRoutes
- https://github.com/alexbosworth/ln-service#payviapaymentdetails
Adding implementation notes here, I believe we'd be persisting values from the returns of these two functions:
- https://github.com/alexbosworth/ln-service#payViaRoutes
- https://github.com/alexbosworth/ln-service#payviapaymentdetails
these methods not always return a final state so we need to use getPayment (for ex in trigger), the only concern about this is that lightning library not always return all attributes from lnd node
Adding some other things we'd like to persist as well:
- Add preimage to
PayInvoiceResulttype and persist in medici (see comment)
Draft of this being built on persist-ln-payment-in-medici branch
I'm using our LnLookupPayment type to persist data to mongoDB, the new "payment" property object in the transactions collection looks like this (@nicolasburtey):

this is done
@vindard : "I'll double-check that cron deletes these from lnd"
@vindard : "I'll double-check that cron deletes these from lnd"
It does, all good