-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include outgoing payment description in audit memo #182
Conversation
a19de94
to
c05f82a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the improvement!
One question about order of precedence.
accounting/filter.go
Outdated
} | ||
|
||
if destination == nil { | ||
destination, _ = paymentHtlcDestination(payment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change alters the preference. Before, the data from paymentHtlcDestination
took preference over paymentRequestDestination()
. Now it's the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to inspect the payment request in order to get the description. So, given that we will always be inspecting the payment request if one exists, it seems that inspecting the HTLCs only makes sense as a fallback in case we weren't able to get the destination from the payment request.
Is there an expectation that the destination obtained from the HTLC's could be different from the destination in the payment request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm not sure. That's why I'm not really comfortable changing the logic here. Would need to dig into the lnd code and docs to find out. But maybe @carlaKC has a quick answer for me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed an additional commit which returns the original order of precedence for the destination
It does add some additional overhead though since in many cases we'd be inspecting HTLCs to find the destination even though we already know it from inspecting the payment request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please squash the two commits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
5598875
to
fa72d02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, LGTM 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @mrfelton 🎉
accounting/filter.go
Outdated
} | ||
|
||
if destination == nil { | ||
destination, _ = paymentHtlcDestination(payment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please squash the two commits?
c478467
to
650327b
Compare
Thanks for the reviews. Addressed the style nit and squashed all the commits. |
Include invoice memo in audit nodes for outgoing payments that pay to an invoice. This allows for more options to correlate money movements during reconciliation.
Context: Improves ability to reconcile payments related to peerswaps. See ElementsProject/peerswap#254 for additional context.
This pull request involves changes to the
accounting
package, specifically theentries.go
,entries_test.go
,filter.go
, andfilter_test.go
files. The changes primarily involve the addition of adescription
field to thepaymentInfo
struct and the modification of thepaymentNote
function to include thememo
field. The changes also involve modifications to thepaymentEntry
andpaymentRequestDetails
functions to accommodate the newdescription
field.Fix #181
Changes to
entries.go
andentries_test.go
:func paymentReference(sequenceNumber uint64, preimage lntypes.Preimage) string {
: Modified thepaymentNote
function to include amemo
field and to append thememo
anddest
fields to anotes
slice. The function now returns a string joined by thenotes
slice elements instead of just thedest
string.func paymentEntry(payment paymentInfo, paidToSelf bool,
: Modified thepaymentNote
function call in thepaymentEntry
function to include thepayment.description
field.func TestPaymentEntry(t *testing.T) {
: Modified thepaymentNote
function call in theTestPaymentEntry
test function to include the&invoiceMemo
field. [1] [2]Changes to
filter.go
andfilter_test.go
:type paymentInfo struct {
: Added adescription
field to thepaymentInfo
struct.func preProcessPayments(payments []lndclient.Payment,
: Modified thepreProcessPayments
function to include thedescription
field in thepaymentInfo
struct.func paymentRequestDetails(paymentRequest string, decode decodePaymentRequest) (*route.Vertex, *string, error) {
: Renamed thepaymentRequestDestination
function topaymentRequestDetails
and modified it to return adescription
field in addition to thedestination
field.func TestPaymentRequestDestination(t *testing.T) {
: Renamed theTestPaymentRequestDestination
test function toTestPaymentRequestDetails
and modified it to test thedescription
field in addition to thedestination
field. [1] [2]