mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-01 18:27:43 +02:00
multi: refactor NewAnchorResolutions to return fixed values
This commit adds a new struct AnchorResolutions which wraps the anchor resolutions for local/remote/pending remote commitment transactions. It is then returned from NewAnchorResolutions. Thus the caller knows how to retrieve a certain anchor resolution.
This commit is contained in:
@@ -2119,9 +2119,7 @@ func TestChannelArbitratorAnchors(t *testing.T) {
|
||||
|
||||
// Setup two pre-confirmation anchor resolutions on the mock channel.
|
||||
chanArb.cfg.Channel.(*mockChannel).anchorResolutions =
|
||||
[]*lnwallet.AnchorResolution{
|
||||
{}, {},
|
||||
}
|
||||
&lnwallet.AnchorResolutions{}
|
||||
|
||||
if err := chanArb.Start(nil); err != nil {
|
||||
t.Fatalf("unable to start ChannelArbitrator: %v", err)
|
||||
@@ -2286,13 +2284,16 @@ func assertResolverReport(t *testing.T, reports chan *channeldb.ResolverReport,
|
||||
}
|
||||
|
||||
type mockChannel struct {
|
||||
anchorResolutions []*lnwallet.AnchorResolution
|
||||
anchorResolutions *lnwallet.AnchorResolutions
|
||||
}
|
||||
|
||||
func (m *mockChannel) NewAnchorResolutions() ([]*lnwallet.AnchorResolution,
|
||||
func (m *mockChannel) NewAnchorResolutions() (*lnwallet.AnchorResolutions,
|
||||
error) {
|
||||
if m.anchorResolutions != nil {
|
||||
return m.anchorResolutions, nil
|
||||
}
|
||||
|
||||
return m.anchorResolutions, nil
|
||||
return &lnwallet.AnchorResolutions{}, nil
|
||||
}
|
||||
|
||||
func (m *mockChannel) ForceCloseChan() (*lnwallet.LocalForceCloseSummary, error) {
|
||||
|
Reference in New Issue
Block a user