Merge pull request #9746 from ziggie1984/make-resolution-more-efficient

lnwallet: no need to consult the aux unit for legacy channels
This commit is contained in:
Oliver Gugger
2025-04-22 18:56:28 +02:00
committed by GitHub
2 changed files with 34 additions and 0 deletions

View File

@@ -115,6 +115,9 @@ keysend payment validation is stricter.
* [Fixed](https://github.com/lightningnetwork/lnd/pull/9703) a possible panic
when reloading legacy inflight payments which don't have the MPP feature.
* [Fixed](https://github.com/lightningnetwork/lnd/pull/9746) a possible panic
when running LND with an aux component injected (custom channels).
# New Features
* Add support for [archiving channel backup](https://github.com/lightningnetwork/lnd/pull/9232)

View File

@@ -7351,6 +7351,23 @@ func newOutgoingHtlcResolution(signer input.Signer,
ControlBlock: ctrlBlock,
}
// In case it is a legacy channel we return early as no aux resolution
// is neeeded.
if txSignDetails == nil {
return &OutgoingHtlcResolution{
Expiry: htlc.RefundTimeout,
SignedTimeoutTx: timeoutTx,
SignDetails: txSignDetails,
CsvDelay: csvDelay,
ResolutionBlob: fn.None[tlv.Blob](),
ClaimOutpoint: wire.OutPoint{
Hash: timeoutTx.TxHash(),
Index: 0,
},
SweepSignDesc: sweepSignDesc,
}, nil
}
// This might be an aux channel, so we'll go ahead and attempt to
// generate the resolution blob for the channel so we can pass along to
// the sweeping sub-system.
@@ -7694,6 +7711,20 @@ func newIncomingHtlcResolution(signer input.Signer,
ControlBlock: ctrlBlock,
}
if txSignDetails == nil {
return &IncomingHtlcResolution{
SignedSuccessTx: successTx,
SignDetails: txSignDetails,
CsvDelay: csvDelay,
ResolutionBlob: fn.None[tlv.Blob](),
ClaimOutpoint: wire.OutPoint{
Hash: successTx.TxHash(),
Index: 0,
},
SweepSignDesc: sweepSignDesc,
}, nil
}
resolveRes := fn.MapOptionZ(
auxResolver, func(a AuxContractResolver) fn.Result[tlv.Blob] {
resReq := ResolutionReq{