beignet 0.6.6 → 0.6.8
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/dist/cli/beignet-node.js +32 -2
- package/dist/cli/beignet-node.js.map +1 -1
- package/dist/lightning/channel/channel-manager.js +7 -0
- package/dist/lightning/channel/channel-manager.js.map +1 -1
- package/dist/lightning/channel/types.js +7 -1
- package/dist/lightning/channel/types.js.map +1 -1
- package/dist/lightning/gossip/messages.js +13 -1
- package/dist/lightning/gossip/messages.js.map +1 -1
- package/dist/lightning/node/lightning-node.js +128 -16
- package/dist/lightning/node/lightning-node.js.map +1 -1
- package/dist/lightning/onion/failures.js +4 -0
- package/dist/lightning/onion/failures.js.map +1 -1
- package/dist/lightning/onion/types.js +2 -1
- package/dist/lightning/onion/types.js.map +1 -1
- package/dist/lightning/storage/sqlite-storage.js +21 -0
- package/dist/lightning/storage/sqlite-storage.js.map +1 -1
- package/dist/lightning/transport/peer-manager.js +88 -23
- package/dist/lightning/transport/peer-manager.js.map +1 -1
- package/dist/types/cli/beignet-node.d.ts +5 -0
- package/dist/types/lightning/channel/types.d.ts +1 -0
- package/dist/types/lightning/gossip/messages.d.ts +4 -0
- package/dist/types/lightning/node/lightning-node.d.ts +12 -1
- package/dist/types/lightning/onion/types.d.ts +1 -0
- package/dist/types/lightning/storage/sqlite-storage.d.ts +12 -0
- package/dist/types/lightning/storage/types.d.ts +12 -0
- package/dist/types/lightning/transport/peer-manager.d.ts +14 -0
- package/package.json +1 -1
package/dist/cli/beignet-node.js
CHANGED
|
@@ -448,7 +448,8 @@ class BeignetNode extends events_1.EventEmitter {
|
|
|
448
448
|
const pi = this.toPaymentInfo(info);
|
|
449
449
|
this.log('warn', 'Payment failed', {
|
|
450
450
|
paymentHash: pi.paymentHash,
|
|
451
|
-
failureCode: pi.failureCode
|
|
451
|
+
failureCode: pi.failureCode,
|
|
452
|
+
...this.describeFailureSource(info)
|
|
452
453
|
});
|
|
453
454
|
this.emit('payment:failed', pi);
|
|
454
455
|
});
|
|
@@ -2396,6 +2397,26 @@ class BeignetNode extends events_1.EventEmitter {
|
|
|
2396
2397
|
this.node.failPayment(Buffer.from(paymentHash, 'hex'));
|
|
2397
2398
|
return { ok: true };
|
|
2398
2399
|
}
|
|
2400
|
+
describeFailureSource(p) {
|
|
2401
|
+
const index = p.failureSourceIndex;
|
|
2402
|
+
if (index === undefined || !p.route)
|
|
2403
|
+
return {};
|
|
2404
|
+
const fields = { failureSourceIndex: index };
|
|
2405
|
+
const erringHop = p.route.hops[index];
|
|
2406
|
+
if (erringHop) {
|
|
2407
|
+
fields.failureSourceNode = erringHop.pubkey.toString('hex');
|
|
2408
|
+
}
|
|
2409
|
+
const outgoingHop = p.route.hops[index + 1];
|
|
2410
|
+
if (outgoingHop) {
|
|
2411
|
+
try {
|
|
2412
|
+
fields.failureOutgoingScid = formatScid(outgoingHop.shortChannelId);
|
|
2413
|
+
}
|
|
2414
|
+
catch {
|
|
2415
|
+
fields.failureOutgoingScid = outgoingHop.shortChannelId.toString('hex');
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
return fields;
|
|
2419
|
+
}
|
|
2399
2420
|
toPaymentInfo(p) {
|
|
2400
2421
|
const info = {
|
|
2401
2422
|
paymentHash: p.paymentHash.toString('hex'),
|
|
@@ -2951,7 +2972,16 @@ class BeignetNode extends events_1.EventEmitter {
|
|
|
2951
2972
|
return this.node.estimatePayment(bolt11, amountSats);
|
|
2952
2973
|
}
|
|
2953
2974
|
probeRoute(destination, amountSats) {
|
|
2954
|
-
|
|
2975
|
+
const result = this.node.probeRoute(destination, amountSats);
|
|
2976
|
+
if (!result.path)
|
|
2977
|
+
return result;
|
|
2978
|
+
return {
|
|
2979
|
+
...result,
|
|
2980
|
+
path: result.path.map((hop) => ({
|
|
2981
|
+
pubkey: hop.pubkey,
|
|
2982
|
+
shortChannelId: formatScid(Buffer.from(hop.shortChannelId, 'hex'))
|
|
2983
|
+
}))
|
|
2984
|
+
};
|
|
2955
2985
|
}
|
|
2956
2986
|
getGraphInfo() {
|
|
2957
2987
|
const graph = this.node.getGraph();
|