mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 06:21:40 +01:00
funding: defer initial forwarding policy deletion
This commit moves the deletion of the initial forwarding policy to the end of `stateStep` to make sure the router has persisted it to disk before the deletion.
This commit is contained in:
parent
38b106ccf3
commit
d9e0464929
1 changed files with 10 additions and 17 deletions
|
@ -1261,6 +1261,16 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
|
|||
err)
|
||||
}
|
||||
|
||||
// After the fee parameters have been stored in the
|
||||
// announcement we can delete them from the database. For
|
||||
// private channels we do not announce the channel policy to
|
||||
// the network but still need to delete them from the database.
|
||||
err = f.deleteInitialForwardingPolicy(chanID)
|
||||
if err != nil {
|
||||
log.Infof("Could not delete initial policy for chanId "+
|
||||
"%x", chanID)
|
||||
}
|
||||
|
||||
log.Debugf("Channel(%v) with ShortChanID %v: successfully "+
|
||||
"announced", chanID, shortChanID)
|
||||
|
||||
|
@ -3286,15 +3296,6 @@ func (f *Manager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
|
|||
return fmt.Errorf("unable to send node announcement "+
|
||||
"to peer %x: %v", pubKey, err)
|
||||
}
|
||||
|
||||
// For private channels we do not announce the channel policy
|
||||
// to the network but still need to delete them from the
|
||||
// database.
|
||||
err = f.deleteInitialForwardingPolicy(chanID)
|
||||
if err != nil {
|
||||
log.Infof("Could not delete channel fees "+
|
||||
"for chanId %x.", chanID)
|
||||
}
|
||||
} else {
|
||||
// Otherwise, we'll wait until the funding transaction has
|
||||
// reached 6 confirmations before announcing it.
|
||||
|
@ -3978,14 +3979,6 @@ func (f *Manager) announceChannel(localIDKey, remoteIDKey *btcec.PublicKey,
|
|||
return err
|
||||
}
|
||||
|
||||
// After the fee parameters have been stored in the announcement
|
||||
// we can delete them from the database.
|
||||
err = f.deleteInitialForwardingPolicy(chanID)
|
||||
if err != nil {
|
||||
log.Infof("Could not delete channel fees for chanId %x.",
|
||||
chanID)
|
||||
}
|
||||
|
||||
// We only send the channel proof announcement and the node announcement
|
||||
// because addToRouterGraph previously sent the ChannelAnnouncement and
|
||||
// the ChannelUpdate announcement messages. The channel proof and node
|
||||
|
|
Loading…
Add table
Reference in a new issue