Merge pull request #4782 from cfromknecht/anchor-wtserver

watchtower: anchor channel support
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2020-11-30 17:49:32 -08:00
commit 94f8311667
26 files changed
+703 -241

No files matched your search

+27 -4
View File
@@ -9070,6 +9070,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
@@ -9080,7 +9093,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)
}
@@ -9133,10 +9150,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)
}
@@ -9249,7 +9270,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