Skip to content

Conversation

@ziggie1984
Copy link
Collaborator

@ziggie1984 ziggie1984 commented Nov 15, 2025

This PR cleansup some TODOs of the payment sql series, before tackling the dispatcher and the migration.

Previously a one(intent)-to-many(payment) relationship it is now
changed to a one-to-one relationship because a payment request
only can have 1 payment related to it. Looking into the future
with BOLT12 offers, the fetched invoice from the offer could be
stored here as well and the relationship would still hold.
In this commit we add all queries which we will need to insert
payment related data into the db.
We wrap the fetchPayment db call and catch the case where no errors
are found in the db, where we now return the ErrPaymentNotInitiated
error.
Now that every method of the interface was implemented we can
remove the embedded reference we put into place for the sql store
implementation so that the interface would succeed. This is now
removed.
Since now the sql backend is more strict in using the same
session key we refactor the helper so that we can easily change
the session key for every new attempt.
We make the QueryPayments test db agnostic and also keep a small
test for querying the duplicate payments case in the kv world.
In commit adds the harness which will be used to run db agnostic
tests against the kv and sql backend. We have adopted all the
unit tests so far so that with this commit all the payment tests
not specifically put into the kv_store_test.go should all pass
for all backends.
The design of the sql and kv db are a bit different. A harness
interface is introduced which allows us to unit most of the test
and keep the backend specific tests at a minimum.
@ziggie1984 ziggie1984 changed the base branch from master to elle-payment-sql-series-new November 15, 2025 07:53
@ziggie1984 ziggie1984 added payments Related to invoices/payments sql labels Nov 15, 2025
@ziggie1984 ziggie1984 added this to v0.21 Nov 15, 2025
@ziggie1984 ziggie1984 added this to the v0.21.0 milestone Nov 15, 2025
@ziggie1984 ziggie1984 self-assigned this Nov 15, 2025
@ziggie1984 ziggie1984 moved this to Ready in v0.21 Nov 15, 2025
@ziggie1984 ziggie1984 force-pushed the introduce-sql-schema-payments-part-7 branch from e00c320 to 4f1babb Compare November 18, 2025 00:06
Previously we had db and application logic mixed on the db level.
We now move the config option KeepFailedPaymentAttempts to the
ChannelRouter level and move it out of the db level.
@ziggie1984 ziggie1984 force-pushed the introduce-sql-schema-payments-part-7 branch from 4f1babb to a6c9e12 Compare November 18, 2025 08:15
@ziggie1984 ziggie1984 marked this pull request as ready for review November 18, 2025 08:16
@ziggie1984 ziggie1984 moved this from Ready to In progress in v0.21 Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog payments Related to invoices/payments sql

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

1 participant