multi: extract address source into interface

As a preparation to have the method for querying the addresses of a node
separate from the channel state, we extract that method out into its own
interface.
This commit is contained in:
Oliver Gugger
2021-09-21 19:18:16 +02:00
parent c1f686f860
commit ddea833d31
4 changed files with 29 additions and 16 deletions

View File

@@ -124,7 +124,9 @@ func TestFetchBackupForChan(t *testing.T) {
},
}
for i, testCase := range testCases {
_, err := FetchBackupForChan(testCase.chanPoint, chanSource)
_, err := FetchBackupForChan(
testCase.chanPoint, chanSource, chanSource,
)
switch {
// If this is a valid test case, and we failed, then we'll
// return an error.
@@ -167,7 +169,7 @@ func TestFetchStaticChanBackups(t *testing.T) {
// With the channel source populated, we'll now attempt to create a set
// of backups for all the channels. This should succeed, as all items
// are populated within the channel source.
backups, err := FetchStaticChanBackups(chanSource)
backups, err := FetchStaticChanBackups(chanSource, chanSource)
if err != nil {
t.Fatalf("unable to create chan back ups: %v", err)
}
@@ -184,7 +186,7 @@ func TestFetchStaticChanBackups(t *testing.T) {
copy(n[:], randomChan2.IdentityPub.SerializeCompressed())
delete(chanSource.addrs, n)
_, err = FetchStaticChanBackups(chanSource)
_, err = FetchStaticChanBackups(chanSource, chanSource)
if err == nil {
t.Fatalf("query with incomplete information should fail")
}
@@ -193,7 +195,7 @@ func TestFetchStaticChanBackups(t *testing.T) {
// source at all, then we'll fail as well.
chanSource = newMockChannelSource()
chanSource.failQuery = true
_, err = FetchStaticChanBackups(chanSource)
_, err = FetchStaticChanBackups(chanSource, chanSource)
if err == nil {
t.Fatalf("query should fail")
}