mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-22 14:51:45 +02:00
itest: initialize context inside ConnectNodes
This commit is contained in:
parent
dca20d80a7
commit
8de495b96b
@ -178,7 +178,7 @@ func (n *NetworkHarness) SetUp(t *testing.T,
|
|||||||
// both nodes are fully started since the Connect RPC is guarded behind
|
// both nodes are fully started since the Connect RPC is guarded behind
|
||||||
// the server.Started() flag that waits for all subsystems to be ready.
|
// the server.Started() flag that waits for all subsystems to be ready.
|
||||||
ctxb := context.Background()
|
ctxb := context.Background()
|
||||||
n.ConnectNodes(ctxb, t, n.Alice, n.Bob)
|
n.ConnectNodes(t, n.Alice, n.Bob)
|
||||||
|
|
||||||
// Load up the wallets of the seeder nodes with 10 outputs of 1 BTC
|
// Load up the wallets of the seeder nodes with 10 outputs of 1 BTC
|
||||||
// each.
|
// each.
|
||||||
@ -670,8 +670,10 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context,
|
|||||||
//
|
//
|
||||||
// NOTE: This function may block for up to 15-seconds as it will not return
|
// NOTE: This function may block for up to 15-seconds as it will not return
|
||||||
// until the new connection is detected as being known to both nodes.
|
// until the new connection is detected as being known to both nodes.
|
||||||
func (n *NetworkHarness) ConnectNodes(ctx context.Context, t *testing.T,
|
func (n *NetworkHarness) ConnectNodes(t *testing.T, a, b *HarnessNode) {
|
||||||
a, b *HarnessNode) {
|
ctxb := context.Background()
|
||||||
|
ctx, cancel := context.WithTimeout(ctxb, DefaultTimeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
bobInfo, err := b.GetInfo(ctx, &lnrpc.GetInfoRequest{})
|
bobInfo, err := b.GetInfo(ctx, &lnrpc.GetInfoRequest{})
|
||||||
require.NoErrorf(
|
require.NoErrorf(
|
||||||
|
@ -505,8 +505,7 @@ func testChannelBackupUpdates(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
// With Carol up, we'll now connect her to Alice, and open a channel
|
// With Carol up, we'll now connect her to Alice, and open a channel
|
||||||
// between them.
|
// between them.
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, net.Alice)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, net.Alice)
|
|
||||||
|
|
||||||
// Next, we'll open two channels between Alice and Carol back to back.
|
// Next, we'll open two channels between Alice and Carol back to back.
|
||||||
var chanPoints []*lnrpc.ChannelPoint
|
var chanPoints []*lnrpc.ChannelPoint
|
||||||
@ -641,8 +640,7 @@ func testExportChannelBackup(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
// With Carol up, we'll now connect her to Alice, and open a channel
|
// With Carol up, we'll now connect her to Alice, and open a channel
|
||||||
// between them.
|
// between them.
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, net.Alice)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, net.Alice)
|
|
||||||
|
|
||||||
// Next, we'll open two channels between Alice and Carol back to back.
|
// Next, we'll open two channels between Alice and Carol back to back.
|
||||||
var chanPoints []*lnrpc.ChannelPoint
|
var chanPoints []*lnrpc.ChannelPoint
|
||||||
@ -899,7 +897,7 @@ func testChanRestoreScenario(t *harnessTest, net *lntest.NetworkHarness,
|
|||||||
|
|
||||||
// Next, we'll connect Dave to Carol, and open a new channel to her
|
// Next, we'll connect Dave to Carol, and open a new channel to her
|
||||||
// with a portion pushed.
|
// with a portion pushed.
|
||||||
net.ConnectNodes(ctxt, t.t, dave, carol)
|
net.ConnectNodes(t.t, dave, carol)
|
||||||
|
|
||||||
// We will either open a confirmed or unconfirmed channel, depending on
|
// We will either open a confirmed or unconfirmed channel, depending on
|
||||||
// the requirements of the test case.
|
// the requirements of the test case.
|
||||||
|
@ -144,8 +144,7 @@ func testChannelUnsettledBalance(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
// Connect Alice to Carol.
|
// Connect Alice to Carol.
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
net.ConnectNodes(ctxb, t.t, net.Alice, carol)
|
|
||||||
|
|
||||||
// Open a channel between Alice and Carol.
|
// Open a channel between Alice and Carol.
|
||||||
chanPointAlice := openChannelAndAssert(
|
chanPointAlice := openChannelAndAssert(
|
||||||
@ -157,7 +156,7 @@ func testChannelUnsettledBalance(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
// Wait for Alice and Carol to receive the channel edge from the
|
// Wait for Alice and Carol to receive the channel edge from the
|
||||||
// funding manager.
|
// funding manager.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
err := net.Alice.WaitForNetworkChannelOpen(ctxt, chanPointAlice)
|
err := net.Alice.WaitForNetworkChannelOpen(ctxt, chanPointAlice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("alice didn't see the alice->carol channel before "+
|
t.Fatalf("alice didn't see the alice->carol channel before "+
|
||||||
|
@ -105,7 +105,7 @@ func testCommitmentTransactionDeadline(net *lntest.NetworkHarness,
|
|||||||
defer shutdownAndAssert(net, t, bob)
|
defer shutdownAndAssert(net, t, bob)
|
||||||
|
|
||||||
// Connect Alice to Bob.
|
// Connect Alice to Bob.
|
||||||
net.ConnectNodes(ctxt, t.t, alice, bob)
|
net.ConnectNodes(t.t, alice, bob)
|
||||||
|
|
||||||
// Open a channel between Alice and Bob.
|
// Open a channel between Alice and Bob.
|
||||||
chanPoint := openChannelAndAssert(
|
chanPoint := openChannelAndAssert(
|
||||||
@ -317,10 +317,10 @@ func channelForceClosureTest(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
|
|
||||||
// We must let Alice have an open channel before she can send a node
|
// We must let Alice have an open channel before she can send a node
|
||||||
// announcement, so we open a channel with Carol,
|
// announcement, so we open a channel with Carol,
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, alice, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, alice, carol)
|
|
||||||
|
|
||||||
// We need one additional UTXO for sweeping the remote anchor.
|
// We need one additional UTXO for sweeping the remote anchor.
|
||||||
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, alice)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, alice)
|
||||||
|
|
||||||
// Before we start, obtain Carol's current wallet balance, we'll check
|
// Before we start, obtain Carol's current wallet balance, we'll check
|
||||||
@ -1418,8 +1418,7 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
// Let Alice connect and open a channel to Carol,
|
// Let Alice connect and open a channel to Carol,
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Alice, carol)
|
|
||||||
chanPoint := openChannelAndAssert(
|
chanPoint := openChannelAndAssert(
|
||||||
t, net, net.Alice, carol,
|
t, net, net.Alice, carol,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
@ -1435,7 +1434,7 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
RPreimage: preimage,
|
RPreimage: preimage,
|
||||||
Value: paymentAmt,
|
Value: paymentAmt,
|
||||||
}
|
}
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
resp, err := carol.AddInvoice(ctxt, invoice)
|
resp, err := carol.AddInvoice(ctxt, invoice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to add invoice: %v", err)
|
t.Fatalf("unable to add invoice: %v", err)
|
||||||
|
@ -45,7 +45,7 @@ func testUpdateChanStatus(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
defer shutdownAndAssert(net, t, bob)
|
defer shutdownAndAssert(net, t, bob)
|
||||||
|
|
||||||
// Connect Alice to Bob.
|
// Connect Alice to Bob.
|
||||||
net.ConnectNodes(ctxb, t.t, alice, bob)
|
net.ConnectNodes(t.t, alice, bob)
|
||||||
|
|
||||||
// Give Alice some coins so she can fund a channel.
|
// Give Alice some coins so she can fund a channel.
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
@ -83,11 +83,8 @@ func testUpdateChanStatus(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, alice, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, alice, carol)
|
net.ConnectNodes(t.t, bob, carol)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.ConnectNodes(ctxt, t.t, bob, carol)
|
|
||||||
|
|
||||||
carolSub := subscribeGraphNotifications(ctxb, t, carol)
|
carolSub := subscribeGraphNotifications(ctxb, t, carol)
|
||||||
defer close(carolSub.quit)
|
defer close(carolSub.quit)
|
||||||
@ -601,8 +598,7 @@ out:
|
|||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, bob, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, bob, carol)
|
|
||||||
chanPoint = openChannelAndAssert(
|
chanPoint = openChannelAndAssert(
|
||||||
t, net, bob, carol,
|
t, net, bob, carol,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
@ -699,8 +695,7 @@ func testNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
// We must let Dave have an open channel before he can send a node
|
// We must let Dave have an open channel before he can send a node
|
||||||
// announcement, so we open a channel with Bob,
|
// announcement, so we open a channel with Bob,
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Bob, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Bob, dave)
|
|
||||||
|
|
||||||
// Alice shouldn't receive any new updates yet since the channel has yet
|
// Alice shouldn't receive any new updates yet since the channel has yet
|
||||||
// to be opened.
|
// to be opened.
|
||||||
|
@ -112,7 +112,7 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
net.ConnectNodes(ctxb, t.t, carol, net.Bob)
|
net.ConnectNodes(t.t, carol, net.Bob)
|
||||||
|
|
||||||
// Open the channel Carol->Bob with a custom min_htlc value set. Since
|
// Open the channel Carol->Bob with a custom min_htlc value set. Since
|
||||||
// Carol is opening the channel, she will require Bob to not forward
|
// Carol is opening the channel, she will require Bob to not forward
|
||||||
@ -388,7 +388,7 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We'll now open a channel from Alice directly to Carol.
|
// We'll now open a channel from Alice directly to Carol.
|
||||||
net.ConnectNodes(ctxb, t.t, net.Alice, carol)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
chanPoint3 := openChannelAndAssert(
|
chanPoint3 := openChannelAndAssert(
|
||||||
t, net, net.Alice, carol,
|
t, net, net.Alice, carol,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
|
@ -100,8 +100,7 @@ func testEtcdFailoverCase(net *lntest.NetworkHarness, ht *harnessTest,
|
|||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
info1, err := carol1.GetInfo(ctxt, &lnrpc.GetInfoRequest{})
|
info1, err := carol1.GetInfo(ctxt, &lnrpc.GetInfoRequest{})
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(ht.t, carol1, net.Alice)
|
||||||
net.ConnectNodes(ctxt, ht.t, carol1, net.Alice)
|
|
||||||
|
|
||||||
// Open a channel with 100k satoshis between Carol and Alice with Alice
|
// Open a channel with 100k satoshis between Carol and Alice with Alice
|
||||||
// being the sole funder of the channel.
|
// being the sole funder of the channel.
|
||||||
|
@ -292,9 +292,7 @@ func testUnconfirmedChannelFunding(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// Now, we'll connect her to Alice so that they can open a channel
|
// Now, we'll connect her to Alice so that they can open a channel
|
||||||
// together. The funding flow should select Carol's unconfirmed output
|
// together. The funding flow should select Carol's unconfirmed output
|
||||||
// as she doesn't have any other funds since it's a new node.
|
// as she doesn't have any other funds since it's a new node.
|
||||||
|
net.ConnectNodes(t.t, carol, net.Alice)
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.ConnectNodes(ctxt, t.t, carol, net.Alice)
|
|
||||||
|
|
||||||
chanOpenUpdate := openChannelStream(
|
chanOpenUpdate := openChannelStream(
|
||||||
ctxt, t, net, carol, net.Alice,
|
ctxt, t, net, carol, net.Alice,
|
||||||
@ -521,12 +519,11 @@ func testChannelFundingPersistence(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// 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)
|
||||||
|
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Alice, carol)
|
|
||||||
|
|
||||||
// Create a new channel that requires 5 confs before it's considered
|
// Create a new channel that requires 5 confs before it's considered
|
||||||
// open, then broadcast the funding transaction
|
// open, then broadcast the funding transaction
|
||||||
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, channelOpenTimeout)
|
||||||
pendingUpdate, err := net.OpenPendingChannel(ctxt, net.Alice, carol,
|
pendingUpdate, err := net.OpenPendingChannel(ctxt, net.Alice, carol,
|
||||||
chanAmt, pushAmt)
|
chanAmt, pushAmt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -34,8 +34,7 @@ func testHoldInvoicePersistence(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
// Connect Alice to Carol.
|
// Connect Alice to Carol.
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
net.ConnectNodes(ctxb, t.t, net.Alice, carol)
|
|
||||||
|
|
||||||
// Open a channel between Alice and Carol which is private so that we
|
// Open a channel between Alice and Carol which is private so that we
|
||||||
// cover the addition of hop hints for hold invoices.
|
// cover the addition of hop hints for hold invoices.
|
||||||
@ -49,7 +48,7 @@ func testHoldInvoicePersistence(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
// Wait for Alice and Carol to receive the channel edge from the
|
// Wait for Alice and Carol to receive the channel edge from the
|
||||||
// funding manager.
|
// funding manager.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
err := net.Alice.WaitForNetworkChannelOpen(ctxt, chanPointAlice)
|
err := net.Alice.WaitForNetworkChannelOpen(ctxt, chanPointAlice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("alice didn't see the alice->carol channel before "+
|
t.Fatalf("alice didn't see the alice->carol channel before "+
|
||||||
|
@ -47,14 +47,13 @@ func testDisconnectingTargetPeer(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
defer shutdownAndAssert(net, t, bob)
|
defer shutdownAndAssert(net, t, bob)
|
||||||
|
|
||||||
// Start by connecting Alice and Bob with no channels.
|
// Start by connecting Alice and Bob with no channels.
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, alice, bob)
|
||||||
net.ConnectNodes(ctxt, t.t, alice, bob)
|
|
||||||
|
|
||||||
// Check existing connection.
|
// Check existing connection.
|
||||||
assertNumConnections(t, alice, bob, 1)
|
assertNumConnections(t, alice, bob, 1)
|
||||||
|
|
||||||
// Give Alice some coins so she can fund a channel.
|
// Give Alice some coins so she can fund a channel.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, alice)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, alice)
|
||||||
|
|
||||||
chanAmt := funding.MaxBtcFundingAmount
|
chanAmt := funding.MaxBtcFundingAmount
|
||||||
@ -109,8 +108,7 @@ func testDisconnectingTargetPeer(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
assertNumOpenChannelsPending(ctxt, t, alice, bob, 0)
|
assertNumOpenChannelsPending(ctxt, t, alice, bob, 0)
|
||||||
|
|
||||||
// Reconnect the nodes so that the channel can become active.
|
// Reconnect the nodes so that the channel can become active.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, alice, bob)
|
||||||
net.ConnectNodes(ctxt, t.t, alice, bob)
|
|
||||||
|
|
||||||
// The channel should be listed in the peer information returned by both
|
// The channel should be listed in the peer information returned by both
|
||||||
// peers.
|
// peers.
|
||||||
@ -140,8 +138,7 @@ func testDisconnectingTargetPeer(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
assertNumConnections(t, alice, bob, 0)
|
assertNumConnections(t, alice, bob, 0)
|
||||||
|
|
||||||
// Reconnect both nodes before force closing the channel.
|
// Reconnect both nodes before force closing the channel.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, alice, bob)
|
||||||
net.ConnectNodes(ctxt, t.t, alice, bob)
|
|
||||||
|
|
||||||
// Finally, immediately close the channel. This function will also block
|
// Finally, immediately close the channel. This function will also block
|
||||||
// until the channel is closed and will additionally assert the relevant
|
// until the channel is closed and will additionally assert the relevant
|
||||||
@ -166,8 +163,7 @@ func testDisconnectingTargetPeer(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
assertNumConnections(t, alice, bob, 0)
|
assertNumConnections(t, alice, bob, 0)
|
||||||
|
|
||||||
// Finally, re-connect both nodes.
|
// Finally, re-connect both nodes.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, alice, bob)
|
||||||
net.ConnectNodes(ctxt, t.t, alice, bob)
|
|
||||||
|
|
||||||
// Check existing connection.
|
// Check existing connection.
|
||||||
assertNumConnections(t, alice, net.Bob, 1)
|
assertNumConnections(t, alice, net.Bob, 1)
|
||||||
@ -202,9 +198,8 @@ func testSphinxReplayPersistence(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", []string{"--unsafe-replay"})
|
carol := net.NewNode(t.t, "Carol", []string{"--unsafe-replay"})
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
chanPoint := openChannelAndAssert(
|
chanPoint := openChannelAndAssert(
|
||||||
@ -222,8 +217,7 @@ func testSphinxReplayPersistence(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
fred := net.NewNode(t.t, "Fred", nil)
|
fred := net.NewNode(t.t, "Fred", nil)
|
||||||
defer shutdownAndAssert(net, t, fred)
|
defer shutdownAndAssert(net, t, fred)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, fred, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, fred, carol)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, fred)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, fred)
|
||||||
|
|
||||||
@ -379,7 +373,7 @@ func testListChannels(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
defer shutdownAndAssert(net, t, bob)
|
defer shutdownAndAssert(net, t, bob)
|
||||||
|
|
||||||
// Connect Alice to Bob.
|
// Connect Alice to Bob.
|
||||||
net.ConnectNodes(ctxb, t.t, alice, bob)
|
net.ConnectNodes(t.t, alice, bob)
|
||||||
|
|
||||||
// Give Alice some coins so she can fund a channel.
|
// Give Alice some coins so she can fund a channel.
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
@ -510,10 +504,9 @@ func testMaxPendingChannels(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", args)
|
carol := net.NewNode(t.t, "Carol", args)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Alice, carol)
|
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
carolBalance := btcutil.Amount(maxPendingChannels) * amount
|
carolBalance := btcutil.Amount(maxPendingChannels) * amount
|
||||||
net.SendCoins(ctxt, t.t, carolBalance, carol)
|
net.SendCoins(ctxt, t.t, carolBalance, carol)
|
||||||
|
|
||||||
@ -624,8 +617,7 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// Create Carol's node and connect Alice to her.
|
// Create Carol's node and connect Alice to her.
|
||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Alice, carol)
|
|
||||||
|
|
||||||
// Open a channel between Alice and Carol which will later be force
|
// Open a channel between Alice and Carol which will later be force
|
||||||
// closed.
|
// closed.
|
||||||
@ -641,7 +633,7 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
net.ConnectNodes(ctxt, t.t, net.Alice, dave)
|
net.ConnectNodes(t.t, net.Alice, dave)
|
||||||
persistentChanPoint := openChannelAndAssert(
|
persistentChanPoint := openChannelAndAssert(
|
||||||
t, net, net.Alice, dave, lntest.OpenChannelParams{
|
t, net, net.Alice, dave, lntest.OpenChannelParams{
|
||||||
Amt: chanAmt,
|
Amt: chanAmt,
|
||||||
@ -652,7 +644,7 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// Alice.
|
// Alice.
|
||||||
isConnected := func(pubKey string) bool {
|
isConnected := func(pubKey string) bool {
|
||||||
req := &lnrpc.ListPeersRequest{}
|
req := &lnrpc.ListPeersRequest{}
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
resp, err := net.Alice.ListPeers(ctxt, req)
|
resp, err := net.Alice.ListPeers(ctxt, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to retrieve alice's peers: %v", err)
|
t.Fatalf("unable to retrieve alice's peers: %v", err)
|
||||||
@ -774,7 +766,7 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
var predErr error
|
var predErr error
|
||||||
pendingChansRequest := &lnrpc.PendingChannelsRequest{}
|
pendingChansRequest := &lnrpc.PendingChannelsRequest{}
|
||||||
err = wait.Predicate(func() bool {
|
err = wait.Predicate(func() bool {
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
pendingChanResp, err := net.Alice.PendingChannels(
|
pendingChanResp, err := net.Alice.PendingChannels(
|
||||||
ctxt, pendingChansRequest,
|
ctxt, pendingChansRequest,
|
||||||
)
|
)
|
||||||
@ -815,7 +807,7 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
describeGraphReq := &lnrpc.ChannelGraphRequest{
|
describeGraphReq := &lnrpc.ChannelGraphRequest{
|
||||||
IncludeUnannounced: true,
|
IncludeUnannounced: true,
|
||||||
}
|
}
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
channelGraph, err := net.Alice.DescribeGraph(ctxt, describeGraphReq)
|
channelGraph, err := net.Alice.DescribeGraph(ctxt, describeGraphReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to query for alice's channel graph: %v", err)
|
t.Fatalf("unable to query for alice's channel graph: %v", err)
|
||||||
@ -1155,10 +1147,10 @@ func testRejectHTLC(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
// Connect Alice to Carol.
|
// Connect Alice to Carol.
|
||||||
net.ConnectNodes(ctxb, t.t, net.Alice, carol)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
|
|
||||||
// Connect Carol to Bob.
|
// Connect Carol to Bob.
|
||||||
net.ConnectNodes(ctxb, t.t, carol, net.Bob)
|
net.ConnectNodes(t.t, carol, net.Bob)
|
||||||
|
|
||||||
// Send coins to Carol.
|
// Send coins to Carol.
|
||||||
net.SendCoins(ctxb, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxb, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
@ -1390,8 +1382,7 @@ func testSendUpdateDisableChannel(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
})
|
})
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Alice, carol)
|
|
||||||
chanPointAliceCarol := openChannelAndAssert(
|
chanPointAliceCarol := openChannelAndAssert(
|
||||||
t, net, net.Alice, carol,
|
t, net, net.Alice, carol,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
@ -1412,14 +1403,12 @@ func testSendUpdateDisableChannel(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
defer shutdownAndAssert(net, t, eve)
|
defer shutdownAndAssert(net, t, eve)
|
||||||
|
|
||||||
// Give Eve some coins.
|
// Give Eve some coins.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, eve)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, eve)
|
||||||
|
|
||||||
// Connect Eve to Carol and Bob, and open a channel to carol.
|
// Connect Eve to Carol and Bob, and open a channel to carol.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, eve, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, eve, carol)
|
net.ConnectNodes(t.t, eve, net.Bob)
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.ConnectNodes(ctxt, t.t, eve, net.Bob)
|
|
||||||
|
|
||||||
chanPointEveCarol := openChannelAndAssert(
|
chanPointEveCarol := openChannelAndAssert(
|
||||||
t, net, eve, carol,
|
t, net, eve, carol,
|
||||||
@ -1434,8 +1423,7 @@ func testSendUpdateDisableChannel(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Bob, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Bob, dave)
|
|
||||||
|
|
||||||
daveSub := subscribeGraphNotifications(ctxb, t, dave)
|
daveSub := subscribeGraphNotifications(ctxb, t, dave)
|
||||||
defer close(daveSub.quit)
|
defer close(daveSub.quit)
|
||||||
|
@ -93,8 +93,7 @@ func testHtlcErrorPropagation(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// channel between them so we have the topology: Alice -> Bob -> Carol.
|
// channel between them so we have the topology: Alice -> Bob -> Carol.
|
||||||
// The channel created will be of lower capacity that the one created
|
// The channel created will be of lower capacity that the one created
|
||||||
// above.
|
// above.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Bob, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Bob, carol)
|
|
||||||
const bobChanAmt = funding.MaxBtcFundingAmount
|
const bobChanAmt = funding.MaxBtcFundingAmount
|
||||||
chanPointBob := openChannelAndAssert(
|
chanPointBob := openChannelAndAssert(
|
||||||
t, net, net.Bob, carol,
|
t, net, net.Bob, carol,
|
||||||
|
@ -49,9 +49,8 @@ func testMultiHopPayments(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
dave := net.NewNode(t.t, "Dave", daveArgs)
|
dave := net.NewNode(t.t, "Dave", daveArgs)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, dave, net.Alice)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, net.Alice)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
||||||
|
|
||||||
chanPointDave := openChannelAndAssert(
|
chanPointDave := openChannelAndAssert(
|
||||||
@ -75,8 +74,7 @@ func testMultiHopPayments(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
|
@ -87,9 +87,7 @@ func testMultiHopHtlcClaims(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
bob := net.NewNode(t, "Bob", args)
|
bob := net.NewNode(t, "Bob", args)
|
||||||
defer shutdownAndAssert(net, ht, bob)
|
defer shutdownAndAssert(net, ht, bob)
|
||||||
|
|
||||||
ctxb := context.Background()
|
net.ConnectNodes(t, alice, bob)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.ConnectNodes(ctxt, t, alice, bob)
|
|
||||||
|
|
||||||
for _, subTest := range subTests {
|
for _, subTest := range subTests {
|
||||||
subTest := subTest
|
subTest := subTest
|
||||||
@ -251,8 +249,7 @@ func createThreeHopNetwork(t *harnessTest, net *lntest.NetworkHarness,
|
|||||||
}
|
}
|
||||||
carol := net.NewNode(t.t, "Carol", carolFlags)
|
carol := net.NewNode(t.t, "Carol", carolFlags)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, bob, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, bob, carol)
|
|
||||||
|
|
||||||
// Make sure Carol has enough utxos for anchoring. Because the anchor by
|
// Make sure Carol has enough utxos for anchoring. Because the anchor by
|
||||||
// itself often doesn't meet the dust limit, a utxo from the wallet
|
// itself often doesn't meet the dust limit, a utxo from the wallet
|
||||||
|
@ -176,8 +176,7 @@ func testAnchorReservedValue(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
defer shutdownAndAssert(net, t, bob)
|
defer shutdownAndAssert(net, t, bob)
|
||||||
|
|
||||||
ctxb := context.Background()
|
ctxb := context.Background()
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, alice, bob)
|
||||||
net.ConnectNodes(ctxt, t.t, alice, bob)
|
|
||||||
|
|
||||||
// Send just enough coins for Alice to open a channel without a change
|
// Send just enough coins for Alice to open a channel without a change
|
||||||
// output.
|
// output.
|
||||||
@ -186,7 +185,7 @@ func testAnchorReservedValue(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
feeEst = 8000
|
feeEst = 8000
|
||||||
)
|
)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(context.Background(), defaultTimeout)
|
ctxt, _ := context.WithTimeout(context.Background(), defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, chanAmt+feeEst, alice)
|
net.SendCoins(ctxt, t.t, chanAmt+feeEst, alice)
|
||||||
|
|
||||||
// wallet, without a change output. This should not be allowed.
|
// wallet, without a change output. This should not be allowed.
|
||||||
|
@ -44,12 +44,11 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
// We must let Bob communicate with Carol before they are able to open
|
// We must let Bob communicate with Carol before they are able to open
|
||||||
// channel, so we connect Bob and Carol,
|
// channel, so we connect Bob and Carol,
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, net.Bob)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, net.Bob)
|
|
||||||
|
|
||||||
// Before we make a channel, we'll load up Carol with some coins sent
|
// Before we make a channel, we'll load up Carol with some coins sent
|
||||||
// directly from the miner.
|
// directly from the miner.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
// In order to test Carol's response to an uncooperative channel
|
// In order to test Carol's response to an uncooperative channel
|
||||||
@ -301,12 +300,11 @@ func testRevokedCloseRetributionZeroValueRemoteOutput(net *lntest.NetworkHarness
|
|||||||
|
|
||||||
// We must let Dave have an open channel before she can send a node
|
// We must let Dave have an open channel before she can send a node
|
||||||
// announcement, so we open a channel with Carol,
|
// announcement, so we open a channel with Carol,
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, dave, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, carol)
|
|
||||||
|
|
||||||
// Before we make a channel, we'll load up Dave with some coins sent
|
// Before we make a channel, we'll load up Dave with some coins sent
|
||||||
// directly from the miner.
|
// directly from the miner.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
||||||
|
|
||||||
// In order to test Dave's response to an uncooperative channel
|
// In order to test Dave's response to an uncooperative channel
|
||||||
@ -533,12 +531,11 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness,
|
|||||||
|
|
||||||
// We must let Dave communicate with Carol before they are able to open
|
// We must let Dave communicate with Carol before they are able to open
|
||||||
// channel, so we connect Dave and Carol,
|
// channel, so we connect Dave and Carol,
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, dave, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, carol)
|
|
||||||
|
|
||||||
// Before we make a channel, we'll load up Dave with some coins sent
|
// Before we make a channel, we'll load up Dave with some coins sent
|
||||||
// directly from the miner.
|
// directly from the miner.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
||||||
|
|
||||||
// In order to test Dave's response to an uncooperative channel closure
|
// In order to test Dave's response to an uncooperative channel closure
|
||||||
@ -1029,7 +1026,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(
|
|||||||
|
|
||||||
// We must let Dave have an open channel before she can send a node
|
// We must let Dave have an open channel before she can send a node
|
||||||
// announcement, so we open a channel with Carol,
|
// announcement, so we open a channel with Carol,
|
||||||
net.ConnectNodes(ctxb, t.t, dave, carol)
|
net.ConnectNodes(t.t, dave, carol)
|
||||||
|
|
||||||
// Before we make a channel, we'll load up Dave with some coins sent
|
// Before we make a channel, we'll load up Dave with some coins sent
|
||||||
// directly from the miner.
|
// directly from the miner.
|
||||||
|
@ -103,9 +103,8 @@ func testSingleHopSendToRouteCase(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
// Open a channel with 100k satoshis between Carol and Dave with Carol
|
// Open a channel with 100k satoshis between Carol and Dave with Carol
|
||||||
@ -467,9 +466,8 @@ func testMultiHopSendToRoute(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, carol, net.Bob)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, net.Bob)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, net.Bob)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, net.Bob)
|
||||||
|
|
||||||
chanPointBob := openChannelAndAssert(
|
chanPointBob := openChannelAndAssert(
|
||||||
@ -647,8 +645,7 @@ func testSendToRouteErrorPropagation(net *lntest.NetworkHarness, t *harnessTest)
|
|||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, charlie)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, charlie)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, charlie)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, charlie)
|
|
||||||
|
|
||||||
chanPointCarol := openChannelAndAssert(
|
chanPointCarol := openChannelAndAssert(
|
||||||
t, net, carol, charlie,
|
t, net, carol, charlie,
|
||||||
@ -761,9 +758,8 @@ func testPrivateChannels(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, dave, net.Alice)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, net.Alice)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
||||||
|
|
||||||
chanPointDave := openChannelAndAssert(
|
chanPointDave := openChannelAndAssert(
|
||||||
@ -787,8 +783,7 @@ func testPrivateChannels(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
@ -835,8 +830,7 @@ func testPrivateChannels(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
}
|
}
|
||||||
// Now create a _private_ channel directly between Carol and
|
// Now create a _private_ channel directly between Carol and
|
||||||
// Alice of 100k.
|
// Alice of 100k.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, net.Alice)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, net.Alice)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
|
||||||
chanOpenUpdate := openChannelStream(
|
chanOpenUpdate := openChannelStream(
|
||||||
ctxt, t, net, carol, net.Alice,
|
ctxt, t, net, carol, net.Alice,
|
||||||
@ -1079,8 +1073,7 @@ func testUpdateChannelPolicyForPrivateChannel(net *lntest.NetworkHarness,
|
|||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
// Connect Carol to Bob.
|
// Connect Carol to Bob.
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, net.Bob)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, net.Bob)
|
|
||||||
|
|
||||||
// Open a channel with 100k satoshis between Bob and Carol.
|
// Open a channel with 100k satoshis between Bob and Carol.
|
||||||
chanPointBobCarol := openChannelAndAssert(
|
chanPointBobCarol := openChannelAndAssert(
|
||||||
@ -1110,7 +1103,7 @@ func testUpdateChannelPolicyForPrivateChannel(net *lntest.NetworkHarness,
|
|||||||
Value: paymentAmt,
|
Value: paymentAmt,
|
||||||
Private: true,
|
Private: true,
|
||||||
}
|
}
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
resp, err := carol.AddInvoice(ctxt, invoice)
|
resp, err := carol.AddInvoice(ctxt, invoice)
|
||||||
require.NoError(t.t, err, "unable to create invoice for carol")
|
require.NoError(t.t, err, "unable to create invoice for carol")
|
||||||
|
|
||||||
@ -1210,8 +1203,7 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Alice, carol)
|
|
||||||
chanPointCarol := openChannelAndAssert(
|
chanPointCarol := openChannelAndAssert(
|
||||||
t, net, net.Alice, carol,
|
t, net, net.Alice, carol,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
@ -1225,8 +1217,7 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// we should only include routing hints for nodes that are publicly
|
// we should only include routing hints for nodes that are publicly
|
||||||
// advertised, otherwise we'd end up leaking information about nodes
|
// advertised, otherwise we'd end up leaking information about nodes
|
||||||
// that wish to stay unadvertised.
|
// that wish to stay unadvertised.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Bob, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Bob, carol)
|
|
||||||
chanPointBobCarol := openChannelAndAssert(
|
chanPointBobCarol := openChannelAndAssert(
|
||||||
t, net, net.Bob, carol,
|
t, net, net.Bob, carol,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
@ -1242,8 +1233,7 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Alice, dave)
|
|
||||||
chanPointDave := openChannelAndAssert(
|
chanPointDave := openChannelAndAssert(
|
||||||
t, net, net.Alice, dave,
|
t, net, net.Alice, dave,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
@ -1257,8 +1247,7 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// channel has been created to avoid populating routing hints for
|
// channel has been created to avoid populating routing hints for
|
||||||
// inactive channels.
|
// inactive channels.
|
||||||
eve := net.NewNode(t.t, "Eve", nil)
|
eve := net.NewNode(t.t, "Eve", nil)
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Alice, eve)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Alice, eve)
|
|
||||||
chanPointEve := openChannelAndAssert(
|
chanPointEve := openChannelAndAssert(
|
||||||
t, net, net.Alice, eve,
|
t, net, net.Alice, eve,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
@ -1301,7 +1290,7 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
var predErr error
|
var predErr error
|
||||||
var decoded *lnrpc.PayReq
|
var decoded *lnrpc.PayReq
|
||||||
err := wait.Predicate(func() bool {
|
err := wait.Predicate(func() bool {
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
resp, err := net.Alice.AddInvoice(ctxt, invoice)
|
resp, err := net.Alice.AddInvoice(ctxt, invoice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
predErr = fmt.Errorf("unable to add invoice: %v", err)
|
predErr = fmt.Errorf("unable to add invoice: %v", err)
|
||||||
@ -1341,7 +1330,7 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
// We'll need the short channel ID of the channel between Alice and Bob
|
// We'll need the short channel ID of the channel between Alice and Bob
|
||||||
// to make sure the routing hint is for this channel.
|
// to make sure the routing hint is for this channel.
|
||||||
listReq := &lnrpc.ListChannelsRequest{}
|
listReq := &lnrpc.ListChannelsRequest{}
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
listResp, err := net.Alice.ListChannels(ctxt, listReq)
|
listResp, err := net.Alice.ListChannels(ctxt, listReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to retrieve alice's channels: %v", err)
|
t.Fatalf("unable to retrieve alice's channels: %v", err)
|
||||||
@ -1427,8 +1416,7 @@ func testMultiHopOverPrivateChannels(net *lntest.NetworkHarness, t *harnessTest)
|
|||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, net.Bob, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, net.Bob, carol)
|
|
||||||
chanPointBob := openChannelAndAssert(
|
chanPointBob := openChannelAndAssert(
|
||||||
t, net, net.Bob, carol,
|
t, net, net.Bob, carol,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
@ -1470,8 +1458,7 @@ func testMultiHopOverPrivateChannels(net *lntest.NetworkHarness, t *harnessTest)
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
@ -1606,9 +1593,8 @@ func testQueryRoutes(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, carol, net.Bob)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, net.Bob)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, net.Bob)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, net.Bob)
|
||||||
|
|
||||||
chanPointBob := openChannelAndAssert(
|
chanPointBob := openChannelAndAssert(
|
||||||
@ -1623,8 +1609,7 @@ func testQueryRoutes(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, dave, carol)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, carol)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
@ -1895,9 +1880,8 @@ func testRouteFeeCutoff(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", nil)
|
carol := net.NewNode(t.t, "Carol", nil)
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, carol, net.Alice)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, net.Alice)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
chanPointAliceCarol := openChannelAndAssert(
|
chanPointAliceCarol := openChannelAndAssert(
|
||||||
@ -1912,8 +1896,7 @@ func testRouteFeeCutoff(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, dave, net.Bob)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, net.Bob)
|
|
||||||
chanPointBobDave := openChannelAndAssert(
|
chanPointBobDave := openChannelAndAssert(
|
||||||
t, net, net.Bob, dave,
|
t, net, net.Bob, dave,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
@ -1922,8 +1905,7 @@ func testRouteFeeCutoff(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Open a channel between Carol and Dave.
|
// Open a channel between Carol and Dave.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
chanPointCarolDave := openChannelAndAssert(
|
chanPointCarolDave := openChannelAndAssert(
|
||||||
t, net, carol, dave,
|
t, net, carol, dave,
|
||||||
lntest.OpenChannelParams{
|
lntest.OpenChannelParams{
|
||||||
|
@ -57,9 +57,8 @@ func testSwitchCircuitPersistence(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, dave, net.Alice)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, net.Alice)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
||||||
|
|
||||||
chanPointDave := openChannelAndAssert(
|
chanPointDave := openChannelAndAssert(
|
||||||
@ -85,8 +84,7 @@ func testSwitchCircuitPersistence(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", []string{"--hodl.exit-settle"})
|
carol := net.NewNode(t.t, "Carol", []string{"--hodl.exit-settle"})
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
@ -345,9 +343,8 @@ func testSwitchOfflineDelivery(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, dave, net.Alice)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, net.Alice)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
||||||
|
|
||||||
chanPointDave := openChannelAndAssert(
|
chanPointDave := openChannelAndAssert(
|
||||||
@ -373,8 +370,7 @@ func testSwitchOfflineDelivery(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
carol := net.NewNode(t.t, "Carol", []string{"--hodl.exit-settle"})
|
carol := net.NewNode(t.t, "Carol", []string{"--hodl.exit-settle"})
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
@ -482,8 +478,7 @@ func testSwitchOfflineDelivery(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Then, reconnect them to ensure Dave doesn't just fail back the htlc.
|
// Then, reconnect them to ensure Dave doesn't just fail back the htlc.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, dave, net.Alice)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, net.Alice)
|
|
||||||
|
|
||||||
// Wait to ensure that the payment remain are not failed back after
|
// Wait to ensure that the payment remain are not failed back after
|
||||||
// reconnecting. All node should report the number payments initiated
|
// reconnecting. All node should report the number payments initiated
|
||||||
@ -660,9 +655,8 @@ func testSwitchOfflineDeliveryPersistence(net *lntest.NetworkHarness, t *harness
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, dave, net.Alice)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, net.Alice)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
||||||
|
|
||||||
chanPointDave := openChannelAndAssert(
|
chanPointDave := openChannelAndAssert(
|
||||||
@ -689,8 +683,7 @@ func testSwitchOfflineDeliveryPersistence(net *lntest.NetworkHarness, t *harness
|
|||||||
carol := net.NewNode(t.t, "Carol", []string{"--hodl.exit-settle"})
|
carol := net.NewNode(t.t, "Carol", []string{"--hodl.exit-settle"})
|
||||||
defer shutdownAndAssert(net, t, carol)
|
defer shutdownAndAssert(net, t, carol)
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
@ -961,9 +954,8 @@ func testSwitchOfflineDeliveryOutgoingOffline(
|
|||||||
dave := net.NewNode(t.t, "Dave", nil)
|
dave := net.NewNode(t.t, "Dave", nil)
|
||||||
defer shutdownAndAssert(net, t, dave)
|
defer shutdownAndAssert(net, t, dave)
|
||||||
|
|
||||||
|
net.ConnectNodes(t.t, dave, net.Alice)
|
||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.ConnectNodes(ctxt, t.t, dave, net.Alice)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
||||||
|
|
||||||
chanPointDave := openChannelAndAssert(
|
chanPointDave := openChannelAndAssert(
|
||||||
@ -987,8 +979,7 @@ func testSwitchOfflineDeliveryOutgoingOffline(
|
|||||||
// Dave. Carol is started in htlchodl mode so that we can disconnect the
|
// Dave. Carol is started in htlchodl mode so that we can disconnect the
|
||||||
// intermediary hops before starting the settle.
|
// intermediary hops before starting the settle.
|
||||||
carol := net.NewNode(t.t, "Carol", []string{"--hodl.exit-settle"})
|
carol := net.NewNode(t.t, "Carol", []string{"--hodl.exit-settle"})
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
net.ConnectNodes(t.t, carol, dave)
|
||||||
net.ConnectNodes(ctxt, t.t, carol, dave)
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user