mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
htlcswitch: use FetchAllOpenChannels
This commit changes from using FetchAllChannels to FetchAllOpenChannels, making the check for whether a channel is pending unnecessary.
This commit is contained in:
parent
0735b8e0b7
commit
5cdc7550b5
2 changed files with 2 additions and 10 deletions
|
@ -350,16 +350,12 @@ func (cm *circuitMap) decodeCircuit(v []byte) (*PaymentCircuit, error) {
|
||||||
// channels. Therefore, it must be called before any links are created to avoid
|
// channels. Therefore, it must be called before any links are created to avoid
|
||||||
// interfering with normal operation.
|
// interfering with normal operation.
|
||||||
func (cm *circuitMap) trimAllOpenCircuits() error {
|
func (cm *circuitMap) trimAllOpenCircuits() error {
|
||||||
activeChannels, err := cm.cfg.DB.FetchAllChannels()
|
activeChannels, err := cm.cfg.DB.FetchAllOpenChannels()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, activeChannel := range activeChannels {
|
for _, activeChannel := range activeChannels {
|
||||||
if activeChannel.IsPending {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
chanID := activeChannel.ShortChanID
|
chanID := activeChannel.ShortChanID
|
||||||
start := activeChannel.LocalCommitment.LocalHtlcIndex
|
start := activeChannel.LocalCommitment.LocalHtlcIndex
|
||||||
if err := cm.TrimOpenCircuits(chanID, start); err != nil {
|
if err := cm.TrimOpenCircuits(chanID, start); err != nil {
|
||||||
|
|
|
@ -1513,16 +1513,12 @@ func (s *Switch) Start() error {
|
||||||
// forwarding packages and reforwards any Settle or Fail HTLCs found. This is
|
// forwarding packages and reforwards any Settle or Fail HTLCs found. This is
|
||||||
// used to resurrect the switch's mailboxes after a restart.
|
// used to resurrect the switch's mailboxes after a restart.
|
||||||
func (s *Switch) reforwardResponses() error {
|
func (s *Switch) reforwardResponses() error {
|
||||||
activeChannels, err := s.cfg.DB.FetchAllChannels()
|
activeChannels, err := s.cfg.DB.FetchAllOpenChannels()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, activeChannel := range activeChannels {
|
for _, activeChannel := range activeChannels {
|
||||||
if activeChannel.IsPending {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
shortChanID := activeChannel.ShortChanID
|
shortChanID := activeChannel.ShortChanID
|
||||||
fwdPkgs, err := s.loadChannelFwdPkgs(shortChanID)
|
fwdPkgs, err := s.loadChannelFwdPkgs(shortChanID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue