Skip to content

Instantly share code, notes, and snippets.

@joschisan
Last active April 17, 2024 16:56
Show Gist options
  • Select an option

  • Save joschisan/21e8faa5839ef372138fdbf80ffc64f9 to your computer and use it in GitHub Desktop.

Select an option

Save joschisan/21e8faa5839ef372138fdbf80ffc64f9 to your computer and use it in GitHub Desktop.

SendStates

graph LR

Funding -- funding transaction is rejected --> Failure
Funding -- funding transaction is accepted --> Funded
Funded -- payment attempt expires --> Refunding
Funded -- gateway cancels payment attempt --> Refunding
Funded -- payment is confirmed  --> Success
Refunding -- payment is confirmed --> Success
Refunding -- ecash is minted --> Refunded
Refunding -- minting ecash fails --> Failure

Loading

ReceiveStates

graph LR

Pending -- payment is confirmed --> Claiming
Pending -- invoice expires --> Expired
Claiming -- ecash is minted --> Claimed
Claiming -- minting ecash fails --> Failure
Loading
@m1sterc001guy
Copy link

Got it, I keep forgetting that either the client or the gateway can submit these transactions.

If that's the case, what is the use case for the gateway returning the preimage/forfeit signature back to the client? Couldn't it just construct/submit these transactions itself?

@joschisan
Copy link
Author

it returns the preimage as a response to the post request so the payment can be shown to the user as settled as quickly as possible.
The forfeit signature is needed to proof to the federation that the gateway agrees to cancel the outgoing contract.

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