Skip to content

Commit cc003ab

Browse files
accounts: rename store IncreaseAccountBalance
In preparation for the upcoming credit/debit accounts feature, rename the store `IncreaseAccountBalance` method to `CreditAccount` to better reflect its purpose.
1 parent 1a389d1 commit cc003ab

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

accounts/interface.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ type Store interface {
225225
AddAccountInvoice(ctx context.Context, id AccountID,
226226
hash lntypes.Hash) error
227227

228-
// IncreaseAccountBalance increases the balance of the account with the
228+
// CreditAccount increases the balance of the account with the
229229
// given ID by the given amount.
230-
IncreaseAccountBalance(ctx context.Context, id AccountID,
230+
CreditAccount(ctx context.Context, id AccountID,
231231
amount lnwire.MilliSatoshi) error
232232

233233
// UpsertAccountPayment updates or inserts a payment entry for the given

accounts/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ func (s *InterceptorService) invoiceUpdate(ctx context.Context,
563563
// If we get here, the current account has the invoice associated with
564564
// it that was just paid. Credit the amount to the account and update it
565565
// in the DB.
566-
err := s.store.IncreaseAccountBalance(ctx, acctID, invoice.AmountPaid)
566+
err := s.store.CreditAccount(ctx, acctID, invoice.AmountPaid)
567567
if err != nil {
568568
return s.disableAndErrorfUnsafe("error increasing account "+
569569
"balance account: %w", err)

accounts/store_kvdb.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ func (s *BoltStore) AddAccountInvoice(_ context.Context, id AccountID,
223223
return s.updateAccount(id, update)
224224
}
225225

226-
// IncreaseAccountBalance increases the balance of the account with the given ID
226+
// CreditAccount increases the balance of the account with the given ID
227227
// by the given amount.
228228
//
229229
// NOTE: This is part of the Store interface.
230-
func (s *BoltStore) IncreaseAccountBalance(_ context.Context, id AccountID,
230+
func (s *BoltStore) CreditAccount(_ context.Context, id AccountID,
231231
amount lnwire.MilliSatoshi) error {
232232

233233
update := func(account *OffChainBalanceAccount) error {

accounts/store_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ func TestAccountUpdateMethods(t *testing.T) {
262262
assertInvoices(hash1, hash2)
263263
})
264264

265-
t.Run("IncreaseAccountBalance", func(t *testing.T) {
265+
t.Run("CreditAccount", func(t *testing.T) {
266266
store := NewTestDB(t, clock.NewTestClock(time.Now()))
267267

268268
// Increasing the balance of an account that doesn't exist
269269
// should error out.
270-
err := store.IncreaseAccountBalance(ctx, AccountID{}, 100)
270+
err := store.CreditAccount(ctx, AccountID{}, 100)
271271
require.ErrorIs(t, err, ErrAccNotFound)
272272

273273
acct, err := store.NewAccount(ctx, 123, time.Time{}, "foo")
@@ -284,7 +284,7 @@ func TestAccountUpdateMethods(t *testing.T) {
284284

285285
// Increase the balance by 100 and assert that the new balance
286286
// is 223.
287-
err = store.IncreaseAccountBalance(ctx, acct.ID, 100)
287+
err = store.CreditAccount(ctx, acct.ID, 100)
288288
require.NoError(t, err)
289289

290290
assertBalance(223)

0 commit comments

Comments
 (0)