ln-accounting 7.0.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/package.json +2 -2
- package/records/get_all_invoices.js +15 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"bitcoinjs-lib": "6.1.0",
|
|
14
14
|
"goldengate": "12.0.5",
|
|
15
15
|
"hot-formula-parser": "4.0.0",
|
|
16
|
-
"ln-service": "56.
|
|
16
|
+
"ln-service": "56.3.0"
|
|
17
17
|
},
|
|
18
18
|
"description": "lnd accounting reports",
|
|
19
19
|
"devDependencies": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "tap --branches=1 --functions=1 --lines=1 --statements=1 test/blockstream/*.js test/fiat/*.js test/harmony/*.js test/records/*.js test/report/*.js"
|
|
38
38
|
},
|
|
39
|
-
"version": "7.0.
|
|
39
|
+
"version": "7.0.1"
|
|
40
40
|
}
|
|
@@ -3,6 +3,7 @@ const asyncUntil = require('async/until');
|
|
|
3
3
|
const {getInvoices} = require('ln-service');
|
|
4
4
|
const {returnResult} = require('asyncjs-util');
|
|
5
5
|
|
|
6
|
+
const bufferTimeMs = 1000 * 60 * 60 * 36;
|
|
6
7
|
const limit = 1000;
|
|
7
8
|
|
|
8
9
|
/** Get all confirmed invoices
|
|
@@ -55,8 +56,20 @@ module.exports = ({after, before, lnd}, cbk) => {
|
|
|
55
56
|
return cbk();
|
|
56
57
|
},
|
|
57
58
|
|
|
59
|
+
// Adjust after date to allow for date slippage
|
|
60
|
+
createdAfter: ['validate', ({}, cbk) => {
|
|
61
|
+
if (!after) {
|
|
62
|
+
return cbk(null, undefined);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Adjust the after date to make sure no records are being left out
|
|
66
|
+
const target = new Date(after).getTime() - bufferTimeMs;
|
|
67
|
+
|
|
68
|
+
return cbk(null, new Date(target));
|
|
69
|
+
}],
|
|
70
|
+
|
|
58
71
|
// Get all the invoices through iterative paging
|
|
59
|
-
getInvoices: ['
|
|
72
|
+
getInvoices: ['createdAfter', ({createdAfter}, cbk) => {
|
|
60
73
|
const invoices = [];
|
|
61
74
|
let token;
|
|
62
75
|
|
|
@@ -67,6 +80,7 @@ module.exports = ({after, before, lnd}, cbk) => {
|
|
|
67
80
|
return getInvoices({
|
|
68
81
|
lnd,
|
|
69
82
|
token,
|
|
83
|
+
created_after: createdAfter,
|
|
70
84
|
limit: !token ? limit : undefined,
|
|
71
85
|
},
|
|
72
86
|
(err, res) => {
|