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.

@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
@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
@ziggie1984 ziggie1984 force-pushed the elle-payment-sql-series-new branch 2 times, most recently from 47606dd to 01d9986 Compare November 20, 2025 13:26
@ziggie1984 ziggie1984 force-pushed the introduce-sql-schema-payments-part-7 branch from a6c9e12 to d543390 Compare November 24, 2025 19:35
@ziggie1984
Copy link
Collaborator Author

Converage of the SQL store after this PR is merged:

ok  	github.com/lightningnetwork/lnd/payments/db	7.066s	coverage: 36.0% of statements
github.com/lightningnetwork/lnd/payments/db/sql_store.go:115:			NewSQLStore				66.7%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:141:			fetchPaymentWithCompleteData		80.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:167:			batchLoadPayments			71.4%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:199:			batchLoadpaymentsBaseData		83.3%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:264:			batchLoadPaymentCustomRecords		100.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:298:			batchLoadHtlcAttempts			100.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:331:			batchLoadHopsForAttempts		100.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:365:			batchLoadHopCustomRecords		100.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:399:			batchLoadRouteCustomRecords		42.9%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:438:			batchLoadPaymentResolutions		81.8%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:486:			loadPaymentResolutions			75.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:503:			computePaymentStatusFromResolutions	100.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:545:			batchLoadPaymentDetailsData		72.7%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:625:			buildPaymentFromBatchData		92.3%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:724:			QueryPayments				92.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:896:			fetchPaymentByHash			83.3%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:920:			FetchPayment				91.7%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:970:			FetchInFlightPayments			91.9%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1100:			DeleteFailedAttempts			92.3%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1137:			computePaymentStatusFromDB		75.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1189:			DeletePayment				86.7%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1250:			InitPayment				78.6%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1357:			insertRouteHops				46.9%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1481:			RegisterAttempt				75.8%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1607:			SettleAttempt				81.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1680:			FailAttempt				65.4%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1767:			Fail					81.0%
github.com/lightningnetwork/lnd/payments/db/sql_store.go:1851:			DeletePayments				90.9%

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.
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.
We add a test which tests the retrieval of first hop data like
the first hop amount or the custom records on the route level.
We add a couple of additional tests to increase the unit test
coverage of the sql store but also the kv store. We only create
db agnostic unit tests so both backends are tested effectively.
@ziggie1984 ziggie1984 force-pushed the introduce-sql-schema-payments-part-7 branch from 2e6f53f to fb82814 Compare November 28, 2025 08:09
@ziggie1984 ziggie1984 moved this from In progress to In review in v0.21 Nov 28, 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 review

Development

Successfully merging this pull request may close these issues.

1 participant