From b4c5833325f8a5e12f0c1338cbc206b1366917ac Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 29 Jan 2019 18:30:57 -0800 Subject: [PATCH] Revert "fundingmanager_test: add TestFundingManagerRejectInvalidMaxValueInFlight" This reverts commit eb618051208dbd8bb0c160001052b5cc36174888. --- fundingmanager_test.go | 66 ------------------------------------------ 1 file changed, 66 deletions(-) diff --git a/fundingmanager_test.go b/fundingmanager_test.go index 5802083c..196712df 100644 --- a/fundingmanager_test.go +++ b/fundingmanager_test.go @@ -2657,69 +2657,3 @@ func TestFundingManagerMaxConfs(t *testing.T) { string(err.Data)) } } - -// TestFundingManagerRejectInvalidMaxValueInFlight makes sure that the funding -// manager will act accordingly when the remote is requiring us to use a -// max_value_in_flight larger than the channel capacity. -func TestFundingManagerRejectInvalidMaxValueInFlight(t *testing.T) { - alice, bob := setupFundingManagers(t, defaultMaxPendingChannels) - defer tearDownFundingManagers(t, alice, bob) - - localAmt := btcutil.Amount(500000) - pushAmt := btcutil.Amount(0) - capacity := localAmt + pushAmt - - // Make Alice require a max_htlc_value_in_flight greater than the - // channel capacity. - alice.fundingMgr.cfg.RequiredRemoteMaxValue = func( - _ btcutil.Amount) lnwire.MilliSatoshi { - return lnwire.NewMSatFromSatoshis(capacity) + 100 - } - - // Create a funding request and start the workflow. - updateChan := make(chan *lnrpc.OpenStatusUpdate) - errChan := make(chan error, 1) - initReq := &openChanReq{ - targetPubkey: bob.privKey.PubKey(), - chainHash: *activeNetParams.GenesisHash, - localFundingAmt: 500000, - pushAmt: lnwire.NewMSatFromSatoshis(10), - private: true, - updates: updateChan, - err: errChan, - } - - alice.fundingMgr.initFundingWorkflow(bob, initReq) - - // Alice should have sent the OpenChannel message to Bob. - var aliceMsg lnwire.Message - select { - case aliceMsg = <-alice.msgChan: - case err := <-initReq.err: - t.Fatalf("error init funding workflow: %v", err) - case <-time.After(time.Second * 5): - t.Fatalf("alice did not send OpenChannel message") - } - - openChannelReq, ok := aliceMsg.(*lnwire.OpenChannel) - if !ok { - errorMsg, gotError := aliceMsg.(*lnwire.Error) - if gotError { - t.Fatalf("expected OpenChannel to be sent "+ - "from bob, instead got error: %v", - lnwire.ErrorCode(errorMsg.Data[0])) - } - t.Fatalf("expected OpenChannel to be sent from "+ - "alice, instead got %T", aliceMsg) - } - - // Let Bob handle the init message. - bob.fundingMgr.processFundingOpen(openChannelReq, alice) - - // Assert Bob responded with an ErrMaxValueInFlightTooLarge error. - err := assertFundingMsgSent(t, bob.msgChan, "Error").(*lnwire.Error) - if !strings.Contains(string(err.Data), "maxValueInFlight too large") { - t.Fatalf("expected ErrMaxValueInFlightTooLarge error, "+ - "got \"%v\"", string(err.Data)) - } -}