Skip to content

Conversation

@ffranr
Copy link
Contributor

@ffranr ffranr commented Oct 24, 2022

Keep prefix tag, but drop the leading space: poold -- . Faraday looks for this tag.

Label structure:

{
  "account":{
    "action": "<action>",
    "key": "<string>",
    "expiry_height": <int>,
    "output_index": <int>,
    "expiry_spend": <bool>,
    "tx_fee": <int>,
    "balance_diff": <int>,
  }
}

The action field takes one of the following values:

  • create
  • deposit
  • withdraw
  • renew
  • close

key is the account key.

expiry_height is an integer block height at which the account expires. This value is important to ease the process of account recovery, see here.

output_index is an integer denoting the account balance transaction output.

expiry_spend is a boolean denoting whether the transaction spends via the expiry output path.

tx_fee is the onchain transaction fee for executing the account action.

balance_diff is a signed integer denoting the difference (+/-) in the account balance as a result of the transaction.

Here's a full minimized example (211 characters):

poold -- {"account":{"action":"withdraw","key":"028f4218ed13a50d9b6cc2afa947bba40e9336eaedbb10129ac1fda73a3d806252","expiry_height":2400,"output_index":1,"expiry_spend":false,"tx_fee":1027,"balance_diff":10000}}

Pull Request Checklist

  • LndServices minimum version has been updated if new lnd apis/fields are
    used.

@ffranr ffranr marked this pull request as ready for review October 24, 2022 13:31
@ffranr ffranr force-pushed the new_account_mod_tx_labels branch 3 times, most recently from 25c02f1 to f5d3203 Compare October 24, 2022 14:00
@ffranr ffranr marked this pull request as draft October 24, 2022 14:44
@ffranr ffranr force-pushed the new_account_mod_tx_labels branch 2 times, most recently from 450451a to 645daf6 Compare October 27, 2022 22:05
@ffranr ffranr changed the title account: add account action to account mod tx labels account: improve account onchain transaction labels Oct 28, 2022
Copy link
Contributor

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, I like the new label format!

I'm wondering if we should also start writing the same account modification data into the database alongside the accounts to make retrieval even easier and independent of lnd's label database (re-scanning the wallet can drop the labels, which users do sometimes).
Then we kind of have redundant information, but the new label is also just nice for the user to see what happened, so I don't think it's overkill.

@ffranr ffranr force-pushed the new_account_mod_tx_labels branch 2 times, most recently from 71a3a35 to 758c156 Compare October 31, 2022 11:30
@ffranr ffranr requested a review from guggero October 31, 2022 11:36
@ffranr ffranr marked this pull request as ready for review October 31, 2022 11:38
@guggero guggero linked an issue Oct 31, 2022 that may be closed by this pull request
@ffranr ffranr requested a review from positiveblue October 31, 2022 16:48
Copy link
Contributor

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work, looks very good!
Just a few comments about error handling and nits, nothing major 🎉

@ffranr ffranr force-pushed the new_account_mod_tx_labels branch from 758c156 to df2f6a3 Compare November 2, 2022 14:17
Copy link
Contributor

@positiveblue positiveblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 💯

@ffranr ffranr force-pushed the new_account_mod_tx_labels branch from df2f6a3 to 7d8bc1b Compare November 3, 2022 15:02
This commit reformulates transaction labels as JSON strings. The JSON contains the following fields:

* An `action` field which takes one of the following values: create, deposit, withdraw, renew, or close.

* `key` which is the account key.

* `expiry_height` which is an integer block height at which the account expires. This value is important to ease the process of account recovery.

* `output_index` which is an integer denoting the account balance transaction output.

* `expiry_spend` which is a boolean denoting whether the transaction spends via the expiry output path.

* `tx_fee` which is the onchain transaction fee for executing the account action.

* `balance_diff` which is a signed integer denoting the difference (+/-) in the account balance as a result of the transaction.

The poold specific transaction label prefix tag is also modified such that its prefixes spaces are removed.
@ffranr ffranr force-pushed the new_account_mod_tx_labels branch from 7d8bc1b to d76f0f1 Compare November 3, 2022 21:18
Copy link
Contributor

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting very close here! Only a few nits remaining 🎉

@ffranr ffranr merged commit f6e46d2 into lightninglabs:master Nov 4, 2022
@dstadulis
Copy link
Contributor

prematurely merged, follow up PR to continue improvements and reference this PR

@ffranr
Copy link
Contributor Author

ffranr commented Nov 7, 2022

@guggero I've opened this PR to address the rest of your comments: #413

If you have further comments you are welcome to leave them on either PR. Sorry for the inconvenience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve account onchain transaction labels.

4 participants