Skip to content

Commit 9873029

Browse files
authored
Merge pull request #9746 from ziggie1984/make-resolution-more-efficient
lnwallet: no need to consult the aux unit for legacy channels
2 parents c9fe051 + 98384b6 commit 9873029

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

docs/release-notes/release-notes-0.19.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ keysend payment validation is stricter.
115115
* [Fixed](https://github.com/lightningnetwork/lnd/pull/9703) a possible panic
116116
when reloading legacy inflight payments which don't have the MPP feature.
117117

118+
* [Fixed](https://github.com/lightningnetwork/lnd/pull/9746) a possible panic
119+
when running LND with an aux component injected (custom channels).
120+
118121
# New Features
119122

120123
* Add support for [archiving channel backup](https://github.com/lightningnetwork/lnd/pull/9232)

lnwallet/channel.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7351,6 +7351,23 @@ func newOutgoingHtlcResolution(signer input.Signer,
73517351
ControlBlock: ctrlBlock,
73527352
}
73537353

7354+
// In case it is a legacy channel we return early as no aux resolution
7355+
// is neeeded.
7356+
if txSignDetails == nil {
7357+
return &OutgoingHtlcResolution{
7358+
Expiry: htlc.RefundTimeout,
7359+
SignedTimeoutTx: timeoutTx,
7360+
SignDetails: txSignDetails,
7361+
CsvDelay: csvDelay,
7362+
ResolutionBlob: fn.None[tlv.Blob](),
7363+
ClaimOutpoint: wire.OutPoint{
7364+
Hash: timeoutTx.TxHash(),
7365+
Index: 0,
7366+
},
7367+
SweepSignDesc: sweepSignDesc,
7368+
}, nil
7369+
}
7370+
73547371
// This might be an aux channel, so we'll go ahead and attempt to
73557372
// generate the resolution blob for the channel so we can pass along to
73567373
// the sweeping sub-system.
@@ -7694,6 +7711,20 @@ func newIncomingHtlcResolution(signer input.Signer,
76947711
ControlBlock: ctrlBlock,
76957712
}
76967713

7714+
if txSignDetails == nil {
7715+
return &IncomingHtlcResolution{
7716+
SignedSuccessTx: successTx,
7717+
SignDetails: txSignDetails,
7718+
CsvDelay: csvDelay,
7719+
ResolutionBlob: fn.None[tlv.Blob](),
7720+
ClaimOutpoint: wire.OutPoint{
7721+
Hash: successTx.TxHash(),
7722+
Index: 0,
7723+
},
7724+
SweepSignDesc: sweepSignDesc,
7725+
}, nil
7726+
}
7727+
76977728
resolveRes := fn.MapOptionZ(
76987729
auxResolver, func(a AuxContractResolver) fn.Result[tlv.Blob] {
76997730
resReq := ResolutionReq{

0 commit comments

Comments
 (0)