diff --git a/lnwallet/chancloser/chancloser_test.go b/lnwallet/chancloser/chancloser_test.go index d0211414c..f7bdc74b4 100644 --- a/lnwallet/chancloser/chancloser_test.go +++ b/lnwallet/chancloser/chancloser_test.go @@ -189,7 +189,7 @@ func (m *mockChannel) RemoteUpfrontShutdownScript() lnwire.DeliveryAddress { func (m *mockChannel) CreateCloseProposal(fee btcutil.Amount, localScript, remoteScript []byte, - _ ...lnwallet.ChanCloseOpt) (input.Signature, *chainhash.Hash, + _ ...lnwallet.ChanCloseOpt) (input.Signature, *wire.MsgTx, btcutil.Amount, error) { if m.chanType.IsTaproot() { diff --git a/lnwallet/chancloser/interface.go b/lnwallet/chancloser/interface.go index f774c8103..74f096973 100644 --- a/lnwallet/chancloser/interface.go +++ b/lnwallet/chancloser/interface.go @@ -3,7 +3,6 @@ package chancloser import ( "github.com/btcsuite/btcd/btcec/v2/schnorr/musig2" "github.com/btcsuite/btcd/btcutil" - "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/fn/v2" @@ -100,7 +99,7 @@ type Channel interface { //nolint:interfacebloat localDeliveryScript []byte, remoteDeliveryScript []byte, closeOpt ...lnwallet.ChanCloseOpt, ) ( - input.Signature, *chainhash.Hash, btcutil.Amount, error) + input.Signature, *wire.MsgTx, btcutil.Amount, error) // CompleteCooperativeClose persistently "completes" the cooperative // close by producing a fully signed co-op close transaction. diff --git a/lnwallet/chancloser/mock.go b/lnwallet/chancloser/mock.go index c6ea4fba2..a2cc4270c 100644 --- a/lnwallet/chancloser/mock.go +++ b/lnwallet/chancloser/mock.go @@ -153,11 +153,11 @@ type mockCloseSigner struct { func (m *mockCloseSigner) CreateCloseProposal(fee btcutil.Amount, localScript []byte, remoteScript []byte, closeOpt ...lnwallet.ChanCloseOpt) ( - input.Signature, *chainhash.Hash, btcutil.Amount, error) { + input.Signature, *wire.MsgTx, btcutil.Amount, error) { args := m.Called(fee, localScript, remoteScript, closeOpt) - return args.Get(0).(input.Signature), args.Get(1).(*chainhash.Hash), + return args.Get(0).(input.Signature), args.Get(1).(*wire.MsgTx), args.Get(2).(btcutil.Amount), args.Error(3) } diff --git a/lnwallet/chancloser/rbf_coop_states.go b/lnwallet/chancloser/rbf_coop_states.go index 40f738ab3..d5c207066 100644 --- a/lnwallet/chancloser/rbf_coop_states.go +++ b/lnwallet/chancloser/rbf_coop_states.go @@ -6,7 +6,6 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg" - "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" "github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/channeldb" @@ -223,7 +222,7 @@ type CloseSigner interface { localDeliveryScript []byte, remoteDeliveryScript []byte, closeOpt ...lnwallet.ChanCloseOpt, ) ( - input.Signature, *chainhash.Hash, btcutil.Amount, error) + input.Signature, *wire.MsgTx, btcutil.Amount, error) // CompleteCooperativeClose persistently "completes" the cooperative // close by producing a fully signed co-op close transaction. diff --git a/lnwallet/chancloser/rbf_coop_test.go b/lnwallet/chancloser/rbf_coop_test.go index 6b6f985fe..07bc32e3d 100644 --- a/lnwallet/chancloser/rbf_coop_test.go +++ b/lnwallet/chancloser/rbf_coop_test.go @@ -13,7 +13,6 @@ import ( "github.com/btcsuite/btcd/btcec/v2/ecdsa" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg" - "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/mempool" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" @@ -52,18 +51,11 @@ var ( remoteSig = sigMustParse(remoteSigBytes) remoteWireSig = mustWireSig(&remoteSig) - localTxid = newChainHash(bytes.Repeat([]byte{0x01}, 32)) - remoteTxid = newChainHash(bytes.Repeat([]byte{0x02}, 32)) + localTx = wire.MsgTx{Version: 2} closeTx = wire.NewMsgTx(2) ) -func newChainHash(b []byte) chainhash.Hash { - var h chainhash.Hash - copy(h[:], b) - return h -} - func sigMustParse(sigBytes []byte) ecdsa.Signature { sig, err := ecdsa.ParseSignature(sigBytes) if err != nil { @@ -386,7 +378,7 @@ func (r *rbfCloserTestHarness) expectNewCloseSig( r.signer.On( "CreateCloseProposal", fee, localScript, remoteScript, mock.Anything, - ).Return(&localSig, &localTxid, closeBalance, nil) + ).Return(&localSig, &localTx, closeBalance, nil) } func (r *rbfCloserTestHarness) waitForMsgSent() { diff --git a/lnwallet/chancloser/rbf_coop_transitions.go b/lnwallet/chancloser/rbf_coop_transitions.go index fc54c9b1c..2a7d95f9a 100644 --- a/lnwallet/chancloser/rbf_coop_transitions.go +++ b/lnwallet/chancloser/rbf_coop_transitions.go @@ -308,8 +308,8 @@ func (s *ShutdownPending) ProcessEvent(event ProtocolEvent, env *Environment, } // If the channel is *already* flushed, and the close is - // already in progress, then we can skip the flushing state and // go straight into negotiation, as this is the RBF loop. + // already in progress, then we can skip the flushing state and var eventsToEmit fn.Option[protofsm.EmittedEvent[ProtocolEvent]] finalBalances := env.ChanObserver.FinalBalances().UnwrapOr( unknownBalance, diff --git a/lnwallet/channel.go b/lnwallet/channel.go index a1bc7cda2..a74d6ab3a 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -8264,7 +8264,7 @@ func WithCustomLockTime(lockTime uint32) ChanCloseOpt { // returned. func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount, localDeliveryScript []byte, remoteDeliveryScript []byte, - closeOpts ...ChanCloseOpt) (input.Signature, *chainhash.Hash, + closeOpts ...ChanCloseOpt) (input.Signature, *wire.MsgTx, btcutil.Amount, error) { lc.Lock() @@ -8364,8 +8364,8 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount, } } - closeTXID := closeTx.TxHash() - return sig, &closeTXID, ourBalance, nil + return sig, closeTx, ourBalance, nil + } // CompleteCooperativeClose completes the cooperative closure of the target