Skip to content

Commit

Permalink
remove support for older versions of lnd
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbosworth committed Oct 23, 2020
1 parent dd05681 commit 5e559cf
Show file tree
Hide file tree
Showing 26 changed files with 153 additions and 209 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Versions

## Version 7.0.0

- Support for versions of LND lower than v0.11.0 is discontinued

## Version 6.5.2

- `increase-inbound-liquidity`: Increase default maximum wait time
Expand Down
1 change: 0 additions & 1 deletion balances/get_liquidity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const {getLiquidity} = require('ln-sync');
const {getNetwork} = require('ln-sync');
const {getNode} = require('ln-service');
const {getScoredNodes} = require('ln-sync');
const {getWalletInfo} = require('ln-service');
const {returnResult} = require('asyncjs-util');

const balanceFromTokens = require('./balance_from_tokens');
Expand Down
3 changes: 2 additions & 1 deletion bos
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ prog
.option('--max-fee <max_fee>', 'Max fee in tokens to pay', INT, 4000)
.option('--no-color', 'Mute all colors')
.option('--node <node_name>', 'Node to receive funds on')
.option('--recovery <refund_recovery>', 'Attempt refund of swap')
.option('--recovery <refund_recovery>', 'Attempt refund of swap', hexMatch)
.option('--refund-address <refund_address>', 'Refund address for swap')
.option('--service-socket <swap_service_socket>', 'host:port for service')
.option('--test-refund', 'Reduce refund timeout height to test refund')
Expand Down Expand Up @@ -635,6 +635,7 @@ prog
// Increase inbound liquidity
.command('increase-inbound-liquidity', 'Increase node inbound liquidity')
.help('Spend down a channel to get inbound. Fee is an estimate, may be more')
.help('If you want to control chain fee increases, use show-raw-recoveries')
.option('--address <out_address>', 'Out chain address to send funds out to')
.option('--api-key <api_key>', 'Pre-paid API key to use')
.option('--avoid <pubkey>', 'Avoid forwarding through node', REPEATABLE)
Expand Down
20 changes: 11 additions & 9 deletions chain/get_channel_closes.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,22 @@ module.exports = ({limit, lnd, request}, cbk) => {

const currentHeight = getHeight.current_block_height;
const isRemoteForceClose = channel.is_remote_force_close;
const init = `${channel.transaction_id}:${channel.transaction_vout}`;

return {
alias: alias || undefined,
peer_public_key: channel.partner_public_key,
peer_alias: alias || undefined,
is_local_force_close: channel.is_local_force_close || undefined,
is_cooperative_close: channel.is_cooperative_close || undefined,
is_remote_force_close: isRemoteForceClose || undefined,
blocks_since_close: currentHeight - channel.close_confirm_height,
capacity: channel.capacity,
close_transaction_id: channel.close_transaction_id,
channel_id: channel.id || undefined,
channel_open: init,
channel_close: channel.close_transaction_id,
channel_balance_spend: channel.close_balance_spent_by || undefined,
channel_resolutions: resolutions || undefined,
is_breach_close: channel.is_breach_close || undefined,
is_cooperative_close: channel.is_cooperative_close || undefined,
is_local_force_close: channel.is_local_force_close || undefined,
is_remote_force_close: isRemoteForceClose || undefined,
output_resolutions: resolutions || undefined,
partner_public_key: channel.partner_public_key,
transaction_id: channel.transaction_id,
transaction_vout: channel.transaction_vout,
};
});
}],
Expand Down
6 changes: 2 additions & 4 deletions encryption/decrypt_with_node.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const asyncAuto = require('async/auto');
const {decodeFirst} = require('cbor');
const {diffieHellmanComputeSecret} = require('ln-service');
const {getIdentity} = require('ln-service');
const {getNode} = require('ln-service');
const {getWalletInfo} = require('ln-service');
const {returnResult} = require('asyncjs-util');

const decryptWithSecret = require('./decrypt_with_secret');
Expand Down Expand Up @@ -64,9 +64,7 @@ module.exports = ({encrypted, lnd}, cbk) => {
}],

// Get node public key
getPublicKey: ['decode', ({decode}, cbk) => {
return getWalletInfo({lnd}, cbk);
}],
getPublicKey: ['decode', ({decode}, cbk) => getIdentity({lnd}, cbk)],

