mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-09 06:29:55 +02:00
Merge pull request #8151 from Crypt-iQ/issue_7928
routing: launch fetchFundingTx in goroutine so router can exit
This commit is contained in:
commit
a397642f73
@ -26,6 +26,8 @@
|
|||||||
* [Fixed](https://github.com/lightningnetwork/lnd/pull/8220) a loop variable
|
* [Fixed](https://github.com/lightningnetwork/lnd/pull/8220) a loop variable
|
||||||
issue which may affect programs built using go `v1.20` and below.
|
issue which may affect programs built using go `v1.20` and below.
|
||||||
|
|
||||||
|
* [An issue where LND would hang on shutdown has been fixed.](https://github.com/lightningnetwork/lnd/pull/8151)
|
||||||
|
|
||||||
# New Features
|
# New Features
|
||||||
## Functional Enhancements
|
## Functional Enhancements
|
||||||
## RPC Additions
|
## RPC Additions
|
||||||
@ -47,4 +49,5 @@
|
|||||||
## Tooling and Documentation
|
## Tooling and Documentation
|
||||||
|
|
||||||
# Contributors (Alphabetical Order)
|
# Contributors (Alphabetical Order)
|
||||||
|
* Eugene Siegel
|
||||||
* Yong Yu
|
* Yong Yu
|
||||||
|
@ -1590,7 +1590,7 @@ func (r *ChannelRouter) processUpdate(msg interface{},
|
|||||||
// to obtain the full funding outpoint that's encoded within
|
// to obtain the full funding outpoint that's encoded within
|
||||||
// the channel ID.
|
// the channel ID.
|
||||||
channelID := lnwire.NewShortChanIDFromInt(msg.ChannelID)
|
channelID := lnwire.NewShortChanIDFromInt(msg.ChannelID)
|
||||||
fundingTx, err := r.fetchFundingTx(&channelID)
|
fundingTx, err := r.fetchFundingTxWrapper(&channelID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// In order to ensure we don't erroneously mark a
|
// In order to ensure we don't erroneously mark a
|
||||||
// channel as a zombie due to an RPC failure, we'll
|
// channel as a zombie due to an RPC failure, we'll
|
||||||
@ -1800,6 +1800,36 @@ func (r *ChannelRouter) processUpdate(msg interface{},
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fetchFundingTxWrapper is a wrapper around fetchFundingTx, except that it
|
||||||
|
// will exit if the router has stopped.
|
||||||
|
func (r *ChannelRouter) fetchFundingTxWrapper(chanID *lnwire.ShortChannelID) (
|
||||||
|
*wire.MsgTx, error) {
|
||||||
|
|
||||||
|
txChan := make(chan *wire.MsgTx, 1)
|
||||||
|
errChan := make(chan error, 1)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
tx, err := r.fetchFundingTx(chanID)
|
||||||
|
if err != nil {
|
||||||
|
errChan <- err
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
txChan <- tx
|
||||||
|
}()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case tx := <-txChan:
|
||||||
|
return tx, nil
|
||||||
|
|
||||||
|
case err := <-errChan:
|
||||||
|
return nil, err
|
||||||
|
|
||||||
|
case <-r.quit:
|
||||||
|
return nil, ErrRouterShuttingDown
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// fetchFundingTx returns the funding transaction identified by the passed
|
// fetchFundingTx returns the funding transaction identified by the passed
|
||||||
// short channel ID.
|
// short channel ID.
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user