Skip to content

NUT-07: add new field pending#21

Merged
callebtc merged 4 commits intomainfrom
nut07/token_state_pending
Jul 8, 2023
Merged

NUT-07: add new field pending#21
callebtc merged 4 commits intomainfrom
nut07/token_state_pending

Conversation

@callebtc
Copy link
Copy Markdown
Contributor

@callebtc callebtc commented May 15, 2023

This is necessary in order for a wallet to determine whether a token it used for making a Lightning payment is still in-flight or not.

In short, LN payments can have 3 states but our tokens only 2 (because there's only spendable or not). We need another boolean state (pending).

Using this, wallets can determine the state of an outgoing Lightning payment as follows:

  • if a token is not spendable and not pending, the payment succeeded
  • if a token is spendable and pending, the payment is in-flight
  • if a token is spendable and not pending, the payment failed

@callebtc callebtc changed the title Nut-07: add new field pending NUT-07: add new field pending May 15, 2023
Copy link
Copy Markdown
Contributor

@Semisol Semisol left a comment

Choose a reason for hiding this comment

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

This finally got proposed :D

@gandlafbtc
Copy link
Copy Markdown
Contributor

LGTM

Copy link
Copy Markdown
Contributor

@BilligsterUser BilligsterUser left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Contributor

@thunderbiscuit thunderbiscuit left a comment

Choose a reason for hiding this comment

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

ACK 16e0a39.

I pointed a few non-blocking nits if you're interested.

Other ramblings/thoughts

A general thought on the wording of those token states (which might belong more in an issue than on this PR so feel free to ignore). It makes sense to have booleans in this json object for communication between the mint and client, but it might be nice to outline better wording for those states than the negation of spendable and pending as not spendable and not pending. In my mind, those two booleans immediately combine to become an enum, and I'm likely to call the enum variants something like spendable/burned/inflight or live/burned/pending.

This is more of an implementation detail (the json fields should probably stay spendable/pending) but as outlined in this awesome and very liked PR from Murch, providing good wording is always a big win. I guess what I'm proposing here is another PR that clarifies what the spec will call these token states. Something like this or a variant of it with your preferred words:

We call the combination of these booleans the token's state. A token can either be live (spendable == true && pending == false), in-flight (spendable == true && pending == true), or burned (spendable == false && pending == (true || false)).

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.

5 participants