multi: add new config option upfront-shutdown-address

Introduced a new config value `upfront-shutdown-address`
in the `lnd.conf` file. This ensures that channel close
funds are transferred to the specified shutdown address.
The value applies to both the funder and the fundee but
can be overridden by the value specified during
`openchannel` or by the `channel acceptor`.

NOTE: If this field is set when opening a channel with a
peer that does not advertise support for upfront shutdown
feature, the channel open will fail.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
This commit is contained in:
Nishant Bansal committed 2025-11-13 19:32:51 +05:30
1 parent af6816b344
commit e4c4d946fd
5 files changed
+62 -6

No files matched your search

+11
View File
@@ -61,6 +61,7 @@ import (
"github.com/lightningnetwork/lnd/lnutils"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
"github.com/lightningnetwork/lnd/lnwallet/chancloser"
"github.com/lightningnetwork/lnd/lnwallet/chanfunding"
"github.com/lightningnetwork/lnd/lnwallet/rpcwallet"
"github.com/lightningnetwork/lnd/lnwire"
@@ -1445,6 +1446,15 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
devCfg, reservationTimeout, zombieSweeperInterval)
}
// Attempt to parse the provided upfront-shutdown address (if any).
script, err := chancloser.ParseUpfrontShutdownAddress(
cfg.UpfrontShutdownAddr, cfg.ActiveNetParams.Params,
)
if err != nil {
return nil, fmt.Errorf("error parsing upfront shutdown: %w",
err)
}
//nolint:ll
s.fundingMgr, err = funding.NewFundingManager(funding.Config{
Dev: devCfg,
@@ -1623,6 +1633,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
AuxSigner: implCfg.AuxSigner,
AuxResolver: implCfg.AuxContractResolver,
AuxChannelNegotiator: implCfg.AuxChannelNegotiator,
ShutdownScript: peer.ChooseAddr(script),
})
if err != nil {
return nil, err