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:
yyforyongyu committed 2021-06-29 20:25:47 +08:00
1 parent 21626fed7c
commit adddc1442e
5 files changed
+49 -29

No files matched your search

+9 -4
View File
@@ -917,14 +917,19 @@ func testForceClose(t *testing.T, testCase *forceCloseTestCase) {
}
// Check the pre-confirmation resolutions.
resList, err := aliceChannel.NewAnchorResolutions()
res, err := aliceChannel.NewAnchorResolutions()
if err != nil {
t.Fatalf("pre-confirmation resolution error: %v", err)
}
if len(resList) != 2 {
t.Fatal("expected two resolutions")
}
// Check we have the expected anchor resolutions.
require.NotNil(t, res.Local, "expected local anchor resolution")
require.NotNil(t,
res.Remote, "expected remote anchor resolution",
)
require.Nil(t,
res.RemotePending, "expected no anchor resolution",
)
}
// The SelfOutputSignDesc should be non-nil since the output to-self is