mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-26 19:56:29 +02:00
multi: introduce an option for resolutions
We don't always need the resolutions in the local force close summary so we make it an option.
This commit is contained in:
@@ -693,11 +693,15 @@ func TestChannelArbitratorLocalForceClose(t *testing.T) {
|
||||
chanArbCtx.AssertState(StateCommitmentBroadcasted)
|
||||
|
||||
// Now notify about the local force close getting confirmed.
|
||||
//
|
||||
//nolint:lll
|
||||
chanArb.cfg.ChainEvents.LocalUnilateralClosure <- &LocalUnilateralCloseInfo{
|
||||
SpendDetail: &chainntnfs.SpendDetail{},
|
||||
LocalForceCloseSummary: &lnwallet.LocalForceCloseSummary{
|
||||
CloseTx: &wire.MsgTx{},
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{},
|
||||
CloseTx: &wire.MsgTx{},
|
||||
ContractResolutions: fn.Some(lnwallet.ContractResolutions{
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{},
|
||||
}),
|
||||
},
|
||||
ChannelCloseSummary: &channeldb.ChannelCloseSummary{},
|
||||
}
|
||||
@@ -969,15 +973,18 @@ func TestChannelArbitratorLocalForceClosePendingHtlc(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
//nolint:lll
|
||||
chanArb.cfg.ChainEvents.LocalUnilateralClosure <- &LocalUnilateralCloseInfo{
|
||||
SpendDetail: &chainntnfs.SpendDetail{},
|
||||
LocalForceCloseSummary: &lnwallet.LocalForceCloseSummary{
|
||||
CloseTx: closeTx,
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{
|
||||
OutgoingHTLCs: []lnwallet.OutgoingHtlcResolution{
|
||||
outgoingRes,
|
||||
ContractResolutions: fn.Some(lnwallet.ContractResolutions{
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{
|
||||
OutgoingHTLCs: []lnwallet.OutgoingHtlcResolution{
|
||||
outgoingRes,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
ChannelCloseSummary: &channeldb.ChannelCloseSummary{},
|
||||
CommitSet: CommitSet{
|
||||
@@ -1611,12 +1618,15 @@ func TestChannelArbitratorCommitFailure(t *testing.T) {
|
||||
},
|
||||
{
|
||||
closeType: channeldb.LocalForceClose,
|
||||
//nolint:lll
|
||||
sendEvent: func(chanArb *ChannelArbitrator) {
|
||||
chanArb.cfg.ChainEvents.LocalUnilateralClosure <- &LocalUnilateralCloseInfo{
|
||||
SpendDetail: &chainntnfs.SpendDetail{},
|
||||
LocalForceCloseSummary: &lnwallet.LocalForceCloseSummary{
|
||||
CloseTx: &wire.MsgTx{},
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{},
|
||||
CloseTx: &wire.MsgTx{},
|
||||
ContractResolutions: fn.Some(lnwallet.ContractResolutions{
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{},
|
||||
}),
|
||||
},
|
||||
ChannelCloseSummary: &channeldb.ChannelCloseSummary{},
|
||||
}
|
||||
@@ -1944,11 +1954,15 @@ func TestChannelArbitratorDanglingCommitForceClose(t *testing.T) {
|
||||
// being canalled back. Also note that there're no HTLC
|
||||
// resolutions sent since we have none on our
|
||||
// commitment transaction.
|
||||
//
|
||||
//nolint:lll
|
||||
uniCloseInfo := &LocalUnilateralCloseInfo{
|
||||
SpendDetail: &chainntnfs.SpendDetail{},
|
||||
LocalForceCloseSummary: &lnwallet.LocalForceCloseSummary{
|
||||
CloseTx: closeTx,
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{},
|
||||
CloseTx: closeTx,
|
||||
ContractResolutions: fn.Some(lnwallet.ContractResolutions{
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{},
|
||||
}),
|
||||
},
|
||||
ChannelCloseSummary: &channeldb.ChannelCloseSummary{},
|
||||
CommitSet: CommitSet{
|
||||
@@ -2754,12 +2768,15 @@ func TestChannelArbitratorAnchors(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
//nolint:lll
|
||||
chanArb.cfg.ChainEvents.LocalUnilateralClosure <- &LocalUnilateralCloseInfo{
|
||||
SpendDetail: &chainntnfs.SpendDetail{},
|
||||
LocalForceCloseSummary: &lnwallet.LocalForceCloseSummary{
|
||||
CloseTx: closeTx,
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{},
|
||||
AnchorResolution: anchorResolution,
|
||||
CloseTx: closeTx,
|
||||
ContractResolutions: fn.Some(lnwallet.ContractResolutions{
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{},
|
||||
AnchorResolution: anchorResolution,
|
||||
}),
|
||||
},
|
||||
ChannelCloseSummary: &channeldb.ChannelCloseSummary{},
|
||||
CommitSet: CommitSet{
|
||||
@@ -2993,14 +3010,10 @@ func (m *mockChannel) NewAnchorResolutions() (*lnwallet.AnchorResolutions,
|
||||
return &lnwallet.AnchorResolutions{}, nil
|
||||
}
|
||||
|
||||
func (m *mockChannel) ForceCloseChan() (*lnwallet.LocalForceCloseSummary, error) {
|
||||
func (m *mockChannel) ForceCloseChan() (*wire.MsgTx, error) {
|
||||
if m.forceCloseErr != nil {
|
||||
return nil, m.forceCloseErr
|
||||
}
|
||||
|
||||
summary := &lnwallet.LocalForceCloseSummary{
|
||||
CloseTx: &wire.MsgTx{},
|
||||
HtlcResolutions: &lnwallet.HtlcResolutions{},
|
||||
}
|
||||
return summary, nil
|
||||
return &wire.MsgTx{}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user