lightning 7.1.2 → 7.1.3
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
CHANGED
|
@@ -7,6 +7,7 @@ const {isLnd} = require('./../../lnd_requests');
|
|
|
7
7
|
const bufFromHex = hex => Buffer.from(hex, 'hex');
|
|
8
8
|
const {fromHex} = Transaction;
|
|
9
9
|
const method = 'publishTransaction';
|
|
10
|
+
const minRelayFeeError = /^unmatched backend error: -26: mempool min fee not met, (\d*) < (\d*)$/;
|
|
10
11
|
const type = 'wallet';
|
|
11
12
|
|
|
12
13
|
/** Publish a raw blockchain transaction to Blockchain network peers
|
|
@@ -51,6 +52,19 @@ module.exports = ({description, lnd, transaction}, cbk) => {
|
|
|
51
52
|
tx_hex: bufFromHex(transaction),
|
|
52
53
|
},
|
|
53
54
|
(err, res) => {
|
|
55
|
+
if (!!err && minRelayFeeError.test(err.details)) {
|
|
56
|
+
const [, got, expected] = err.details.match(minRelayFeeError);
|
|
57
|
+
|
|
58
|
+
return cbk([
|
|
59
|
+
503,
|
|
60
|
+
'ChainBackendMinimumRelayFeeNotMet',
|
|
61
|
+
{
|
|
62
|
+
fee: Number(got),
|
|
63
|
+
minimum: Number(expected),
|
|
64
|
+
}
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
|
|
54
68
|
if (!!err) {
|
|
55
69
|
return cbk([503, 'UnexpectedErrBroadcastingRawTx', {err}]);
|
|
56
70
|
}
|
package/package.json
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/lightning/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@grpc/grpc-js": "1.8.
|
|
10
|
+
"@grpc/grpc-js": "1.8.12",
|
|
11
11
|
"@grpc/proto-loader": "0.7.5",
|
|
12
12
|
"@types/express": "4.17.17",
|
|
13
|
-
"@types/node": "18.14.
|
|
13
|
+
"@types/node": "18.14.6",
|
|
14
14
|
"@types/request": "2.48.8",
|
|
15
15
|
"@types/ws": "8.5.4",
|
|
16
16
|
"async": "3.2.4",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@alexbosworth/node-fetch": "2.6.2",
|
|
34
34
|
"@alexbosworth/tap": "15.0.12",
|
|
35
|
-
"tsd": "0.
|
|
35
|
+
"tsd": "0.26.1",
|
|
36
36
|
"typescript": "4.9.5",
|
|
37
37
|
"ws": "8.12.1"
|
|
38
38
|
},
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"directory": "test/typescript"
|
|
60
60
|
},
|
|
61
61
|
"types": "index.d.ts",
|
|
62
|
-
"version": "7.1.
|
|
62
|
+
"version": "7.1.3"
|
|
63
63
|
}
|
|
@@ -46,6 +46,27 @@ const tests = [
|
|
|
46
46
|
{res: {publish_error: 'err'}},
|
|
47
47
|
],
|
|
48
48
|
},
|
|
49
|
+
{
|
|
50
|
+
args: {
|
|
51
|
+
lnd: {
|
|
52
|
+
wallet: {
|
|
53
|
+
publishTransaction: ({}, cbk) => cbk({
|
|
54
|
+
details: 'unmatched backend error: -26: mempool min fee not met, 123 < 1234',
|
|
55
|
+
}),
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
transaction: new Transaction().toHex(),
|
|
59
|
+
},
|
|
60
|
+
description: 'Minimum relay fee not met',
|
|
61
|
+
error: [
|
|
62
|
+
503,
|
|
63
|
+
'ChainBackendMinimumRelayFeeNotMet',
|
|
64
|
+
{
|
|
65
|
+
fee: 123,
|
|
66
|
+
minimum: 1234,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
49
70
|
{
|
|
50
71
|
args: {
|
|
51
72
|
lnd: {wallet: {publishTransaction: ({}, cbk) => cbk(null, {})}},
|
|
@@ -5,7 +5,7 @@ const {beginGroupSigningSession} = require('./../../../');
|
|
|
5
5
|
const makeLnd = (err, res) => {
|
|
6
6
|
return {
|
|
7
7
|
signer: {
|
|
8
|
-
muSig2CreateSession: ({}, cbk) => cbk(err, res)
|
|
8
|
+
muSig2CreateSession: ({}, cbk) => cbk(err, res),
|
|
9
9
|
},
|
|
10
10
|
wallet: {
|
|
11
11
|
deriveKey: ({}, cbk) => cbk(null, {
|
|
@@ -84,6 +84,153 @@ const tests = [
|
|
|
84
84
|
description: 'A valid response is expected',
|
|
85
85
|
error: [503, 'ExpectedCombinedPublicKeyInMuSig2SessionResponse'],
|
|
86
86
|
},
|
|
87
|
+
{
|
|
88
|
+
args: makeArgs({
|
|
89
|
+
lnd: {
|
|
90
|
+
signer: {
|
|
91
|
+
muSig2CreateSession: (args, cbk) => {
|
|
92
|
+
if (args.version === 'MUSIG2_VERSION_V100RC2') {
|
|
93
|
+
return cbk({
|
|
94
|
+
details: 'error parsing signer public key 0: bad pubkey byte string size (want 32, have 33)',
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return cbk({
|
|
99
|
+
details: 'unknown method MuSig2CreateSession for service signrpc.Signer',
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
wallet: {
|
|
104
|
+
deriveKey: ({}, cbk) => cbk(null, {
|
|
105
|
+
key_loc: {key_index: 0},
|
|
106
|
+
raw_key_bytes: Buffer.alloc(1),
|
|
107
|
+
}),
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
}),
|
|
111
|
+
description: 'Just in case unsupported message is supported',
|
|
112
|
+
error: [501, 'MuSig2BeginSigningSessionNotSupported'],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
args: makeArgs({
|
|
116
|
+
lnd: {
|
|
117
|
+
signer: {
|
|
118
|
+
muSig2CreateSession: (args, cbk) => {
|
|
119
|
+
if (args.version === 'MUSIG2_VERSION_V100RC2') {
|
|
120
|
+
return cbk({
|
|
121
|
+
details: 'error parsing signer public key 0: bad pubkey byte string size (want 32, have 33)',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return cbk('err');
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
wallet: {
|
|
129
|
+
deriveKey: ({}, cbk) => cbk(null, {
|
|
130
|
+
key_loc: {key_index: 0},
|
|
131
|
+
raw_key_bytes: Buffer.alloc(1),
|
|
132
|
+
}),
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
}),
|
|
136
|
+
description: 'Errors are passed back',
|
|
137
|
+
error: [503, 'UnexpectedErrorCreatingMuSig2Session', {err: 'err'}],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
args: makeArgs({
|
|
141
|
+
lnd: {
|
|
142
|
+
signer: {
|
|
143
|
+
muSig2CreateSession: (args, cbk) => {
|
|
144
|
+
if (args.version === 'MUSIG2_VERSION_V100RC2') {
|
|
145
|
+
return cbk({
|
|
146
|
+
details: 'error parsing signer public key 0: bad pubkey byte string size (want 32, have 33)',
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return cbk(null, {});
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
wallet: {
|
|
154
|
+
deriveKey: ({}, cbk) => cbk(null, {
|
|
155
|
+
key_loc: {key_index: 0},
|
|
156
|
+
raw_key_bytes: Buffer.alloc(1),
|
|
157
|
+
}),
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
}),
|
|
161
|
+
description: 'A valid response is expected',
|
|
162
|
+
error: [503, 'ExpectedCombinedPublicKeyInMuSig2SessionResponse'],
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
args: makeArgs({
|
|
166
|
+
lnd: {
|
|
167
|
+
signer: {
|
|
168
|
+
muSig2CreateSession: (args, cbk) => {
|
|
169
|
+
if (args.version === 'MUSIG2_VERSION_V100RC2') {
|
|
170
|
+
return cbk({
|
|
171
|
+
details: 'error parsing signer public key 0: bad pubkey byte string size (want 32, have 33)',
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return cbk(null, {
|
|
176
|
+
combined_key: Buffer.alloc(32, 1),
|
|
177
|
+
local_public_nonces: Buffer.alloc(66, 1),
|
|
178
|
+
session_id: Buffer.alloc(32, 1),
|
|
179
|
+
taproot_internal_key: Buffer.alloc(0),
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
wallet: {
|
|
184
|
+
deriveKey: ({}, cbk) => cbk(null, {
|
|
185
|
+
key_loc: {key_index: 0},
|
|
186
|
+
raw_key_bytes: Buffer.alloc(1),
|
|
187
|
+
}),
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
}),
|
|
191
|
+
description: 'Legacy signer is supported',
|
|
192
|
+
expected: {
|
|
193
|
+
external_key: '0101010101010101010101010101010101010101010101010101010101010101',
|
|
194
|
+
id: '0101010101010101010101010101010101010101010101010101010101010101',
|
|
195
|
+
internal_key: undefined,
|
|
196
|
+
nonce: '010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101',
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
args: makeArgs({
|
|
201
|
+
lnd: {
|
|
202
|
+
signer: {
|
|
203
|
+
muSig2CreateSession: (args, cbk) => {
|
|
204
|
+
if (args.version === 'MUSIG2_VERSION_V100RC2') {
|
|
205
|
+
return cbk({
|
|
206
|
+
details: 'error parsing all signer public keys: error parsing signer public key 0 for v1.0.0rc2 (compressed format): malformed public key: invalid length: 32',
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return cbk(null, {
|
|
211
|
+
combined_key: Buffer.alloc(32, 1),
|
|
212
|
+
local_public_nonces: Buffer.alloc(66, 1),
|
|
213
|
+
session_id: Buffer.alloc(32, 1),
|
|
214
|
+
taproot_internal_key: Buffer.alloc(0),
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
wallet: {
|
|
219
|
+
deriveKey: ({}, cbk) => cbk(null, {
|
|
220
|
+
key_loc: {key_index: 0},
|
|
221
|
+
raw_key_bytes: Buffer.alloc(1),
|
|
222
|
+
}),
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
226
|
+
description: 'Legacy signer is supported when invalid keys specified',
|
|
227
|
+
expected: {
|
|
228
|
+
external_key: '0101010101010101010101010101010101010101010101010101010101010101',
|
|
229
|
+
id: '0101010101010101010101010101010101010101010101010101010101010101',
|
|
230
|
+
internal_key: undefined,
|
|
231
|
+
nonce: '010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
87
234
|
{
|
|
88
235
|
args: makeArgs({}),
|
|
89
236
|
description: 'A group signing session is started',
|