wtclinet+itest: expose anchor client via rpc + add itest

This commit is contained in:
Conner Fromknecht committed 2020-11-25 16:16:47 -08:00
1 parent 5b3a08a1cd
commit b28bbc3223
2 files changed
+90 -9

No files matched your search

+27 -4
View File
@@ -9071,6 +9071,19 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness,
func testRevokedCloseRetributionAltruistWatchtower(net *lntest.NetworkHarness,
t *harnessTest) {
t.t.Run("anchors", func(tt *testing.T) {
ht := newHarnessTest(tt, net)
testRevokedCloseRetributionAltruistWatchtowerCase(net, ht, true)
})
t.t.Run("legacy", func(tt *testing.T) {
ht := newHarnessTest(tt, net)
testRevokedCloseRetributionAltruistWatchtowerCase(net, ht, false)
})
}
func testRevokedCloseRetributionAltruistWatchtowerCase(
net *lntest.NetworkHarness, t *harnessTest, anchors bool) {
ctxb := context.Background()
const (
chanAmt = lnd.MaxBtcFundingAmount
@@ -9081,7 +9094,11 @@ func testRevokedCloseRetributionAltruistWatchtower(net *lntest.NetworkHarness,
// Since we'd like to test some multi-hop failure scenarios, we'll
// introduce another node into our test network: Carol.
carol, err := net.NewNode("Carol", []string{"--hodl.exit-settle"})
carolArgs := []string{"--hodl.exit-settle"}
if anchors {
carolArgs = append(carolArgs, "--protocol.anchors")
}
carol, err := net.NewNode("Carol", carolArgs)
if err != nil {
t.Fatalf("unable to create new nodes: %v", err)
}
@@ -9134,10 +9151,14 @@ func testRevokedCloseRetributionAltruistWatchtower(net *lntest.NetworkHarness,
// Dave will be the breached party. We set --nolisten to ensure Carol
// won't be able to connect to him and trigger the channel data
// protection logic automatically.
dave, err := net.NewNode("Dave", []string{
daveArgs := []string{
"--nolisten",
"--wtclient.active",
})
}
if anchors {
daveArgs = append(daveArgs, "--protocol.anchors")
}
dave, err := net.NewNode("Dave", daveArgs)
if err != nil {
t.Fatalf("unable to create new node: %v", err)
}
@@ -9250,7 +9271,9 @@ func testRevokedCloseRetributionAltruistWatchtower(net *lntest.NetworkHarness,
err = wait.NoError(func() error {
ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout)
defer cancel()
bkpStats, err := dave.WatchtowerClient.Stats(ctxt, &wtclientrpc.StatsRequest{})
bkpStats, err := dave.WatchtowerClient.Stats(ctxt,
&wtclientrpc.StatsRequest{},
)
if err != nil {
return err