Revert "fundingmanager_test: add TestFundingManagerRejectInvalidMaxValueInFlight"

This reverts commit eb618051208dbd8bb0c160001052b5cc36174888.
This commit is contained in:
Olaoluwa Osuntokun 2019-01-29 18:30:57 -08:00
parent b220c47ce7
commit b4c5833325
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2

@ -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))
}
}