lnd_test: add hodl parameter to createThreeHopNetwork
This commit is contained in:
parent
bf0af12fae
commit
e095819385
@ -23,7 +23,9 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest)
|
|||||||
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
||||||
// Carol refusing to actually settle or directly cancel any HTLC's
|
// Carol refusing to actually settle or directly cancel any HTLC's
|
||||||
// self.
|
// self.
|
||||||
aliceChanPoint, bobChanPoint, carol := createThreeHopHodlNetwork(t, net)
|
aliceChanPoint, bobChanPoint, carol := createThreeHopNetwork(
|
||||||
|
t, net, true,
|
||||||
|
)
|
||||||
|
|
||||||
// Clean up carol's node when the test finishes.
|
// Clean up carol's node when the test finishes.
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
@ -25,7 +25,9 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest)
|
|||||||
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
||||||
// Carol refusing to actually settle or directly cancel any HTLC's
|
// Carol refusing to actually settle or directly cancel any HTLC's
|
||||||
// self.
|
// self.
|
||||||
aliceChanPoint, bobChanPoint, carol := createThreeHopHodlNetwork(t, net)
|
aliceChanPoint, bobChanPoint, carol := createThreeHopNetwork(
|
||||||
|
t, net, true,
|
||||||
|
)
|
||||||
|
|
||||||
// Clean up carol's node when the test finishes.
|
// Clean up carol's node when the test finishes.
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
@ -23,7 +23,9 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
|
|||||||
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
||||||
// Carol refusing to actually settle or directly cancel any HTLC's
|
// Carol refusing to actually settle or directly cancel any HTLC's
|
||||||
// self.
|
// self.
|
||||||
aliceChanPoint, bobChanPoint, carol := createThreeHopHodlNetwork(t, net)
|
aliceChanPoint, bobChanPoint, carol := createThreeHopNetwork(
|
||||||
|
t, net, true,
|
||||||
|
)
|
||||||
|
|
||||||
// Clean up carol's node when the test finishes.
|
// Clean up carol's node when the test finishes.
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
27
lnd_test.go
27
lnd_test.go
@ -9315,8 +9315,10 @@ func assertSpendingTxInMempool(t *harnessTest, miner *rpcclient.Client,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func createThreeHopHodlNetwork(t *harnessTest,
|
func createThreeHopNetwork(t *harnessTest, net *lntest.NetworkHarness,
|
||||||
net *lntest.NetworkHarness) (*lnrpc.ChannelPoint, *lnrpc.ChannelPoint, *lntest.HarnessNode) {
|
carolHodl bool) (*lnrpc.ChannelPoint, *lnrpc.ChannelPoint,
|
||||||
|
*lntest.HarnessNode) {
|
||||||
|
|
||||||
ctxb := context.Background()
|
ctxb := context.Background()
|
||||||
|
|
||||||
// We'll start the test by creating a channel between Alice and Bob,
|
// We'll start the test by creating a channel between Alice and Bob,
|
||||||
@ -9342,10 +9344,14 @@ func createThreeHopHodlNetwork(t *harnessTest,
|
|||||||
t.Fatalf("bob didn't report channel: %v", err)
|
t.Fatalf("bob didn't report channel: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, we'll create a new node "carol" and have Bob connect to her.
|
// Next, we'll create a new node "carol" and have Bob connect to her. If
|
||||||
// In this test, we'll make carol always hold onto the HTLC, this way
|
// the carolHodl flag is set, we'll make carol always hold onto the
|
||||||
// it'll force Bob to go to chain to resolve the HTLC.
|
// HTLC, this way it'll force Bob to go to chain to resolve the HTLC.
|
||||||
carol, err := net.NewNode("Carol", []string{"--debughtlc", "--hodl.exit-settle"})
|
carolFlags := []string{"--debughtlc"}
|
||||||
|
if carolHodl {
|
||||||
|
carolFlags = append(carolFlags, "--hodl.exit-settle")
|
||||||
|
}
|
||||||
|
carol, err := net.NewNode("Carol", carolFlags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create new node: %v", err)
|
t.Fatalf("unable to create new node: %v", err)
|
||||||
}
|
}
|
||||||
@ -9393,7 +9399,8 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
||||||
// Carol refusing to actually settle or directly cancel any HTLC's
|
// Carol refusing to actually settle or directly cancel any HTLC's
|
||||||
// self.
|
// self.
|
||||||
aliceChanPoint, bobChanPoint, carol := createThreeHopHodlNetwork(t, net)
|
aliceChanPoint, bobChanPoint, carol :=
|
||||||
|
createThreeHopNetwork(t, net, true)
|
||||||
|
|
||||||
// Clean up carol's node when the test finishes.
|
// Clean up carol's node when the test finishes.
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
@ -9626,7 +9633,8 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
|||||||
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
||||||
// Carol refusing to actually settle or directly cancel any HTLC's
|
// Carol refusing to actually settle or directly cancel any HTLC's
|
||||||
// self.
|
// self.
|
||||||
aliceChanPoint, bobChanPoint, carol := createThreeHopHodlNetwork(t, net)
|
aliceChanPoint, bobChanPoint, carol :=
|
||||||
|
createThreeHopNetwork(t, net, true)
|
||||||
|
|
||||||
// Clean up carol's node when the test finishes.
|
// Clean up carol's node when the test finishes.
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
@ -9887,7 +9895,8 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
|||||||
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
||||||
// Carol refusing to actually settle or directly cancel any HTLC's
|
// Carol refusing to actually settle or directly cancel any HTLC's
|
||||||
// self.
|
// self.
|
||||||
aliceChanPoint, bobChanPoint, carol := createThreeHopHodlNetwork(t, net)
|
aliceChanPoint, bobChanPoint, carol :=
|
||||||
|
createThreeHopNetwork(t, net, true)
|
||||||
|
|
||||||
// Clean up carol's node when the test finishes.
|
// Clean up carol's node when the test finishes.
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
Loading…
Reference in New Issue
Block a user