Commit graph

79 commits

Author SHA1 Message Date
Boris Nagaev
3431cd8c9e
accounting: add error messages for errors
Replaced "return err" cases with wrapped errors to attach the info which may be
useful when debugging.
2025-10-02 14:26:31 -03:00
Elle Mouton
617c793ec3
multi: update LND, lndclient and btclog deps 2025-03-05 11:51:45 +02:00
nordbjorn
771d1ae381
Only fetch onchain transactions from LND within start_time and end_time range 2025-01-20 11:05:10 +01:00
Oliver Gugger
9f4a63ace4
Merge pull request #182 from LN-Zap/payment-description
Include outgoing payment description in audit memo
2024-02-14 03:11:07 -06:00
Tom Kirkpatrick
650327bde7
Include outgoing payment description in audit memo 2024-02-13 22:12:24 +00:00
Andras Banki-Horvath
c84f709043
faraday: bump LND dependecy to v0.17.4-beta 2024-02-09 17:55:09 +01:00
Tom Kirkpatrick
a66fa119d8
Record fees for utxo management transactions 2024-02-07 19:45:02 +00:00
Oliver Gugger
c80a59758c
multi: bump lnd+lndclient compile time dependency 2023-02-24 19:18:54 +01:00
Oliver Gugger
71bb06f6f7
multi: fix linter issues, run imports 2022-11-21 17:12:17 +01:00
Oliver Gugger
f2fbbb34a1
multi: bump lnd version to v0.15.4-beta 2022-11-21 16:27:26 +01:00
positiveblue
d24b4e2557
multi: bump btcec/v2 and btcutil to new versions 2022-03-25 16:55:04 +01:00
Elle Mouton
71b47dc8ee
multi: add PriceSourceConfig struct
Add a PriceSourceConfig struct to consolidate the options required for
initialising a new PriceSource.
2021-08-27 16:12:25 +02:00
Elle Mouton
4a7199f38d
multi: rename MsatToUSD func to MsatToFiat
Rename the MsatToUSD functino to MsatToFiat so that the name is
appropriate for multiple currencies.
2021-08-27 16:01:51 +02:00
Elle Mouton
b6404b7c40
accounting: rename usdPrice func type to fiatPrice
Rename usdPrice func type to fiatPrice so that the name is appropriate
for multiple fiat currencies.
2021-08-27 15:55:09 +02:00
Elle Mouton
8b213c7640
multi: rename USDPrice struct to Price
Rename the USDPrice struct to Price so that it can be used to represent
more than 1 currency.
2021-08-27 15:54:13 +02:00
Elle Mouton
7203f3e405 multi: fix NewPriceSource typo
This commit fixes a typo in the NewPriceSource function name.
2021-05-20 14:52:15 +02:00
Elle Mouton
38a0790a3c multi: add fiat backend option to RPC endpoints
This commit adds a fiat_backends option to the RPC relevant RPC
endpoints. Namely, the NodeAudit and ExchangeRate endpoint.
2021-05-14 10:46:29 +02:00
Elle Mouton
9b5599be37 fiat: add fiatBackend interface
This commit adds a fiatBackend interface that added fiat backend needs
to implement.
2021-05-14 10:46:24 +02:00
carla
091033a178
multi: add detailed errors and more logging 2021-05-05 10:57:02 +02:00
carla
2a13fa459c
docs: move accounting docs to docs dir
To allign with our other projects, move our accounting docs into a base
docs dir. Since we've sent the existing link out, we leave a docs file
pointing to our new docs location so nobody gets lost.
2020-11-26 15:09:35 +02:00
Carsten Otto
d166b7e1ab accounting: remove duplicate "msat" unit in outputs
Before: "incoming: 51 mSAT msat outgoing: 51 mSAT msat"
After:  "incoming: 51 mSAT outgoing: 51 mSAT"
2020-11-17 13:04:38 +00:00
Carsten Otto
97c233f1b9 accounting: fix typos 2020-11-17 13:03:59 +00:00
carla
442fa2ab19
mutli: add custom categories to node audit rpc 2020-10-27 13:23:41 +02:00
carla
169b0cf6e8
accounting: add custom categories field to report
Allow matching of regex expressions to our various categories so that
we can provide custom categories for the report.
2020-10-15 11:31:03 +02:00
carla
6e78e0c4e3
accounting: add entry utils struct to pass functions to entry creation 2020-10-15 11:30:58 +02:00
carla
759e532c61
accounting: add string function to entry types 2020-10-15 11:29:24 +02:00
carla
447fd7a7c6
accounting: allow no fee function and skip fee entries
To allow running our accounting report without a backing bitcoin node,
we allow the fee function provided to be nil. In these cases, we log
the entries which we cannot lookup fees for so that users have the
option to manually lookup those fees.
2020-09-09 10:41:38 +02:00
carla
2be7115ebe
multi: standardize import order 2020-09-09 10:07:14 +02:00
carla
599623fd6e
multi: do not require granularity parameter when fiat is disabled
Previsously, we would try to get the best fiat granularity for a period
even if the disable fiat flag was set. If the period queried is longer
than the longest time that we can query the coincap api for, our request
would fail. This is not practically an issue, because the API allows
20 years of data, but this error does stop setting of a 0 start time,
which is nice for getting an all time report for your node.
2020-08-24 14:39:29 +02:00
carla
b573d8f87e
accounting: export fee reference for itests 2020-08-12 11:37:42 +02:00
carla
5153b69672
bugfix: account for double counting of fee in listchaintxns output
LND includes the fee amount in the total amount for a transaction and
lists it in the fee field. In this change we separate the fee from the
amount so that we do not double count. We do not expect fees for
receives, so we add a check for this.
2020-08-12 11:15:04 +02:00
carla
fb9884611c
accounting: lookup fees for sweep transactions 2020-08-12 11:15:01 +02:00
carla
e426cadd5c
accounting: do not record zero value on chain transactions
When the remote party spends one of our htlcs on chain, we report a zero
value transaction. These are of no auditing value, since they are
exposed in more detail in lnd's close summary, so we ignore them.
2020-08-12 11:14:59 +02:00
carla
7d2ee52f32
accounting: add channel close fee for channels we initiated 2020-08-12 11:14:56 +02:00
carla
dc3dd515b1
accounting: add pending channels to on chain report
Previously, if we generated a report while a channel was pending open
or close, it would not have been picked up as a channel. This change
adds pending channels and simplifies our on chain sorting to just have
opened and closed channels (independent of the source where we got the
channel information).
2020-08-12 11:14:49 +02:00
Carla Kirk-Cohen
c270a34a20
Merge pull request #60 from carlaKC/fiat-timestamped
fiat: update api to provide timestamped bitcoin prices and use in accounting
2020-07-22 16:57:21 +02:00
carla
72dec6db9b
multi: allow specifying of granularity level for report generation 2020-07-22 16:41:37 +02:00
carla
600722a938
accounting: add bitcoin price to harmony entry 2020-07-22 16:41:28 +02:00
carla
7eae580b1f
accounting: create common config struct for shared fields 2020-07-22 16:41:20 +02:00
carla
01fe055104
multi: return full datapoint for fiat, and use earlier timestamp
Update our price getting function to return the timestamped data point
so that prices are easier to audit. We also choose to earlier timestamp
rather than picking the average when a timestamp lies between two points
to make our calculation more transparent.
2020-07-22 16:40:05 +02:00
Carla Kirk-Cohen
faffc78c6d
Merge pull request #59 from carlaKC/onchain-continueafterchannel
bugfix: add continue after adding open channel entry
2020-07-06 09:05:16 +02:00
carla
bf3ac31ffe
accounting: add continue after adding open channel entry
If we do not continue after adding an open channel event, we will
double count our channel open as an on chain payment.
2020-06-29 15:52:20 +02:00
carla
b110781039
accounting: update payment note to include destination node 2020-06-29 10:56:23 +02:00
carla
a9baf39b8d
accounting: fallback to payment request for payments without htlcs
We have a lot of different payment formats in lnd, since the payments
database has been migrated multiple times. We need to account for the
following:
- Legacy payments: settled, no htlcs present
- In flight payments: not settled, no htlcs present
- Keysend payments: no payment request
- Sendpayment + dest: no payment request present

