beignet 0.20.1 → 0.21.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.
- package/dist/cli/beignet-node.js +12 -3
- package/dist/cli/beignet-node.js.map +1 -1
- package/dist/cli/daemon.js +1 -0
- package/dist/cli/daemon.js.map +1 -1
- package/dist/cli/errors.js +2 -0
- package/dist/cli/errors.js.map +1 -1
- package/dist/electrum/index.js +208 -39
- package/dist/electrum/index.js.map +1 -1
- package/dist/lightning/direct-funding/sender/engine.js +3 -1
- package/dist/lightning/direct-funding/sender/engine.js.map +1 -1
- package/dist/lightning/direct-funding/sender/types.js +3 -1
- package/dist/lightning/direct-funding/sender/types.js.map +1 -1
- package/dist/lightning/direct-funding/transport/direct-peer.js +44 -3
- package/dist/lightning/direct-funding/transport/direct-peer.js.map +1 -1
- package/dist/lightning/direct-funding/transport/onion.js +2 -0
- package/dist/lightning/direct-funding/transport/onion.js.map +1 -1
- package/dist/lightning/direct-funding/transport/registry.js +33 -6
- package/dist/lightning/direct-funding/transport/registry.js.map +1 -1
- package/dist/lightning/direct-funding/transport/types.js +1 -0
- package/dist/lightning/direct-funding/transport/types.js.map +1 -1
- package/dist/lightning/node/lightning-node.js +83 -12
- package/dist/lightning/node/lightning-node.js.map +1 -1
- package/dist/lightning/node/types.js.map +1 -1
- package/dist/lightning/storage/serialization.js +2 -0
- package/dist/lightning/storage/serialization.js.map +1 -1
- package/dist/types/cli/beignet-node.d.ts +1 -0
- package/dist/types/cli/errors.d.ts +1 -0
- package/dist/types/electrum/index.d.ts +3 -0
- package/dist/types/lightning/direct-funding/transport/types.d.ts +4 -1
- package/dist/types/lightning/node/lightning-node.d.ts +2 -0
- package/dist/types/lightning/node/types.d.ts +1 -0
- package/dist/types/lightning/storage/serialization.d.ts +1 -0
- package/dist/types/wallet/index.d.ts +7 -1
- package/dist/wallet/index.js +36 -8
- package/dist/wallet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/beignet-node.js
CHANGED
|
@@ -4613,6 +4613,14 @@ class BeignetNode extends events_1.EventEmitter {
|
|
|
4613
4613
|
info.expiry = opts.expiry;
|
|
4614
4614
|
return info;
|
|
4615
4615
|
}
|
|
4616
|
+
holdResolutionRefusal(paymentHash, action, notFound) {
|
|
4617
|
+
const parked = this.node
|
|
4618
|
+
.listHeldHtlcs()
|
|
4619
|
+
.find((h) => h.paymentHash.equals(paymentHash));
|
|
4620
|
+
if (!parked)
|
|
4621
|
+
return new errors_1.BeignetError(errors_1.BeignetErrorCode.NOT_FOUND, notFound);
|
|
4622
|
+
return new errors_1.BeignetError(errors_1.BeignetErrorCode.HOLD_RESOLUTION_PENDING, `${parked.htlcCount} parked HTLC(s) remain for this payment hash: a channel refused the ${action} for them, or a settle or cancel is already under way`);
|
|
4623
|
+
}
|
|
4616
4624
|
settleHoldInvoice(preimage) {
|
|
4617
4625
|
if (!/^[0-9a-fA-F]{64}$/.test(preimage)) {
|
|
4618
4626
|
throw new errors_1.BeignetError(errors_1.BeignetErrorCode.INVALID_PARAMS, 'preimage must be 32 bytes hex (64 hex chars)');
|
|
@@ -4624,7 +4632,7 @@ class BeignetNode extends events_1.EventEmitter {
|
|
|
4624
4632
|
.digest();
|
|
4625
4633
|
const settled = this.node.settleHeldHtlc(paymentHash, preimageBuf);
|
|
4626
4634
|
if (!settled) {
|
|
4627
|
-
throw
|
|
4635
|
+
throw this.holdResolutionRefusal(paymentHash, 'settle', 'No parked HTLCs for this preimage (invoice unknown, not yet paid, or already resolved)');
|
|
4628
4636
|
}
|
|
4629
4637
|
return { paymentHash: paymentHash.toString('hex') };
|
|
4630
4638
|
}
|
|
@@ -4632,9 +4640,10 @@ class BeignetNode extends events_1.EventEmitter {
|
|
|
4632
4640
|
if (!/^[0-9a-fA-F]{64}$/.test(paymentHash)) {
|
|
4633
4641
|
throw new errors_1.BeignetError(errors_1.BeignetErrorCode.INVALID_PARAMS, 'paymentHash must be 32 bytes hex (64 hex chars)');
|
|
4634
4642
|
}
|
|
4635
|
-
const
|
|
4643
|
+
const hash = Buffer.from(paymentHash, 'hex');
|
|
4644
|
+
const result = this.node.cancelHoldInvoice(hash);
|
|
4636
4645
|
if (!result) {
|
|
4637
|
-
throw
|
|
4646
|
+
throw this.holdResolutionRefusal(hash, 'cancel', 'No open hold invoice for this payment hash');
|
|
4638
4647
|
}
|
|
4639
4648
|
return { paymentHash, htlcsFailed: result.htlcsFailed };
|
|
4640
4649
|
}
|