Skip to content

Conversation

@dangeross
Copy link
Collaborator

@dangeross dangeross commented Dec 1, 2025

Updates the persistence of payments to use "ON CONFLICT" instead of "OR REPLACE" to avoid payment and foreign table rows being dropped when a payment is updated. For example spark invoice details or HTLC statuses are persisted between payment updates. This allows syncing payment data from multiple sources without losing data (e.g. syncing data from spark and flashnet) or storing a payment with non spark data before the initial transfer is synced

@dangeross dangeross force-pushed the savage-payment-update-persistence branch 2 times, most recently from 1f70fc6 to 8dd65ba Compare December 1, 2025 13:19
Copy link
Collaborator

@JssDWt JssDWt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines 555 to 557
lnurl_pay_info=COALESCE(excluded.lnurl_pay_info, payment_metadata.lnurl_pay_info),
lnurl_withdraw_info=COALESCE(excluded.lnurl_withdraw_info, payment_metadata.lnurl_withdraw_info),
lnurl_description=COALESCE(excluded.lnurl_description, payment_metadata.lnurl_description)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we setting here or partially updating? Asking because the name of the function implies setting but seems like existing values that are not updated are not being overridden anymore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, the name is inconsistent now as we only take the updated value if its not null. I'm fine reverting this for set_payment_metadata. I think the most important are the handling of payment and payment details related tables. Wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dangeross dangeross force-pushed the savage-payment-update-persistence branch from 0823ef4 to 08dd127 Compare December 22, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants