What changed, and why it matters
This commit only adds a new automated integration test. It does not change any production code, so it cannot introduce a runtime security vulnerability by itself. The test checks that a feature called 'fundMax' opens a channel at the protocol-level maximum size rather than a smaller user-configured limit. The commit message and code comments explain the intended behavior, but there is no patch to the actual funding logic here.
No security action required. Review the related production implementation of FundMax separately if there is concern that the actual behavior does not match the test's expectation.
Security signals we found
No production code changes
Pure test addition
Test documents intended security/behavior boundary: user-configured maxChanSize should not restrict outgoing fundMax channels
Evidence from the diff
The diff adds one test case registration and one test function, testChannelFundMaxMaxChanSize, in the lnd integration test suite. The test spins up two nodes, sets Alice’s –maxchansize to 5M satoshis (below both non-wumbo and wumbo protocol maximums), funds Alice above the protocol max, then calls OpenChannel with FundMax: true. It asserts the resulting channel capacity equals the protocol maximum (funding.MaxBtcFundingAmount or funding.MaxBtcFundingAmountWumbo) minus the commitment fee. No production code in lnd/funding or related packages is modified.
Changed components
itest/list_on_test.goitest/lnd_channel_funding_fund_max_test.goInspect captured patch +81 / −0
diff --git a/itest/list_on_test.go b/itest/list_on_test.go
index 18732b1..a09c4c1 100644
--- a/itest/list_on_test.go
+++ b/itest/list_on_test.go
@@ -567,6 +567,10 @@ var allTestCases = []*lntest.TestCase{
Name: "channel fundmax anchor reserve",
TestFunc: testChannelFundMaxAnchorReserve,
},
+ {
+ Name: "channel fundmax maxchansize",
+ TestFunc: testChannelFundMaxMaxChanSize,
+ },
{
Name: "htlc timeout resolver extract preimage remote",
TestFunc: testHtlcTimeoutResolverExtractPreimageRemote,
diff --git a/itest/lnd_channel_funding_fund_max_test.go b/itest/lnd_channel_funding_fund_max_test.go
index f2c7385..3471862 100644
--- a/itest/lnd_channel_funding_fund_max_test.go
+++ b/itest/lnd_channel_funding_fund_max_test.go
@@ -6,6 +6,7 @@ import (
"github.com/btcsuite/btcd/btcutil"
"github.com/lightningnetwork/lnd"
+ "github.com/lightningnetwork/lnd/funding"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
@@ -408,3 +409,79 @@ func sweepNodeWalletAndAssert(ht *lntest.HarnessTest, node *node.HarnessNode) {
// Ensure that the node's balance is 0
checkChannelBalance(ht, node, 0, 0)
}
+
+// testChannelFundMaxMaxChanSize verifies that fundMax uses the protocol-level
+// maximum channel size, not the user-configured maxChanSize. The maxChanSize
+// config option is intended only for limiting incoming channel requests, not
+// outgoing ones.
+func testChannelFundMaxMaxChanSize(ht *lntest.HarnessTest) {
+ testCases := []struct {
+ name string
+ wumbo bool
+ expectedMax btcutil.Amount
+ }{
+ {
+ name: "non-wumbo",
+ wumbo: false,
+ expectedMax: funding.MaxBtcFundingAmount,
+ },
+ {
+ name: "wumbo",
+ wumbo: true,
+ expectedMax: funding.MaxBtcFundingAmountWumbo,
+ },
+ }
+
+ for _, tc := range testCases {
+ success := ht.Run(tc.name, func(t *testing.T) {
+ st := ht.Subtest(t)
+
+ // Configure Alice with a restrictive maxChanSize (5M
+ // sats), which is below both protocol maximums.
+ aliceArgs := []string{
+ "--maxchansize=5000000",
+ }
+ if tc.wumbo {
+ aliceArgs = append(
+ aliceArgs, "--protocol.wumbo-channels",
+ )
+ }
+
+ alice := st.NewNode("Alice", aliceArgs)
+
+ // Bob needs wumbo enabled to accept large channels.
+ var bobArgs []string
+ if tc.wumbo {
+ bobArgs = []string{"--protocol.wumbo-channels"}
+ }
+ bob := st.NewNode("Bob", bobArgs)
+
+ st.EnsureConnected(alice, bob)
+
+ // Fund Alice with more than the protocol maximum.
+ fundAmt := tc.expectedMax + btcutil.SatoshiPerBitcoin
+ st.FundCoins(fundAmt, alice)
+
+ // Open channel with fundMax. This should use the
+ // protocol maximum, not the configured maxChanSize.
+ chanPoint := st.OpenChannel(
+ alice, bob, lntest.OpenChannelParams{
+ FundMax: true,
+ },
+ )
+
+ cType := st.GetChannelCommitType(alice, chanPoint)
+
+ // The expected balance is the protocol maximum minus
+ // the commitment fee.
+ expectedBalance := tc.expectedMax -
+ lntest.CalcStaticFee(cType, 0)
+
+ checkChannelBalance(st, alice, expectedBalance, 0)
+ checkChannelBalance(st, bob, 0, expectedBalance)
+ })
+ if !success {
+ break
+ }
+ }
+}
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.