Skip to content

Commit

Permalink
Merge pull request #941 from ellemouton/sql4Accounts4
Browse files Browse the repository at this point in the history
[sql-4] accounts: remove last usages of `UpdateAccount`
  • Loading branch information
ellemouton authored Jan 23, 2025
2 parents 2724161 + ef78bc4 commit 91bc912
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 228 deletions.
7 changes: 1 addition & 6 deletions accounts/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,6 @@ type Store interface {
expirationDate time.Time, label string) (
*OffChainBalanceAccount, error)

// UpdateAccount writes an account to the database, overwriting the
// existing one if it exists.
UpdateAccount(ctx context.Context,
account *OffChainBalanceAccount) error

// Account retrieves an account from the Store and un-marshals it. If
// the account cannot be found, then ErrAccNotFound is returned.
Account(ctx context.Context, id AccountID) (*OffChainBalanceAccount,
Expand All @@ -223,7 +218,7 @@ type Store interface {
// UpdateAccountBalanceAndExpiry updates the balance and/or expiry of an
// account.
UpdateAccountBalanceAndExpiry(ctx context.Context, id AccountID,
newBalance fn.Option[lnwire.MilliSatoshi],
newBalance fn.Option[int64],
newExpiry fn.Option[time.Time]) error

// AddAccountInvoice adds an invoice hash to an account.
Expand Down
4 changes: 2 additions & 2 deletions accounts/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,10 @@ func (s *InterceptorService) UpdateAccount(ctx context.Context,

// If the new account balance was set, parse it as millisatoshis. A
// value of -1 signals "don't update the balance".
var balance fn.Option[lnwire.MilliSatoshi]
var balance fn.Option[int64]
if accountBalance >= 0 {
// Convert from satoshis to millisatoshis for storage.
balance = fn.Some(lnwire.MilliSatoshi(accountBalance) * 1000)
balance = fn.Some(int64(accountBalance) * 1000)
}

// Create the actual account in the macaroon account store.
Expand Down
Loading

0 comments on commit 91bc912

Please sign in to comment.