Merge pull request #10045 from yyforyongyu/fix-panic

contractcourt: only close quit in `Stop`
This commit is contained in:
Oliver Gugger
2025-07-07 16:30:58 +02:00
committed by GitHub
2 changed files with 10 additions and 7 deletions

View File

@@ -286,19 +286,18 @@ func (u *UtxoNursery) Start() error {
// 2. Restart spend ntfns for any preschool outputs, which are waiting // 2. Restart spend ntfns for any preschool outputs, which are waiting
// for the force closed commitment txn to confirm, or any second-layer // for the force closed commitment txn to confirm, or any second-layer
// HTLC success transactions. // HTLC success transactions.
// // NOTE: The next two steps *may* spawn go routines.
// NOTE: The next two steps *may* spawn go routines, thus from this
// point forward, we must close the nursery's quit channel if we detect
// any failures during startup to ensure they terminate.
if err := u.reloadPreschool(); err != nil { if err := u.reloadPreschool(); err != nil {
close(u.quit) utxnLog.Errorf("Failed to reload preschool: %v", err)
return err return err
} }
// 3. Replay all crib and kindergarten outputs up to the current best // 3. Replay all crib and kindergarten outputs up to the current best
// height. // height.
if err := u.reloadClasses(uint32(bestHeight)); err != nil { if err := u.reloadClasses(uint32(bestHeight)); err != nil {
close(u.quit) utxnLog.Errorf("Failed to reload class: %v", err)
return err return err
} }
@@ -309,7 +308,8 @@ func (u *UtxoNursery) Start() error {
Hash: bestHash, Hash: bestHash,
}) })
if err != nil { if err != nil {
close(u.quit) utxnLog.Errorf("RegisterBlockEpochNtfn failed: %v", err)
return err return err
} }

View File

@@ -39,6 +39,9 @@
- [Fixed](https://github.com/lightningnetwork/lnd/pull/10035) a deadlock (writer starvation) in the switch. - [Fixed](https://github.com/lightningnetwork/lnd/pull/10035) a deadlock (writer starvation) in the switch.
- Fixed a [case](https://github.com/lightningnetwork/lnd/pull/10045) that a
panic may happen which prevents the node from starting up.
# New Features # New Features
## Functional Enhancements ## Functional Enhancements