beignet 0.36.0 → 0.36.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.
|
@@ -6161,10 +6161,15 @@ class LightningNode extends typed_emitter_1.TypedEmitter {
|
|
|
6161
6161
|
* Void a channel whose funding tx vanished before confirming and cannot
|
|
6162
6162
|
* (or can no longer) be rebroadcast: drop it from the manager, retire its
|
|
6163
6163
|
* watch, its persisted state and any retained funding tx, and tell the
|
|
6164
|
-
* embedder via channel:voided.
|
|
6164
|
+
* embedder via channel:voided. `txid` is in display byte order; the
|
|
6165
|
+
* retained funding tx is keyed by the internal order it reverses to.
|
|
6165
6166
|
*/
|
|
6166
6167
|
voidMissingFundingChannel(channelId, txid) {
|
|
6167
6168
|
const idHex = channelId.toString('hex');
|
|
6169
|
+
// The funding as the channel holds it (internal byte order), read
|
|
6170
|
+
// before the channel is removed: the direct-funding receipts it paid
|
|
6171
|
+
// are marked by it once the void is durable (issue #1909).
|
|
6172
|
+
const voidedFunding = this.getRawChannel(channelId)?.getFullState().fundingTxid;
|
|
6168
6173
|
// Durable FIRST: the live channel and its funding watch are only
|
|
6169
6174
|
// removed once the deletion, or at least the durable intent to
|
|
6170
6175
|
// delete, exists on disk. Removing them first and failing both
|
|
@@ -6182,6 +6187,13 @@ class LightningNode extends typed_emitter_1.TypedEmitter {
|
|
|
6182
6187
|
});
|
|
6183
6188
|
return false;
|
|
6184
6189
|
}
|
|
6190
|
+
// The void is the durable decision that this funding is not on chain,
|
|
6191
|
+
// so a direct-funding payment it carried never landed (issue #1909).
|
|
6192
|
+
// A zero-conf open locks before its funding confirms, and its receipt
|
|
6193
|
+
// keeps a lockedAt; REVERTED is the status that takes the payment back.
|
|
6194
|
+
if (voidedFunding) {
|
|
6195
|
+
this.getDirectFundingRequests()?.markReceivedReverted(Buffer.from(voidedFunding).reverse().toString('hex'));
|
|
6196
|
+
}
|
|
6185
6197
|
if (!this.channelManager.voidChannel(channelId))
|
|
6186
6198
|
return true;
|
|
6187
6199
|
this.chainWatcher?.removeWatchedFunding(channelId);
|
|
@@ -23068,6 +23080,19 @@ class LightningNode extends typed_emitter_1.TypedEmitter {
|
|
|
23068
23080
|
};
|
|
23069
23081
|
this.on('channel:ready', ({ channelId }) => markLocked(channelId));
|
|
23070
23082
|
this.on('splice:complete', ({ channelId }) => markLocked(channelId));
|
|
23083
|
+
// Every other way a channel is voided (an open abandoned before it
|
|
23084
|
+
// funded, a condemned row deleted at start) removes a channel that
|
|
23085
|
+
// never funded, so a payment recorded against it never landed
|
|
23086
|
+
// either (issue #1909). Matched by channel, since the row is gone.
|
|
23087
|
+
this.on('channel:voided', ({ channelId }) => {
|
|
23088
|
+
const idHex = channelId.toString('hex');
|
|
23089
|
+
const fundings = new Set(requests
|
|
23090
|
+
.received()
|
|
23091
|
+
.filter((r) => r.channelId === idHex && r.status === 'PAID')
|
|
23092
|
+
.map((r) => r.fundingTxid));
|
|
23093
|
+
for (const funding of fundings)
|
|
23094
|
+
requests.markReceivedReverted(funding);
|
|
23095
|
+
});
|
|
23071
23096
|
this.directFunding = {
|
|
23072
23097
|
requests,
|
|
23073
23098
|
registry,
|
|
@@ -23866,7 +23891,11 @@ class LightningNode extends typed_emitter_1.TypedEmitter {
|
|
|
23866
23891
|
// keeps the pledges: a restart would restore the open and its
|
|
23867
23892
|
// inputs must still be reserved.
|
|
23868
23893
|
const pledges = channel.getReleasableV2PledgeOutpoints();
|
|
23869
|
-
|
|
23894
|
+
// Display byte order, as the funding-missing watch passes it:
|
|
23895
|
+
// voidMissingFundingChannel reverses it into the internal-order
|
|
23896
|
+
// key of the retained funding tx. Internal order here missed the
|
|
23897
|
+
// key, so the void left this attempt's retained tx on disk.
|
|
23898
|
+
const voided = this.voidMissingFundingChannel(channelId, Buffer.from(state.fundingTxid).reverse().toString('hex'));
|
|
23870
23899
|
if (voided && pledges.length > 0) {
|
|
23871
23900
|
(0, funding_selection_1.releaseInputPledgesBestEffort)(this.fundingProvider, pledges);
|
|
23872
23901
|
}
|