mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-13 18:10:25 +02:00
lnwallet/chancloser: add state transitions for new protofsm rbf closer
In this commit, we add the state transitions for the new protofsm based RBF chan closer. The underlying protocol is a new asymmetric co-op close process, wherein either side can initiate a chan closer, and use their settled funds to pay for fees within the channel.
This commit is contained in:
@@ -539,8 +539,8 @@ func (c *ChanCloser) AuxOutputs() fn.Option[AuxCloseOutputs] {
|
||||
// upfront script is set, we check whether it matches the script provided by
|
||||
// our peer. If they do not match, we use the disconnect function provided to
|
||||
// disconnect from the peer.
|
||||
func validateShutdownScript(disconnect func() error, upfrontScript,
|
||||
peerScript lnwire.DeliveryAddress, netParams *chaincfg.Params) error {
|
||||
func validateShutdownScript(upfrontScript, peerScript lnwire.DeliveryAddress,
|
||||
netParams *chaincfg.Params) error {
|
||||
|
||||
// Either way, we'll make sure that the script passed meets our
|
||||
// standards. The upfrontScript should have already been checked at an
|
||||
@@ -568,12 +568,6 @@ func validateShutdownScript(disconnect func() error, upfrontScript,
|
||||
chancloserLog.Warnf("peer's script: %x does not match upfront "+
|
||||
"shutdown script: %x", peerScript, upfrontScript)
|
||||
|
||||
// Disconnect from the peer because they have violated option upfront
|
||||
// shutdown.
|
||||
if err := disconnect(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return ErrUpfrontShutdownScriptMismatch
|
||||
}
|
||||
|
||||
@@ -630,7 +624,6 @@ func (c *ChanCloser) ReceiveShutdown(msg lnwire.Shutdown) (
|
||||
// If the remote node opened the channel with option upfront
|
||||
// shutdown script, check that the script they provided matches.
|
||||
if err := validateShutdownScript(
|
||||
c.cfg.Disconnect,
|
||||
c.cfg.Channel.RemoteUpfrontShutdownScript(),
|
||||
msg.Address, c.cfg.ChainParams,
|
||||
); err != nil {
|
||||
@@ -681,7 +674,6 @@ func (c *ChanCloser) ReceiveShutdown(msg lnwire.Shutdown) (
|
||||
// If the remote node opened the channel with option upfront
|
||||
// shutdown script, check that the script they provided matches.
|
||||
if err := validateShutdownScript(
|
||||
c.cfg.Disconnect,
|
||||
c.cfg.Channel.RemoteUpfrontShutdownScript(),
|
||||
msg.Address, c.cfg.ChainParams,
|
||||
); err != nil {
|
||||
|
Reference in New Issue
Block a user