Since we need to list all payments (an invoice settled in our period
could have been send by a payment before the period), we update our
code to not fail in the case where we do not know payment destination.
This will result in legacy circular payments (that were made with no
payment request) not being identified as circular payments (as well as
their corresponding invoices). We log an error for this, and make a
note of it in our docs. This should not be an issue for payments made
by newer versions on lnd, because they have the information we require.
2020-06-29 10:56:20 +02:00
carla
23bc75cb92
multi: use route.Vertex rather than pubkey string 2020-06-29 10:56:15 +02:00
carla
8956d41e46
multi: update lndclient to version with decodePayReq 2020-06-29 10:56:09 +02:00
carla
e8b7a197e4
multi: add option to disable fiat pricing for reports
For testing, or users uninterested in fiat prices, we add an option to
disable querying for fiat prices.
2020-06-26 08:46:46 +02:00
carla
66d98ba346
accounting: add constructors for report config structs
Our reporting config structs are quite large, and require wrapping
paginated calls, so we add a constructor to easily create these structs.
This is particularly useful for packages that import this package
rather than running faraday as as service.
2020-06-26 08:45:40 +02:00
carla
61a850e9f5
accounting: move config into its own file 2020-06-25 16:54:11 +02:00
carla
27a6810841
multi: remove granularity from rpc endpoints
The granularity with which we query our price backend is an
implementation detail that we don't need to expose to users. Rather than
making this configurable, we just calculate our best possible level
of granularity server side, and leave this decision out of the user's
hands.
2020-06-23 11:39:29 +02:00