lightning 10.7.1 → 10.8.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 +4 -0
- package/README.md +2 -0
- package/grpc/protos/autopilot.proto +20 -2
- package/index.js +2 -0
- package/lnd_methods/index.js +2 -0
- package/lnd_methods/macaroon/methods.json +4 -0
- package/lnd_methods/peers/index.js +2 -0
- package/lnd_methods/peers/remove_advertised_feature.d.ts +20 -0
- package/lnd_methods/peers/remove_advertised_feature.js +62 -0
- package/package.json +5 -5
- package/test/lnd_methods/peers/test_remove_advertised_feature.js +57 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -271,6 +271,8 @@ variables set:
|
|
|
271
271
|
Attempt to recover channel funds from a specific channel backup.
|
|
272
272
|
- [recoverFundsFromChannels](https://github.com/alexbosworth/ln-service#recoverfundsfromchannels):
|
|
273
273
|
Attempt to recover funds from multiple channels using a multiple channel backup.
|
|
274
|
+
- [removeAdvertisedFeature](https://github.com/alexbosworth/ln-service#removeadvertisedfeature):
|
|
275
|
+
Remove a supported feature from the graph node announcement
|
|
274
276
|
- [removeExternalSocket](https://github.com/alexbosworth/ln-service#removeexternalsocket):
|
|
275
277
|
Remove a LN p2p network socket from the node advertisement
|
|
276
278
|
- [removePeer](https://github.com/alexbosworth/ln-service#removepeer): Disconnect from a
|
|
@@ -4,11 +4,29 @@ package autopilotrpc;
|
|
|
4
4
|
|
|
5
5
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/autopilotrpc";
|
|
6
6
|
|
|
7
|
+
/*
|
|
8
|
+
* Comments in this file will be directly parsed into the API
|
|
9
|
+
* Documentation as descriptions of the associated method, message, or field.
|
|
10
|
+
* These descriptions should go right above the definition of the object, and
|
|
11
|
+
* can be in either block or // comment format.
|
|
12
|
+
*
|
|
13
|
+
* An RPC method can be matched to an lncli command by placing a line in the
|
|
14
|
+
* beginning of the description in exactly the following format:
|
|
15
|
+
* lncli: `methodname`
|
|
16
|
+
*
|
|
17
|
+
* Failure to specify the exact name of the command will cause documentation
|
|
18
|
+
* generation to fail.
|
|
19
|
+
*
|
|
20
|
+
* More information on how exactly the gRPC documentation is generated from
|
|
21
|
+
* this proto file can be found here:
|
|
22
|
+
* https://github.com/lightninglabs/lightning-api
|
|
23
|
+
*/
|
|
24
|
+
|
|
7
25
|
// Autopilot is a service that can be used to get information about the current
|
|
8
26
|
// state of the daemon's autopilot agent, and also supply it with information
|
|
9
27
|
// that can be used when deciding where to open channels.
|
|
10
28
|
service Autopilot {
|
|
11
|
-
/*
|
|
29
|
+
/* lncli: `autopilot status`
|
|
12
30
|
Status returns whether the daemon's autopilot agent is active.
|
|
13
31
|
*/
|
|
14
32
|
rpc Status (StatusRequest) returns (StatusResponse);
|
|
@@ -19,7 +37,7 @@ service Autopilot {
|
|
|
19
37
|
*/
|
|
20
38
|
rpc ModifyStatus (ModifyStatusRequest) returns (ModifyStatusResponse);
|
|
21
39
|
|
|
22
|
-
/*
|
|
40
|
+
/* lncli: `autopilot query`
|
|
23
41
|
QueryScores queries all available autopilot heuristics, in addition to any
|
|
24
42
|
active combination of these heruristics, for the scores they would give to
|
|
25
43
|
the given nodes.
|
package/index.js
CHANGED
|
@@ -97,6 +97,7 @@ const {probeForRoute} = require('./lnd_methods');
|
|
|
97
97
|
const {proposeChannel} = require('./lnd_methods');
|
|
98
98
|
const {recoverFundsFromChannel} = require('./lnd_methods');
|
|
99
99
|
const {recoverFundsFromChannels} = require('./lnd_methods');
|
|
100
|
+
const {removeAdvertisedFeature} = require('./lnd_methods');
|
|
100
101
|
const {removeExternalSocket} = require('./lnd_methods');
|
|
101
102
|
const {removePeer} = require('./lnd_methods');
|
|
102
103
|
const {requestChainFeeIncrease} = require('./lnd_methods');
|
|
@@ -253,6 +254,7 @@ module.exports = {
|
|
|
253
254
|
proposeChannel,
|
|
254
255
|
recoverFundsFromChannel,
|
|
255
256
|
recoverFundsFromChannels,
|
|
257
|
+
removeAdvertisedFeature,
|
|
256
258
|
removeExternalSocket,
|
|
257
259
|
removePeer,
|
|
258
260
|
requestChainFeeIncrease,
|
package/lnd_methods/index.js
CHANGED
|
@@ -97,6 +97,7 @@ const {probeForRoute} = require('./offchain');
|
|
|
97
97
|
const {proposeChannel} = require('./onchain');
|
|
98
98
|
const {recoverFundsFromChannel} = require('./offchain');
|
|
99
99
|
const {recoverFundsFromChannels} = require('./offchain');
|
|
100
|
+
const {removeAdvertisedFeature} = require('./peers');
|
|
100
101
|
const {removeExternalSocket} = require('./peers');
|
|
101
102
|
const {removePeer} = require('./peers');
|
|
102
103
|
const {requestChainFeeIncrease} = require('./onchain');
|
|
@@ -252,6 +253,7 @@ module.exports = {
|
|
|
252
253
|
proposeChannel,
|
|
253
254
|
recoverFundsFromChannel,
|
|
254
255
|
recoverFundsFromChannels,
|
|
256
|
+
removeAdvertisedFeature,
|
|
255
257
|
removeExternalSocket,
|
|
256
258
|
removePeer,
|
|
257
259
|
requestChainFeeIncrease,
|
|
@@ -388,6 +388,10 @@
|
|
|
388
388
|
"method": "restoreChannelBackups",
|
|
389
389
|
"type": "default"
|
|
390
390
|
},
|
|
391
|
+
"removeAdvertisedFeature": {
|
|
392
|
+
"method": "updateNodeAnnouncement",
|
|
393
|
+
"type": "peers"
|
|
394
|
+
},
|
|
391
395
|
"removeExternalSocket": {
|
|
392
396
|
"method": "updateNodeAnnouncement",
|
|
393
397
|
"type": "peers"
|
|
@@ -2,6 +2,7 @@ const addAdvertisedFeature = require('./add_advertised_feature');
|
|
|
2
2
|
const addExternalSocket = require('./add_external_socket');
|
|
3
3
|
const addPeer = require('./add_peer');
|
|
4
4
|
const getPeers = require('./get_peers');
|
|
5
|
+
const removeAdvertisedFeature = require('./remove_advertised_feature');
|
|
5
6
|
const removeExternalSocket = require('./remove_external_socket');
|
|
6
7
|
const removePeer = require('./remove_peer');
|
|
7
8
|
const subscribeToPeers = require('./subscribe_to_peers');
|
|
@@ -13,6 +14,7 @@ module.exports = {
|
|
|
13
14
|
addExternalSocket,
|
|
14
15
|
addPeer,
|
|
15
16
|
getPeers,
|
|
17
|
+
removeAdvertisedFeature,
|
|
16
18
|
removeExternalSocket,
|
|
17
19
|
removePeer,
|
|
18
20
|
subscribeToPeers,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthenticatedLightningArgs,
|
|
3
|
+
AuthenticatedLightningMethod,
|
|
4
|
+
} from '../../typescript/shared';
|
|
5
|
+
|
|
6
|
+
export type RemoveAdvertisedFeature = AuthenticatedLightningArgs<{
|
|
7
|
+
/** BOLT 09 Feature Bit Number */
|
|
8
|
+
feature: number;
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Remove an advertised feature from the graph node announcement
|
|
13
|
+
*
|
|
14
|
+
* Note: this method is not supported in LND versions 0.14.5 and below
|
|
15
|
+
*
|
|
16
|
+
* Requires LND built with `peersrpc` build tag
|
|
17
|
+
*
|
|
18
|
+
* Requires `peers:write` permissions
|
|
19
|
+
*/
|
|
20
|
+
export const removeAdvertisedFeature: AuthenticatedLightningMethod<RemoveAdvertisedFeature>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const asyncAuto = require('async/auto');
|
|
2
|
+
const {returnResult} = require('asyncjs-util');
|
|
3
|
+
|
|
4
|
+
const {isLnd} = require('./../../lnd_requests');
|
|
5
|
+
|
|
6
|
+
const action = 1;
|
|
7
|
+
const errorUnimplemented = 'unknown service peersrpc.Peers';
|
|
8
|
+
const method = 'updateNodeAnnouncement';
|
|
9
|
+
const type = 'peers';
|
|
10
|
+
|
|
11
|
+
/** Remove an advertised feature from the graph node announcement
|
|
12
|
+
|
|
13
|
+
Note: this method is not supported in LND versions 0.14.5 and below
|
|
14
|
+
|
|
15
|
+
Requires LND built with `peersrpc` build tag
|
|
16
|
+
|
|
17
|
+
Requires `peers:write` permissions
|
|
18
|
+
|
|
19
|
+
{
|
|
20
|
+
feature: <BOLT 09 Feature Bit Number>
|
|
21
|
+
lnd: <Authenticated LND API Object>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@returns via cbk or Promise
|
|
25
|
+
*/
|
|
26
|
+
module.exports = ({feature, lnd}, cbk) => {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
return asyncAuto({
|
|
29
|
+
// Check arguments
|
|
30
|
+
validate: cbk => {
|
|
31
|
+
if (!feature) {
|
|
32
|
+
return cbk([400, 'ExpectedFeatureToRemoveAnnouncementFeature']);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!isLnd({lnd, method, type})) {
|
|
36
|
+
return cbk([400, 'ExpectedLndToRemoveNodeAnnouncementFeature']);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return cbk();
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// Update the node features with the updated feature
|
|
43
|
+
updateFeatures: ['validate', ({}, cbk) => {
|
|
44
|
+
return lnd[type][method]({
|
|
45
|
+
feature_updates: [{action, feature_bit: feature}],
|
|
46
|
+
},
|
|
47
|
+
(err, res) => {
|
|
48
|
+
if (!!err && err.details === errorUnimplemented) {
|
|
49
|
+
return cbk([400, 'ExpectedPeersRpcLndBuildTagToRemoveFeature']);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!!err) {
|
|
53
|
+
return cbk([503, 'UnexpectedErrorRemovingNodeFeature', {err}]);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return cbk();
|
|
57
|
+
});
|
|
58
|
+
}],
|
|
59
|
+
},
|
|
60
|
+
returnResult({reject, resolve}, cbk));
|
|
61
|
+
});
|
|
62
|
+
};
|
package/package.json
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/lightning/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@grpc/grpc-js": "1.10.
|
|
10
|
+
"@grpc/grpc-js": "1.10.3",
|
|
11
11
|
"@grpc/proto-loader": "0.7.10",
|
|
12
|
-
"@types/node": "20.11.
|
|
12
|
+
"@types/node": "20.11.30",
|
|
13
13
|
"@types/request": "2.48.12",
|
|
14
14
|
"@types/ws": "8.5.10",
|
|
15
15
|
"async": "3.2.5",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"invoices": "3.0.0",
|
|
23
23
|
"psbt": "3.0.0",
|
|
24
24
|
"tiny-secp256k1": "2.2.3",
|
|
25
|
-
"type-fest": "4.
|
|
25
|
+
"type-fest": "4.13.1"
|
|
26
26
|
},
|
|
27
27
|
"description": "Lightning Network client library",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsd": "0.30.7",
|
|
30
|
-
"typescript": "5.4.
|
|
30
|
+
"typescript": "5.4.3"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=18"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"directory": "test/typescript"
|
|
54
54
|
},
|
|
55
55
|
"types": "index.d.ts",
|
|
56
|
-
"version": "10.
|
|
56
|
+
"version": "10.8.1"
|
|
57
57
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const {rejects} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
|
|
4
|
+
const {removeAdvertisedFeature} = require('./../../../');
|
|
5
|
+
|
|
6
|
+
const makeLnd = ({err}) => {
|
|
7
|
+
return {peers: {updateNodeAnnouncement: (args, cbk) => cbk(err)}};
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const makeArgs = overrides => {
|
|
11
|
+
const args = {feature: 127, lnd: makeLnd({})};
|
|
12
|
+
|
|
13
|
+
Object.keys(overrides).forEach(key => args[key] = overrides[key]);
|
|
14
|
+
|
|
15
|
+
return args;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const tests = [
|
|
19
|
+
{
|
|
20
|
+
args: makeArgs({feature: undefined}),
|
|
21
|
+
description: 'A feature is required to remove an advertised feature',
|
|
22
|
+
error: [400, 'ExpectedFeatureToRemoveAnnouncementFeature'],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
args: makeArgs({lnd: undefined}),
|
|
26
|
+
description: 'LND is required to remove an advertised feature',
|
|
27
|
+
error: [400, 'ExpectedLndToRemoveNodeAnnouncementFeature'],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
args: makeArgs({
|
|
31
|
+
lnd: makeLnd({err: {details: 'unknown service peersrpc.Peers'}}),
|
|
32
|
+
}),
|
|
33
|
+
description: 'LND with peersrpc is required to remove a feature',
|
|
34
|
+
error: [400, 'ExpectedPeersRpcLndBuildTagToRemoveFeature'],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
args: makeArgs({lnd: makeLnd({err: 'err'})}),
|
|
38
|
+
description: 'LND error is returned',
|
|
39
|
+
error: [503, 'UnexpectedErrorRemovingNodeFeature', {err: 'err'}],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
args: makeArgs({}),
|
|
43
|
+
description: 'Feature removed successfully',
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
tests.forEach(({args, description, error, expected}) => {
|
|
48
|
+
return test(description, async () => {
|
|
49
|
+
if (!!error) {
|
|
50
|
+
await rejects(() => removeAdvertisedFeature(args), error, 'Got error');
|
|
51
|
+
} else {
|
|
52
|
+
await removeAdvertisedFeature(args);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return;
|
|
56
|
+
});
|
|
57
|
+
});
|