lightninglabs/pool

Improve account onchain transaction labels.

ffranr opened this issue · 3 comments

EDIT: Added changes following a call with Oli.

Executing account actions (create, renew, deposit, etc) involves generating transactions. Each transaction includes a label field which can store arbitrary data. Labels are limited to 500 characters in length.

Here are two example labels as they are currently used:

  poold -- AccountCreation(acct_key=028f4218ed13a50d9b6cc2afa947bba40e9336eaedbb10129ac1fda73a3d806252)
  poold -- AccountModification(acct_key=028f4218ed13a50d9b6cc2afa947bba40e9336eaedbb10129ac1fda73a3d806252, expiry=false, deposit=true, is_close=false)

Proposed Solution

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}}

@guggero @positiveblue @dstadulis Let me know if something might not workout or if anything can improved, and so on!

It might be a good idea to keep track of the pool account output index in the label also. It would probably help with calculating the action transaction fee amongst other things.

Notes from call with @guggero :

Keep tag but remove leading space: poold -- . Faraday parses this tag.

Change field expire_height -> expiry_height

Add field: output_index (int)

Add field: expiry_spend (bool)

Add field: tx_fee (int)

Add field: balance_diff: (int)

Make action values to snake case.

Solution: #396