Skip to content

accounts: extend update command functionality #648

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

Closed
ViktorTigerstrom opened this issue Oct 4, 2023 · 0 comments · Fixed by #974
Closed

accounts: extend update command functionality #648

ViktorTigerstrom opened this issue Oct 4, 2023 · 0 comments · Fixed by #974
Assignees
Labels
enhancement New feature or request

Comments

@ViktorTigerstrom
Copy link
Contributor

Is your feature request related to a problem? Please describe.

The functionality of the update command is that the command takes a id for an account, and then allows you to specify certain properties of the account to overwrite the account property value with.

One of the properties the command accepts, it to overwrite the account_balance with a specified value. This command will usually be used if you'd like to for example increase the account balance by 100k sats or similar.

However, using the command that way, is quite dangerous as the normal user flow would be as follows:

  1. You'd check what the current account balance is by using the info command. Say this command returns that the balance is currently 200k.
  2. You'd then sum the current balance with the amount you'd like to increase it with to get the new balance of the account, i.e.:
    200k+100k=300k
  3. You'd then run the update command to set the value to 300k.

Now the issue with this user flow, is that the the account user might have either received a payment to an invoice increasing the balance, or made a payment decreasing the balance, between step 1 and 3. Step 3 would then overwrite that account balance update. Say the accounts user makes a payment of 150k sats between step 1 and 3. The actual user account balance should be 150k after step 3, but will be 300k, meaning the account user profited 150k sats.

Another an issue we have, is that if a user receives an invoice update for a type of invoice we don't support (AMP invoices currently), or a payment that somehow errors, the entire account service will error be disabled for all accounts, and will be disabled even on next startup of litd when we try to process the invoice update or payment.

Describe the solution you'd like

It would be great if we could either update the update command, or make a new command to instead of overwriting the entire account balance, we'd have a command that either increases or decreases the user account balance by a certain amount, instead of setting the balance to a given amount. That way, any updates that happens between step 1 & 3 wouldn't be overwritten. I.e. the command would for example enable the node user to increase the user account balance by 100k, instead of actually setting it to exactly 300k.

To solve the issue of invoices and payments that make the account service crash, it would be great if the command would allow the node runner to deassociate a certain invoice or payment for a certain account id. That way, the account service would be able to run successfully on next startup.

Describe alternatives you've considered

Additional context

@ViktorTigerstrom ViktorTigerstrom added the enhancement New feature or request label Oct 4, 2023
@ViktorTigerstrom ViktorTigerstrom self-assigned this Jan 17, 2025
ViktorTigerstrom added a commit to ViktorTigerstrom/lightning-terminal that referenced this issue Feb 5, 2025
This commit introduces the structure for a new endpoint in the accounts
subsystem, enabling balance adjustments by adding or deducting a
specified amount. This contrasts with the existing `UpdateAccount`
implementation, which directly sets the balance to a fixed value.

For more details on the drawbacks of the current implementation, see
[issue lightninglabs#648](lightninglabs#648).

The actual implementation of the endpoint will be introduced in
subsequent commits.
ViktorTigerstrom added a commit to ViktorTigerstrom/lightning-terminal that referenced this issue Feb 11, 2025
This commit introduces the structure for new endpoints in the accounts
subsystem, enabling balance adjustments by crediting or debiting a
specified amount. This contrasts with the existing `UpdateAccount`
implementation, which directly sets the balance to a fixed value.

For more details on the drawbacks of the current implementation, see
[issue lightninglabs#648](lightninglabs#648).

The actual implementation of the endpoints will be introduced in
subsequent commits.
ViktorTigerstrom added a commit to ViktorTigerstrom/lightning-terminal that referenced this issue Feb 18, 2025
This commit introduces the structure for new endpoints in the accounts
subsystem, enabling balance adjustments by crediting or debiting a
specified amount. This contrasts with the existing `UpdateAccount`
implementation, which directly sets the balance to a fixed value.

For more details on the drawbacks of the current implementation, see
[issue lightninglabs#648](lightninglabs#648).

The actual implementation of the endpoints will be introduced in
subsequent commits.
ViktorTigerstrom added a commit to ViktorTigerstrom/lightning-terminal that referenced this issue Feb 20, 2025
This commit introduces the structure for new endpoints in the accounts
subsystem, enabling balance adjustments by crediting or debiting a
specified amount. This contrasts with the existing `UpdateAccount`
implementation, which directly sets the balance to a fixed value.

For more details on the drawbacks of the current implementation, see
[issue lightninglabs#648](lightninglabs#648).

The actual implementation of the endpoints will be introduced in
subsequent commits.
ViktorTigerstrom added a commit to ViktorTigerstrom/lightning-terminal that referenced this issue Feb 26, 2025
This commit introduces the structure for new endpoints in the accounts
subsystem, enabling balance adjustments by crediting or debiting a
specified amount. This contrasts with the existing `UpdateAccount`
implementation, which directly sets the balance to a fixed value.

For more details on the drawbacks of the current implementation, see
[issue lightninglabs#648](lightninglabs#648).

The actual implementation of the endpoints will be introduced in
subsequent commits.
ViktorTigerstrom added a commit to ViktorTigerstrom/lightning-terminal that referenced this issue Mar 13, 2025
This commit introduces the structure for new endpoints in the accounts
subsystem, enabling balance adjustments by crediting or debiting a
specified amount. This contrasts with the existing `UpdateAccount`
implementation, which directly sets the balance to a fixed value.

For more details on the drawbacks of the current implementation, see
[issue lightninglabs#648](lightninglabs#648).

The actual implementation of the endpoints will be introduced in
subsequent commits.
ViktorTigerstrom added a commit to ViktorTigerstrom/lightning-terminal that referenced this issue Mar 25, 2025
This commit introduces the structure for new endpoints in the accounts
subsystem, enabling balance adjustments by crediting or debiting a
specified amount. This contrasts with the existing `UpdateAccount`
implementation, which directly sets the balance to a fixed value.

For more details on the drawbacks of the current implementation, see
[issue lightninglabs#648](lightninglabs#648).

The actual implementation of the endpoints will be introduced in
subsequent commits.
ViktorTigerstrom added a commit to ViktorTigerstrom/lightning-terminal that referenced this issue Mar 31, 2025
This commit introduces the structure for new endpoints in the accounts
subsystem, enabling balance adjustments by crediting or debiting a
specified amount. This contrasts with the existing `UpdateAccount`
implementation, which directly sets the balance to a fixed value.

For more details on the drawbacks of the current implementation, see
[issue lightninglabs#648](lightninglabs#648).

The actual implementation of the endpoints will be introduced in
subsequent commits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant