-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add GPRC methods for the duplicate payments table for the SQL backend #10489
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
Draft
ziggie1984
wants to merge
14
commits into
lightningnetwork:elle-payment-sql-series-new
Choose a base branch
from
ziggie1984:migration-kvdb-sql-payments-part2
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.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d5d49a1
paymentsdb+sqldb: add migration related query
ziggie1984 c78d0e9
sqldb+payments: add payment_duplicates for legacy duplicate payments
ziggie1984 eee2004
payments/migration1: copy core payment helpers and sqlc types
ziggie1984 fb174f2
payments/migration1: migrate payments and validate including duplicates
ziggie1984 e5a421b
payments/migration1: add sql_migration_test suite and helpers
ziggie1984 26cd720
payments/migration1: add external migration test and README
ziggie1984 579dfdf
payments/migration1: wire KV→SQL migration and add tombstone guard
ziggie1984 5e24738
docs: add release-notes
ziggie1984 83a9946
mod: update new direct dependency via go mod tidy
ziggie1984 3a0b724
git: add sqlite db files to the gitignore file
ziggie1984 572db06
paymentsdb: add sql duplicate payment fetchers
ziggie1984 950e213
paymentsdb: test duplicate payment fetch APIs
ziggie1984 f44ef04
lnrpc: add duplicate payment list RPCs
ziggie1984 2d2cd8a
lncli: add hidden commands for duplicate payments
ziggie1984 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,9 @@ mobile/*_generated.go | |
| *.hex | ||
| *.db | ||
| *.bin | ||
| *.sqlite | ||
| *.sqlite-shm | ||
| *.sqlite-wal | ||
|
|
||
| vendor | ||
| *.idea | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1525,6 +1525,71 @@ | |
| return nil | ||
| } | ||
|
|
||
| var listPaymentDuplicatesCommand = cli.Command{ | ||
| Name: "listpaymentduplicates", | ||
| Category: "Payments", | ||
| Usage: "List duplicate payments for a given payment hash.", | ||
| Hidden: true, | ||
| Flags: []cli.Flag{ | ||
| cli.StringFlag{ | ||
| Name: "payment_hash", | ||
| Usage: "hex-encoded payment hash to query", | ||
| }, | ||
| }, | ||
| Action: actionDecorator(listPaymentDuplicates), | ||
| } | ||
|
|
||
| func listPaymentDuplicates(ctx *cli.Context) error { | ||
| if !ctx.IsSet("payment_hash") { | ||
| return fmt.Errorf("payment_hash is required") | ||
| } | ||
|
|
||
| hashBytes, err := hex.DecodeString(ctx.String("payment_hash")) | ||
| if err != nil { | ||
| return fmt.Errorf("error decoding payment_hash: %w", err) | ||
| } | ||
|
|
||
| ctxc := getContext() | ||
| client, cleanUp := getClient(ctx) | ||
| defer cleanUp() | ||
|
|
||
| req := &lnrpc.ListPaymentDuplicatesRequest{ | ||
| PaymentHash: hashBytes, | ||
| } | ||
|
|
||
| resp, err := client.ListPaymentDuplicates(ctxc, req) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| printRespJSON(resp) | ||
| return nil | ||
| } | ||
|
|
||
| var listAllPaymentDuplicatesCommand = cli.Command{ | ||
| Name: "listallpaymentduplicates", | ||
| Category: "Payments", | ||
| Usage: "List duplicate payments across all payments.", | ||
| Hidden: true, | ||
| Action: actionDecorator(listAllPaymentDuplicates), | ||
| } | ||
|
|
||
| func listAllPaymentDuplicates(ctx *cli.Context) error { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is missing a comment explaining its purpose. According to the style guide, every function must be commented. // listAllPaymentDuplicates is the action for the `listallpaymentduplicates`
// command. It retrieves and displays all duplicate payment records across all
// payments.
func listAllPaymentDuplicates(ctx *cli.Context) error {References
|
||
| ctxc := getContext() | ||
| client, cleanUp := getClient(ctx) | ||
| defer cleanUp() | ||
|
|
||
| req := &lnrpc.ListAllPaymentDuplicatesRequest{} | ||
|
|
||
| resp, err := client.ListAllPaymentDuplicates(ctxc, req) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| printRespJSON(resp) | ||
| return nil | ||
| } | ||
|
|
||
| var forwardingHistoryCommand = cli.Command{ | ||
| Name: "fwdinghistory", | ||
| Category: "Payments", | ||
|
|
||
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is missing a comment explaining its purpose. According to the style guide, every function must be commented.
References