lightning 5.14.0 → 5.15.0

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.
@@ -0,0 +1,79 @@
1
+ const {test} = require('@alexbosworth/tap');
2
+
3
+ const {rpcGroupSessionAsSession} = require('./../../lnd_responses');
4
+
5
+ const makeArgs = overrides => {
6
+ const args = {
7
+ combined_key: Buffer.alloc(32),
8
+ local_public_nonces: Buffer.alloc(66),
9
+ session_id: Buffer.alloc(32),
10
+ taproot_internal_key: Buffer.alloc(32),
11
+ };
12
+
13
+ Object.keys(overrides).forEach(k => args[k] = overrides[k]);
14
+
15
+ return args;
16
+ };
17
+
18
+
19
+ const tests = [
20
+ {
21
+ args: null,
22
+ description: 'A response is expected',
23
+ error: 'ExpectedResponseForMuSig2SessionRequest',
24
+ },
25
+ {
26
+ args: makeArgs({combined_key: undefined}),
27
+ description: 'A combined key is expected',
28
+ error: 'ExpectedCombinedPublicKeyInMuSig2SessionResponse',
29
+ },
30
+ {
31
+ args: makeArgs({local_public_nonces: undefined}),
32
+ description: 'Local public nonces are expected',
33
+ error: 'ExpectedLocalPublicNoncesInMuSig2SessionResponse',
34
+ },
35
+ {
36
+ args: makeArgs({session_id: undefined}),
37
+ description: 'A session id is expected',
38
+ error: 'ExpectedMuSig2SigningSessionIdInSessionResponse',
39
+ },
40
+ {
41
+ args: makeArgs({taproot_internal_key: undefined}),
42
+ description: 'A taproot internal key is expected',
43
+ error: 'ExpectedTaprootInternalKeyInMuSig2SessionResponse',
44
+ },
45
+ {
46
+ args: makeArgs({}),
47
+ description: 'Session data is returned',
48
+ expected: {
49
+ external_key: '0000000000000000000000000000000000000000000000000000000000000000',
50
+ id: '0000000000000000000000000000000000000000000000000000000000000000',
51
+ internal_key: '0000000000000000000000000000000000000000000000000000000000000000',
52
+ nonce: '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
53
+ },
54
+ },
55
+ {
56
+ args: makeArgs({taproot_internal_key: Buffer.alloc(0)}),
57
+ description: 'Session data is returned for a script key',
58
+ expected: {
59
+ external_key: '0000000000000000000000000000000000000000000000000000000000000000',
60
+ id: '0000000000000000000000000000000000000000000000000000000000000000',
61
+ internal_key: undefined,
62
+ nonce: '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
63
+ },
64
+ },
65
+ ];
66
+
67
+ tests.forEach(({args, description, error, expected}) => {
68
+ return test(description, ({end, strictSame, throws}) => {
69
+ if (!!error) {
70
+ throws(() => rpcGroupSessionAsSession(args), new Error(error), 'Error');
71
+ } else {
72
+ const res = rpcGroupSessionAsSession(args);
73
+
74
+ strictSame(res, expected, 'Got expected result');
75
+ }
76
+
77
+ return end();
78
+ });
79
+ });