// Determine the foreign key if any
foreignKey: ['decode', 'getPublicKey', ({decode, getPublicKey}, cbk) => {
Expand Down
6 changes: 2 additions & 4 deletions encryption/encrypt_to_node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const asyncAuto = require('async/auto');
const {diffieHellmanComputeSecret} = require('ln-service');
const {getWalletInfo} = require('ln-service');
const {getIdentity} = require('ln-service');
const {returnResult} = require('asyncjs-util');

const encryptToSecret = require('./encrypt_to_secret');
Expand Down Expand Up @@ -36,9 +36,7 @@ module.exports = ({lnd, message, to}, cbk) => {
},

// Get own public key
getPublicKey: ['validate', ({}, cbk) => {
return getWalletInfo({lnd}, cbk);
}],
getPublicKey: ['validate', ({}, cbk) => getIdentity({lnd}, cbk)],

// Encode to public key
toPublicKey: ['getPublicKey', ({getPublicKey}, cbk) => {
Expand Down
4 changes: 1 addition & 3 deletions network/execute_probe.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ module.exports = (args, cbk) => {
const {features} = args;
const start = now();

const method = !features ? subscribeToProbe : subscribeToProbeForRoute;

const timeoutMinutes = minutesAsMs((args.timeout_minutes || Number()));

const sub = method({
const sub = subscribeToProbeForRoute({
cltv_delta: args.cltv_delta,
destination: args.destination,
features: args.features,
Expand Down
63 changes: 0 additions & 63 deletions network/get_identity.js

This file was deleted.

2 changes: 0 additions & 2 deletions network/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const currencyForNetwork = require('./currency_for_network');
const executeProbe = require('./execute_probe');
const getForwards = require('./get_forwards');
const getIdentity = require('./get_identity');
const getPeers = require('./get_peers');
const multiPathPayment = require('./multi_path_payment');
const multiPathProbe = require('./multi_path_probe');
Expand All @@ -21,7 +20,6 @@ module.exports = {
currencyForNetwork,
executeProbe,
getForwards,
getIdentity,
getPeers,
multiPathPayment,
multiPathProbe,
Expand Down
4 changes: 2 additions & 2 deletions network/multi_path_probe.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const asyncAuto = require('async/auto');
const {getChannels} = require('ln-service');
const {getWalletInfo} = require('ln-service');
const {getIdentity} = require('ln-service');
const {returnResult} = require('asyncjs-util');

const multiProbe = require('./multi_probe');
Expand Down Expand Up @@ -77,7 +77,7 @@ module.exports = (args, cbk) => {
}],

// Get the node public key
getKey: ['validate', ({}, cbk) => getWalletInfo({lnd: args.lnd}, cbk)],
getKey: ['validate', ({}, cbk) => getIdentity({lnd: args.lnd}, cbk)],

// Run probe with ignore list
probe: ['getChannels', 'getKey', ({getChannels, getKey}, cbk) => {
Expand Down
8 changes: 3 additions & 5 deletions network/open_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ const asyncTimeout = require('async/timeout');
const {getChainFeeRate} = require('ln-service');
const {getChannels} = require('ln-service');
const {getClosedChannels} = require('ln-service');
const {getIdentity} = require('ln-service');
const {getNetwork} = require('ln-sync');
const {getNode} = require('ln-service');
const {getPeers} = require('ln-service');
const {getPendingChannels} = require('ln-service');
const {getScoredNodes} = require('ln-sync');
const {getWalletInfo} = require('ln-service');
const {openChannel} = require('ln-service');
const {returnResult} = require('asyncjs-util');

Expand Down Expand Up @@ -120,10 +120,8 @@ module.exports = (args, cbk) => {
cbk);
}],

// Get wallet info
getWallet: ['validate', ({}, cbk) => {
return getWalletInfo({lnd: args.lnd}, cbk);
}],
// Get wallet identity
getWallet: ['validate', ({}, cbk) => getIdentity({lnd: args.lnd}, cbk)],

// Get mempool size
getMempool: ['getNetwork', ({getNetwork}, cbk) => {
Expand Down
1 change: 0 additions & 1 deletion network/pay.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const {findKey} = require('ln-sync');
const {formatTokens} = require('ln-sync');
const {getChannels} = require('ln-service');
const {getSyntheticOutIgnores} = require('probing');
const {getWalletInfo} = require('ln-service');
const {parsePaymentRequest} = require('ln-service');
const {returnResult} = require('asyncjs-util');
const {subscribeToMultiPathPay} = require('probing');
Expand Down
3 changes: 1 addition & 2 deletions network/probe_destination.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const {randomBytes} = require('crypto');
const asyncAuto = require('async/auto');
const {decodePaymentRequest} = require('ln-service');
const {getChannels} = require('ln-service');
const {getIdentity} = require('ln-service');
const {getNode} = require('ln-service');
const {getRouteToDestination} = require('ln-service');
const {getRoutes} = require('ln-service');
const {getWalletInfo} = require('ln-service');
const {parsePaymentRequest} = require('invoices');
const {payViaRoutes} = require('ln-service');
Expand All @@ -15,7 +15,6 @@ const {signBytes} = require('ln-service');
const {subscribeToFindMaxPayable} = require('probing');

const executeProbe = require('./execute_probe');
const getIdentity = require('./get_identity');
const {getInboundPath} = require('./../routing');
const {sortBy} = require('./../arrays');

Expand Down
52 changes: 47 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"inquirer": "7.3.3",
"invoices": "1.1.4",
"ln-accounting": "4.1.11",
"ln-service": "49.14.2",
"ln-service": "50.0.1",
"ln-sync": "0.3.0",
"ln-telegram": "3.0.2",
"moment": "2.29.1",
Expand Down Expand Up @@ -73,5 +73,5 @@
"postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis --push .",
"test": "tap test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/fiat/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/responses/*.js test/routing/*.js test/swaps/*.js test/wallets/*.js"
},
"version": "6.5.2"
"version": "7.0.0"
}
4 changes: 2 additions & 2 deletions routing/adjust_fees.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ const {findKey} = require('ln-sync');
const {getChannel} = require('ln-service');
const {getChannels} = require('ln-service');
const {getFeeRates} = require('ln-service');
const {getIdentity} = require('ln-service');
const {getNodeAlias} = require('ln-sync');
const {getPendingChannels} = require('ln-service');
const {gray} = require('colorette');
const {green} = require('colorette');
const {getWalletInfo} = require('ln-service');
const moment = require('moment');
const {Parser} = require('hot-formula-parser');
const {returnResult} = require('asyncjs-util');
Expand Down Expand Up @@ -76,7 +76,7 @@ module.exports = (args, cbk) => {

// Get the wallet public key
getPublicKey: ['validate', ({}, cbk) => {
return getWalletInfo({lnd: args.lnd}, cbk);
return getIdentity({lnd: args.lnd}, cbk);
}],

// Get the current fee rates
Expand Down
Loading

0 comments on commit 5e559cf

Please sign in to comment.