mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-09 21:56:47 +01:00
multi: use sqldb.NoOpReset helper
Define a re-usable "reset" function, sqldb.NoOpReset, that can be used for the reset parameter in sql ExecTx calls.
This commit is contained in:
@@ -76,7 +76,7 @@ func TestMigrationWithChannelDB(t *testing.T) {
|
||||
ctxb, kvStore.Backend, kvStore, tx,
|
||||
batchSize,
|
||||
)
|
||||
}, func() {},
|
||||
}, sqldb.NoOpReset,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ func testMigrateSingleInvoiceRapid(t *rapid.T, store *SQLStore, mpp bool,
|
||||
}
|
||||
|
||||
return nil
|
||||
}, func() {})
|
||||
}, sqldb.NoOpReset)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Fetch and compare each migrated invoice from the store with the
|
||||
|
||||
@@ -322,7 +322,7 @@ func (i *SQLStore) AddInvoice(ctx context.Context,
|
||||
AddedAt: newInvoice.CreationDate.UTC(),
|
||||
InvoiceID: invoiceID,
|
||||
})
|
||||
}, func() {})
|
||||
}, sqldb.NoOpReset)
|
||||
if err != nil {
|
||||
mappedSQLErr := sqldb.MapSQLError(err)
|
||||
var uniqueConstraintErr *sqldb.ErrSQLUniqueConstraintViolation
|
||||
@@ -702,7 +702,7 @@ func (i *SQLStore) LookupInvoice(ctx context.Context,
|
||||
invoice, err = fetchInvoice(ctx, db, ref)
|
||||
|
||||
return err
|
||||
}, func() {})
|
||||
}, sqldb.NoOpReset)
|
||||
if txErr != nil {
|
||||
return Invoice{}, txErr
|
||||
}
|
||||
@@ -1488,7 +1488,7 @@ func (i *SQLStore) UpdateInvoice(ctx context.Context, ref InvoiceRef,
|
||||
)
|
||||
|
||||
return err
|
||||
}, func() {})
|
||||
}, sqldb.NoOpReset)
|
||||
if txErr != nil {
|
||||
// If the invoice is already settled, we'll return the
|
||||
// (unchanged) invoice and the ErrInvoiceAlreadySettled error.
|
||||
@@ -1552,7 +1552,7 @@ func (i *SQLStore) DeleteInvoice(ctx context.Context,
|
||||
}
|
||||
|
||||
return nil
|
||||
}, func() {})
|
||||
}, sqldb.NoOpReset)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to delete invoices: %w", err)
|
||||
@@ -1572,7 +1572,7 @@ func (i *SQLStore) DeleteCanceledInvoices(ctx context.Context) error {
|
||||
}
|
||||
|
||||
return nil
|
||||
}, func() {})
|
||||
}, sqldb.NoOpReset)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to delete invoices: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user