diff --git a/fundingmanager.go b/fundingmanager.go index da51572b..05fa621b 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -1167,6 +1167,8 @@ func (f *fundingManager) handleFundingCreated(fmsg *fundingCreatedMsg) { return } + f.deleteReservationCtx(peerKey, fmsg.msg.PendingChannelID) + // Success, funding transaction was confirmed. err := f.handleFundingConfirmation(completeChan, shortChanID) @@ -1175,8 +1177,6 @@ func (f *fundingManager) handleFundingCreated(fmsg *fundingCreatedMsg) { "confirmation: %v", err) return } - - f.deleteReservationCtx(peerKey, fmsg.msg.PendingChannelID) } }() } @@ -1291,6 +1291,8 @@ func (f *fundingManager) handleFundingSigned(fmsg *fundingSignedMsg) { return } + f.deleteReservationCtx(peerKey, pendingChanID) + // Success, funding transaction was confirmed err := f.handleFundingConfirmation(completeChan, shortChanID) @@ -1314,8 +1316,6 @@ func (f *fundingManager) handleFundingSigned(fmsg *fundingSignedMsg) { }, }, } - - f.deleteReservationCtx(peerKey, pendingChanID) }() } diff --git a/lnd_test.go b/lnd_test.go index beea86d0..4eff33f6 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -169,6 +169,9 @@ func openChannelAndAssert(ctx context.Context, t *harnessTest, net *networkHarne if err := net.AssertChannelExists(ctx, alice, &chanPoint); err != nil { t.Fatalf("unable to assert channel existence: %v", err) } + if err := net.AssertChannelExists(ctx, bob, &chanPoint); err != nil { + t.Fatalf("unable to assert channel existence: %v", err) + } return fundingChanPoint } @@ -1807,12 +1810,6 @@ func testBasicChannelCreation(net *networkHarness, t *harnessTest) { ctx, _ := context.WithTimeout(context.Background(), timeout) chanPoints[i] = openChannelAndAssert(ctx, t, net, net.Alice, net.Bob, amount, 0) - - // We need to give Bob a bit of time to make sure the newly - // opened channel is not still pending. - if i != numChannels-1 { - time.Sleep(time.Millisecond * 500) - } } // Close the channel between Alice and Bob, asserting that the @@ -3196,8 +3193,6 @@ func testGraphTopologyNotifications(net *networkHarness, t *harnessTest) { chanPoint = openChannelAndAssert(ctxt, t, net, net.Bob, carol, chanAmt, 0) - time.Sleep(time.Millisecond * 300) - // Reconnect Alice and Bob. This should result in the nodes syncing up // their respective graph state, with the new addition being the // existence of Carol in the graph, and also the channel between Bob @@ -3295,8 +3290,6 @@ func testNodeAnnouncement(net *networkHarness, t *harnessTest) { chanPoint := openChannelAndAssert(ctxt, t, net, net.Bob, dave, 1000000, 0) - time.Sleep(time.Millisecond * 300) - // When Alice now connects with Dave, Alice will get his node announcement. if err := net.ConnectNodes(ctxb, net.Alice, dave); err != nil { t.Fatalf("unable to connect bob to carol: %v", err)