Skip to content
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
34d2574
lnwallet: add new helper functions to scale confirmations based on amt
Roasbeef Sep 4, 2025
ed0094c
server: use new FundingConfsForAmounts helper func
Roasbeef Sep 4, 2025
531cdd0
lnwallet: define helper func to coop close conf scaling
Roasbeef Sep 4, 2025
7c34188
lnwallet: add tests for new conf scaling helper funcs
Roasbeef Sep 4, 2025
33a26b5
peer+rpcserver: use new conf scaling for notifications
Roasbeef Sep 4, 2025
af7f343
lncfg: add new dev config option for scaling channel close confs
Roasbeef Oct 1, 2025
34db0ad
multi: add new ChannelCloseConfs param, thread thru as needed
Roasbeef Oct 1, 2025
11649bb
peer: send out a notification after the 1st conf, then wait for the rest
Roasbeef Oct 1, 2025
1354e8e
contractcourt: update close logic to handle re-orgs of depth n-1, whe…
Roasbeef Oct 1, 2025
86bd2ee
lntest: add new wait for conf helper method to ChainNotifier
Roasbeef Oct 1, 2025
5608bd5
contractcourt: add new chainWatcherTestHarness
Roasbeef Oct 1, 2025
f1a8a54
contractcourt: update existing chain watcher tests due to new logic
Roasbeef Oct 1, 2025
1b67863
contractcourt: add unit tests for rbf re-org cases
Roasbeef Oct 1, 2025
07c08bf
contractcourt: add generic close re-org tests
Roasbeef Oct 1, 2025
de3ed9c
itest: add new coop close rbf itest
Roasbeef Oct 1, 2025
80be53b
lnrpc/devrpc: add new TriggerSweep dev rpc command
Roasbeef Oct 11, 2025
1b95fdf
sweeper: implement TriggerSweep
Roasbeef Oct 11, 2025
b578431
lntest: add new utilities to wait for mempool/block inclusion, then t…
Roasbeef Oct 11, 2025
08ac7b6
itest: update itests to use new *WithSweep helper assertions
Roasbeef Oct 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 11 additions & 33 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1479,16 +1479,6 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
DefaultMinHtlcIn: cc.MinHtlcIn,
NumRequiredConfs: func(chanAmt btcutil.Amount,
pushAmt lnwire.MilliSatoshi) uint16 {
// For large channels we increase the number
// of confirmations we require for the
// channel to be considered open. As it is
// always the responder that gets to choose
// value, the pushAmt is value being pushed
// to us. This means we have more to lose
// in the case this gets re-orged out, and
// we will require more confirmations before
// we consider it open.

// In case the user has explicitly specified
// a default value for the number of
// confirmations, we use it.
Expand All @@ -1497,29 +1487,17 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
return defaultConf
}

minConf := uint64(3)
maxConf := uint64(6)

// If this is a wumbo channel, then we'll require the
// max amount of confirmations.
if chanAmt > MaxFundingAmount {
return uint16(maxConf)
}

// If not we return a value scaled linearly
// between 3 and 6, depending on channel size.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanna note that this is no longer from 1 to 6 but 3 to 6, which makes sense.

// TODO(halseth): Use 1 as minimum?
maxChannelSize := uint64(
lnwire.NewMSatFromSatoshis(MaxFundingAmount))
stake := lnwire.NewMSatFromSatoshis(chanAmt) + pushAmt
conf := maxConf * uint64(stake) / maxChannelSize
if conf < minConf {
conf = minConf
}
if conf > maxConf {
conf = maxConf
}
return uint16(conf)
// Otherwise, scale the number of confirmations based on
// the channel amount and push amount. For large
// channels we increase the number of
// confirmations we require for the channel to be
// considered open. As it is always the
// responder that gets to choose value, the
// pushAmt is value being pushed to us. This
// means we have more to lose in the case this
// gets re-orged out, and we will require more
// confirmations before we consider it open.
return lnwallet.FundingConfsForAmounts(chanAmt, pushAmt)
},
RequiredRemoteDelay: func(chanAmt btcutil.Amount) uint16 {
// We scale the remote CSV delay (the time the
Expand Down