mirror of
https://github.com/alexbosworth/balanceofsatoshis.git
synced 2026-08-13 12:33:37 +02:00
show execution time on rebalance
This commit is contained in:
parent
a42a305049
commit
9c3648d04f
6 changed files with 48 additions and 45 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Versions
|
||||
|
||||
## 19.0.3
|
||||
## 19.0.4
|
||||
|
||||
- `offer-channel-open`: Correct PPM fee pricing for custom lifetime lengths
|
||||
|
||||
|
|
|
|||
|
|
@ -112,11 +112,12 @@ module.exports = ({lnd, query}, cbk) => {
|
|||
channels: res.channels,
|
||||
nodes: [{
|
||||
alias: res.alias,
|
||||
capacity: res.capacity,
|
||||
color: res.color,
|
||||
features: res.features,
|
||||
public_key: getKey.value.public_key,
|
||||
sockets: res.sockets.map(n => n.socket),
|
||||
updated_at: res.last_updated,
|
||||
updated_at: res.updated_at,
|
||||
}],
|
||||
});
|
||||
});
|
||||
|
|
@ -192,7 +193,7 @@ module.exports = ({lnd, query}, cbk) => {
|
|||
|
||||
return {
|
||||
alias: node.alias,
|
||||
capacity: asBigUnit(getGraph.channels.reduce(
|
||||
capacity: asBigUnit(node.capacity || getGraph.channels.reduce(
|
||||
(sum, {capacity, policies}) => {
|
||||
if (!policies.find(n => n.public_key === node.public_key)) {
|
||||
return sum;
|
||||
|
|
|
|||
63
package-lock.json
generated
63
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "balanceofsatoshis",
|
||||
"version": "19.0.3",
|
||||
"version": "19.0.4",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "balanceofsatoshis",
|
||||
"version": "19.0.3",
|
||||
"version": "19.0.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@alexbosworth/blockchain": "2.0.0",
|
||||
|
|
@ -636,14 +636,14 @@
|
|||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/ajv": {
|
||||
"version": "8.16.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.16.0.tgz",
|
||||
"integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==",
|
||||
"version": "8.17.1",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",
|
||||
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"fast-uri": "^3.0.1",
|
||||
"json-schema-traverse": "^1.0.0",
|
||||
"require-from-string": "^2.0.2",
|
||||
"uri-js": "^4.4.1"
|
||||
"require-from-string": "^2.0.2"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
|
|
@ -1613,6 +1613,11 @@
|
|||
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="
|
||||
},
|
||||
"node_modules/fast-uri": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz",
|
||||
"integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw=="
|
||||
},
|
||||
"node_modules/fecha": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz",
|
||||
|
|
@ -3369,14 +3374,6 @@
|
|||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/pushdata-bitcoin": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pushdata-bitcoin/-/pushdata-bitcoin-1.0.1.tgz",
|
||||
|
|
@ -4220,14 +4217,6 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/utf8-byte-length": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz",
|
||||
|
|
@ -4893,14 +4882,14 @@
|
|||
}
|
||||
},
|
||||
"ajv": {
|
||||
"version": "8.16.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.16.0.tgz",
|
||||
"integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==",
|
||||
"version": "8.17.1",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",
|
||||
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
|
||||
"requires": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"fast-uri": "^3.0.1",
|
||||
"json-schema-traverse": "^1.0.0",
|
||||
"require-from-string": "^2.0.2",
|
||||
"uri-js": "^4.4.1"
|
||||
"require-from-string": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"ansi-escapes": {
|
||||
|
|
@ -5681,6 +5670,11 @@
|
|||
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="
|
||||
},
|
||||
"fast-uri": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz",
|
||||
"integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw=="
|
||||
},
|
||||
"fecha": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz",
|
||||
|
|
@ -7075,11 +7069,6 @@
|
|||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="
|
||||
},
|
||||
"pushdata-bitcoin": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pushdata-bitcoin/-/pushdata-bitcoin-1.0.1.tgz",
|
||||
|
|
@ -7735,14 +7724,6 @@
|
|||
"resolved": "https://registry.npmjs.org/untildify/-/untildify-3.0.3.tgz",
|
||||
"integrity": "sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA=="
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||
"requires": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"utf8-byte-length": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz",
|
||||
|
|
|
|||
|
|
@ -84,5 +84,5 @@
|
|||
"postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
|
||||
"test": "npx nyc@15.1.0 node --experimental-test-coverage --test test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/peers/*.js test/responses/*.js test/routing/*.js test/services/*.js test/swaps/*.js test/tags/*.js test/telegram/*.js test/wallets/*.js"
|
||||
},
|
||||
"version": "19.0.3"
|
||||
"version": "19.0.4"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ module.exports = (args, cbk) => {
|
|||
|
||||
// Run the rebalance
|
||||
rebalance: ['validate', ({}, cbk) => {
|
||||
const start = new Date().toISOString();
|
||||
|
||||
return asyncRetry({
|
||||
errorFilter: err => {
|
||||
// Do not retry on invalid errors
|
||||
|
|
@ -87,6 +89,7 @@ module.exports = (args, cbk) => {
|
|||
},
|
||||
cbk => {
|
||||
return rebalance({
|
||||
start,
|
||||
avoid: args.avoid,
|
||||
fs: args.fs,
|
||||
in_filters: args.in_filters,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ const {getIdentity} = require('ln-service');
|
|||
const {getNode} = require('ln-service');
|
||||
const {getPeerLiquidity} = require('ln-sync');
|
||||
const {getWalletVersion} = require('ln-service');
|
||||
const moment = require('moment');
|
||||
const {parseAmount} = require('ln-accounting');
|
||||
const {payViaRoutes} = require('ln-service');
|
||||
const {returnResult} = require('asyncjs-util');
|
||||
|
|
@ -84,6 +85,7 @@ const uniq = arr => Array.from(new Set(arr));
|
|||
[out_filters]: [<Outbound Filter Formula String>]
|
||||
[out_inbound]: <Outbound Target Inbound Liquidity Tokens Number>
|
||||
[out_through]: <Pay Out Through Peer String>
|
||||
[start]: <ISO 8601 Start Date String>
|
||||
[timeout_minutes]: <Deadline To Stop Rebalance Minutes Number>
|
||||
}
|
||||
|
||||
|
|
@ -836,6 +838,19 @@ module.exports = (args, cbk) => {
|
|||
});
|
||||
}],
|
||||
|
||||
// Calculate rebalance time
|
||||
time: ['pay', ({}, cbk) => {
|
||||
// Exit early when no start time was specified
|
||||
if (!args.start) {
|
||||
return cbk();
|
||||
}
|
||||
|
||||
const end = new moment();
|
||||
const start = new moment(new Date(args.start));
|
||||
|
||||
return cbk(null, moment.duration(end.diff(start)).humanize());
|
||||
}],
|
||||
|
||||
// Get adjusted inbound liquidity after rebalance
|
||||
getAdjustedInbound: ['getInbound', 'pay', ({getInbound, pay}, cbk) => {
|
||||
return getPeerLiquidity({
|
||||
|
|
@ -864,6 +879,7 @@ module.exports = (args, cbk) => {
|
|||
'getInbound',
|
||||
'getOutbound',
|
||||
'pay',
|
||||
'time',
|
||||
({
|
||||
discount,
|
||||
getAdjustedInbound,
|
||||
|
|
@ -871,6 +887,7 @@ module.exports = (args, cbk) => {
|
|||
getInbound,
|
||||
getOutbound,
|
||||
pay,
|
||||
time,
|
||||
},
|
||||
cbk) =>
|
||||
{
|
||||
|
|
@ -888,6 +905,7 @@ module.exports = (args, cbk) => {
|
|||
|
||||
return cbk(null, {
|
||||
got_inbound_fee_discount: discount.lowered,
|
||||
total_execution_time: time,
|
||||
rebalance: [
|
||||
{
|
||||
increased_inbound_on: inOn,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue