Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sql-4] accounts: remove last usages of UpdateAccount #941

Merged
merged 4 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
bitromortac marked this conversation as resolved.
Show resolved Hide resolved
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
Loading