Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

sdk/state, sdk/agent: add memos to payments #348

Merged
merged 1 commit into from
Sep 30, 2021
Merged

sdk/state, sdk/agent: add memos to payments #348

merged 1 commit into from
Sep 30, 2021

Conversation

leighmcculloch
Copy link
Contributor

@leighmcculloch leighmcculloch commented Sep 30, 2021

What

Add a memo field to close agreements that is optional. The memo is a string with unspecified bounds. The memo is not included in the final transaction so its contents does not leak to the public ledger when the channel is closed. Subsequently the signatures for close agreements to do not cover the memo.

Why

Payments should have memos so they can be identifiable on the terms of the participants. Participants may communicate about a payment ahead of sending a payment and the memo will provide a way to annotate or identify the payment in whatever way they require.

Note that this is similar but different to #339. #339 is concerned with uniquely identifying payments with an identifier that the state machine attaches to close agreements. That would not be useful in the situation described above where an identifier must be assigned prior to the payment being made.

This is useful for things like buffered channels, something I'm experimenting with right now for #340.

Close #347

@leighmcculloch leighmcculloch linked an issue Sep 30, 2021 that may be closed by this pull request
@leighmcculloch leighmcculloch marked this pull request as ready for review September 30, 2021 02:52
@leighmcculloch leighmcculloch enabled auto-merge (squash) September 30, 2021 15:07
Copy link
Contributor

@acharb acharb left a comment

Choose a reason for hiding this comment

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

lgtm! had 1 💡 but non-blocking

return a.PaymentWithMemo(paymentAmount, "")
}

// Payment makes a payment of the payment amount to the remote participant using
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 can we remove the dup method comment from Payment() above? Since we're re-explaining what the method does here. The Payment comment above could be something like:

// Payment creates a payment using the PaymentWithmemo method with an empty memo.
func (a *Agent) Payment(paymentAmount int64) error {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sdk/state, sdk/agent: add memos to payments
2 participants