-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Part 7|*] Addressing TODOs left from the SQL payments implementation #10373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ziggie1984
wants to merge
53
commits into
lightningnetwork:elle-payment-sql-series-new
Choose a base branch
from
ziggie1984:introduce-sql-schema-payments-part-7
base: elle-payment-sql-series-new
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Part 7|*] Addressing TODOs left from the SQL payments implementation #10373
ziggie1984
wants to merge
53
commits into
lightningnetwork:elle-payment-sql-series-new
from
ziggie1984:introduce-sql-schema-payments-part-7
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
A context is added to failPaymentAndAttempt and its dependant function calls.
We make the TestDeleteNonInFlight and separate all the logic out for the duplicate payment test case. The deletion of duplicate payments is now tested in isolation only for the kv backend.
e00c320 to
4f1babb
Compare
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.
4f1babb to
a6c9e12
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR cleansup some TODOs of the payment sql series, before tackling the dispatcher and the migration.