Merge pull request #8595 from bhandras/sqldb-invoices-reset-on-retry
sqldb: reset out of scope containers on potential ExecTx retry
This commit is contained in:
2 files changed
+8
-1
No files matched your search
@@ -415,6 +415,9 @@ bitcoin peers' feefilter values into account](https://github.com/lightningnetwor
|
|||||||
start](https://github.com/lightningnetwork/lnd/pull/8568) if native SQL is
|
start](https://github.com/lightningnetwork/lnd/pull/8568) if native SQL is
|
||||||
enabled but the channeldb already has any KV invoices stored.
|
enabled but the channeldb already has any KV invoices stored.
|
||||||
|
|
||||||
|
* [Fix a bug](https://github.com/lightningnetwork/lnd/pull/8595) when retrying
|
||||||
|
SQL InvoiceDB transactions due to database errors.
|
||||||
|
|
||||||
## Code Health
|
## Code Health
|
||||||
|
|
||||||
* [Remove database pointers](https://github.com/lightningnetwork/lnd/pull/8117)
|
* [Remove database pointers](https://github.com/lightningnetwork/lnd/pull/8117)
|
||||||
|
|||||||
+5
-1
@@ -611,10 +611,11 @@ func (i *InvoiceStore) LookupInvoice(ctx context.Context,
|
|||||||
func (i *InvoiceStore) FetchPendingInvoices(ctx context.Context) (
|
func (i *InvoiceStore) FetchPendingInvoices(ctx context.Context) (
|
||||||
map[lntypes.Hash]invpkg.Invoice, error) {
|
map[lntypes.Hash]invpkg.Invoice, error) {
|
||||||
|
|
||||||
invoices := make(map[lntypes.Hash]invpkg.Invoice)
|
var invoices map[lntypes.Hash]invpkg.Invoice
|
||||||
|
|
||||||
readTxOpt := NewInvoiceQueryReadTx()
|
readTxOpt := NewInvoiceQueryReadTx()
|
||||||
err := i.db.ExecTx(ctx, &readTxOpt, func(db InvoiceQueries) error {
|
err := i.db.ExecTx(ctx, &readTxOpt, func(db InvoiceQueries) error {
|
||||||
|
invoices = make(map[lntypes.Hash]invpkg.Invoice)
|
||||||
limit := queryPaginationLimit
|
limit := queryPaginationLimit
|
||||||
|
|
||||||
return queryWithLimit(func(offset int) (int, error) {
|
return queryWithLimit(func(offset int) (int, error) {
|
||||||
@@ -671,6 +672,7 @@ func (i *InvoiceStore) InvoicesSettledSince(ctx context.Context, idx uint64) (
|
|||||||
|
|
||||||
readTxOpt := NewInvoiceQueryReadTx()
|
readTxOpt := NewInvoiceQueryReadTx()
|
||||||
err := i.db.ExecTx(ctx, &readTxOpt, func(db InvoiceQueries) error {
|
err := i.db.ExecTx(ctx, &readTxOpt, func(db InvoiceQueries) error {
|
||||||
|
invoices = nil
|
||||||
settleIdx := idx
|
settleIdx := idx
|
||||||
limit := queryPaginationLimit
|
limit := queryPaginationLimit
|
||||||
|
|
||||||
@@ -784,6 +786,7 @@ func (i *InvoiceStore) InvoicesAddedSince(ctx context.Context, idx uint64) (
|
|||||||
|
|
||||||
readTxOpt := NewInvoiceQueryReadTx()
|
readTxOpt := NewInvoiceQueryReadTx()
|
||||||
err := i.db.ExecTx(ctx, &readTxOpt, func(db InvoiceQueries) error {
|
err := i.db.ExecTx(ctx, &readTxOpt, func(db InvoiceQueries) error {
|
||||||
|
result = nil
|
||||||
addIdx := idx
|
addIdx := idx
|
||||||
limit := queryPaginationLimit
|
limit := queryPaginationLimit
|
||||||
|
|
||||||
@@ -840,6 +843,7 @@ func (i *InvoiceStore) QueryInvoices(ctx context.Context,
|
|||||||
|
|
||||||
readTxOpt := NewInvoiceQueryReadTx()
|
readTxOpt := NewInvoiceQueryReadTx()
|
||||||
err := i.db.ExecTx(ctx, &readTxOpt, func(db InvoiceQueries) error {
|
err := i.db.ExecTx(ctx, &readTxOpt, func(db InvoiceQueries) error {
|
||||||
|
invoices = nil
|
||||||
limit := queryPaginationLimit
|
limit := queryPaginationLimit
|
||||||
|
|
||||||
return queryWithLimit(func(offset int) (int, error) {
|
return queryWithLimit(func(offset int) (int, error) {
|
||||||
|
|||||||
Reference in new issue
Block a user