2020-07-02 06:06:44 +02:00
|
|
|
package itest
|
|
|
|
|
|
|
|
import (
|
2022-02-23 14:48:00 +01:00
|
|
|
"github.com/btcsuite/btcd/btcutil"
|
2020-11-17 00:28:56 +01:00
|
|
|
"github.com/lightningnetwork/lnd/funding"
|
2022-08-12 11:03:44 +02:00
|
|
|
"github.com/lightningnetwork/lnd/lntest"
|
2022-08-05 12:15:48 +02:00
|
|
|
"github.com/lightningnetwork/lnd/lnwallet"
|
2020-07-02 06:06:44 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// testWumboChannels tests that only a node that signals wumbo channel
|
|
|
|
// acceptances will allow a wumbo channel to be created. Additionally, if a
|
|
|
|
// node is running with mini channels only enabled, then they should reject any
|
|
|
|
// inbound wumbo channel requests.
|
2022-08-12 11:03:44 +02:00
|
|
|
func testWumboChannels(ht *lntest.HarnessTest) {
|
2020-07-02 06:06:44 +02:00
|
|
|
// With all the channel types exercised, we'll now make sure the wumbo
|
|
|
|
// signalling support works properly.
|
|
|
|
//
|
|
|
|
// We'll make two new nodes, with one of them signalling support for
|
|
|
|
// wumbo channels while the other doesn't.
|
2022-08-05 12:15:48 +02:00
|
|
|
wumboNode := ht.NewNode("wumbo", []string{"--protocol.wumbo-channels"})
|
|
|
|
miniNode := ht.NewNode("mini", nil)
|
2020-07-02 06:06:44 +02:00
|
|
|
|
|
|
|
// We'll send coins to the wumbo node, as it'll be the one imitating
|
|
|
|
// the channel funding.
|
2022-08-05 12:15:48 +02:00
|
|
|
ht.FundCoins(btcutil.SatoshiPerBitcoin, wumboNode)
|
2020-07-02 06:06:44 +02:00
|
|
|
|
|
|
|
// Next we'll connect both nodes, then attempt to make a wumbo channel
|
|
|
|
// funding request to the mini node we created above. The wumbo request
|
|
|
|
// should fail as the node isn't advertising wumbo channels.
|
2022-08-05 12:15:48 +02:00
|
|
|
ht.EnsureConnected(wumboNode, miniNode)
|
2020-07-02 06:06:44 +02:00
|
|
|
|
2020-11-17 00:28:56 +01:00
|
|
|
chanAmt := funding.MaxBtcFundingAmount + 1
|
2020-07-02 06:06:44 +02:00
|
|
|
// The test should indicate a failure due to the channel being too
|
|
|
|
// large.
|
2022-08-05 12:15:48 +02:00
|
|
|
ht.OpenChannelAssertErr(
|
2022-08-12 11:03:44 +02:00
|
|
|
wumboNode, miniNode, lntest.OpenChannelParams{Amt: chanAmt},
|
2022-08-05 12:15:48 +02:00
|
|
|
lnwallet.ErrChanTooLarge(chanAmt, funding.MaxBtcFundingAmount),
|
|
|
|
)
|
2020-07-02 06:06:44 +02:00
|
|
|
|
|
|
|
// We'll now make another wumbo node to accept our wumbo channel
|
|
|
|
// funding.
|
2022-08-05 12:15:48 +02:00
|
|
|
wumboNode2 := ht.NewNode(
|
|
|
|
"wumbo2", []string{"--protocol.wumbo-channels"},
|
2020-07-02 06:06:44 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// Creating a wumbo channel between these two nodes should succeed.
|
2022-08-05 12:15:48 +02:00
|
|
|
ht.EnsureConnected(wumboNode, wumboNode2)
|
|
|
|
chanPoint := ht.OpenChannel(
|
2022-08-12 11:03:44 +02:00
|
|
|
wumboNode, wumboNode2, lntest.OpenChannelParams{Amt: chanAmt},
|
2020-07-02 06:06:44 +02:00
|
|
|
)
|
2022-08-05 12:15:48 +02:00
|
|
|
ht.CloseChannel(wumboNode, chanPoint)
|
2020-07-02 06:06:44 +02:00
|
|
|
}
|