contractcourt+lnd: make IncubateOutputs take fn.Option

`IncubateOutputs` never takes more than one HTLC, so we change the
params to be optional, which helps with the following commit where we
pass the deadline height when incubating outgoing HTLCs.
This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:34 +08:00
1 parent 6f0c2b5bab
commit 33abbe1942
9 files changed
+44 -40

No files matched your search

+4 -14
View File
@@ -38,6 +38,7 @@ import (
"github.com/lightningnetwork/lnd/contractcourt"
"github.com/lightningnetwork/lnd/discovery"
"github.com/lightningnetwork/lnd/feature"
"github.com/lightningnetwork/lnd/fn"
"github.com/lightningnetwork/lnd/funding"
"github.com/lightningnetwork/lnd/healthcheck"
"github.com/lightningnetwork/lnd/htlcswitch"
@@ -1148,23 +1149,12 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
return nil
},
IncubateOutputs: func(chanPoint wire.OutPoint,
outHtlcRes *lnwallet.OutgoingHtlcResolution,
inHtlcRes *lnwallet.IncomingHtlcResolution,
outHtlcRes fn.Option[lnwallet.OutgoingHtlcResolution],
inHtlcRes fn.Option[lnwallet.IncomingHtlcResolution],
broadcastHeight uint32) error {
var (
inRes []lnwallet.IncomingHtlcResolution
outRes []lnwallet.OutgoingHtlcResolution
)
if inHtlcRes != nil {
inRes = append(inRes, *inHtlcRes)
}
if outHtlcRes != nil {
outRes = append(outRes, *outHtlcRes)
}
return s.utxoNursery.IncubateOutputs(
chanPoint, outRes, inRes,
chanPoint, outHtlcRes, inHtlcRes,
broadcastHeight,
)
},