-
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
Record fees for self initiated sweeps to self (utxo management) #180
Conversation
2c9a2dd
to
622e098
Compare
119b246
to
dc2efc5
Compare
dc2efc5
to
ec2a019
Compare
83f0a0b
to
73249f1
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 PR. I think this gets the job done. Can't really think of an other or easier way to detect a manual consolidation TX.
Just to complete my understanding, how did such a transaction show up in faraday
before?
Maybe it would be worth adding the scenario to the integration tests to make sure the result is what we expect.
Also, can you please squash your commits? Thanks.
It didn't. It was totally omitted.
I have added tests that prove that these types of transactions are now included in the report. |
79a78e1
to
3807b91
Compare
Comments addressed and commits squashed. |
accounting/entries.go
Outdated
} | ||
|
||
// createOnchainFeeEntry creates a fee entry for an on chain transaction. | ||
func createOnchainFeeEntry( |
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.
Can you please take a look at the formatting guideline doc I shared? Or the surrounding code? This isn't how we want our function definitions to be formatted.
Alternatively I can also push a fix commit to your branch if you don't want to deal with it.
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 missed the link in your prior comment. I've pushed an update with that style fix. Shame that make fmt
doesn't handle that properly.
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!
Shame that
make fmt
doesn't handle that properly.
Yeah, definitely. One of the biggest downsides of Go is that there is no configurable formatter such as prettier
...
3807b91
to
02cf164
Compare
02cf164
to
4db6f14
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.
LGTM, thanks for the fix @mrfelton 🥇
accounting/entries.go
Outdated
@@ -260,6 +309,16 @@ func onChainEntries(tx lndclient.Transaction, | |||
return nil, nil | |||
} | |||
|
|||
// If this is a utxo management transaction, we return a fee entry only. | |||
if utxoManagement { | |||
feeEntry, err := createOnchainFeeEntry(tx, category, utxoManagementFeeNote(tx.TxHash), u) |
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.
style nit: line too long
|
||
// createOnchainFeeEntry creates a fee entry for an on chain transaction. | ||
func createOnchainFeeEntry(tx lndclient.Transaction, category string, | ||
note string, u entryUtils) (*HarmonyEntry, error) { |
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.
style-nit: we usually add a new line to separate the function body a bit better visually if the signature is multiline.
accounting/entries_test.go
Outdated
@@ -502,11 +502,12 @@ func TestSweepEntry(t *testing.T) { | |||
// generation of a fee entry where applicable. | |||
func TestOnChainEntry(t *testing.T) { | |||
getOnChainEntry := func(amount btcutil.Amount, | |||
hasFee bool, label string) []*HarmonyEntry { | |||
hasFee bool, isUtxoManagement bool, label string, note string) []*HarmonyEntry { |
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.
style nit: line too long
4db6f14
to
a66fa11
Compare
Thanks @bhandras I've addressed the style nits and force pushed an updated squashed commit |
Create onchain fee entry for self initiated sweeps that pay to self. Ensures that fees relating to UTXO management (utxo consolidation or splitting) are included in the audit reports.
A note is added to the management entries to denote them as such.
Fixes #137
Example entry
Questions
FEE
entry. But maybe we should also have an onchain payment and an onchain receive to go with it? Or, we could create it asSWEEP_FEE
(andSWEEP
) entry