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:
1 file changed
+10
-17
+10
-17
@@ -1261,6 +1261,16 @@ func (f *Manager) stateStep(channel *channeldb.OpenChannel,
|
|||||||
err)
|
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 "+
|
log.Debugf("Channel(%v) with ShortChanID %v: successfully "+
|
||||||
"announced", chanID, shortChanID)
|
"announced", chanID, shortChanID)
|
||||||
|
|
||||||
@@ -3286,15 +3296,6 @@ func (f *Manager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
|
|||||||
return fmt.Errorf("unable to send node announcement "+
|
return fmt.Errorf("unable to send node announcement "+
|
||||||
"to peer %x: %v", pubKey, err)
|
"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 {
|
} else {
|
||||||
// Otherwise, we'll wait until the funding transaction has
|
// Otherwise, we'll wait until the funding transaction has
|
||||||
// reached 6 confirmations before announcing it.
|
// reached 6 confirmations before announcing it.
|
||||||
@@ -3978,14 +3979,6 @@ func (f *Manager) announceChannel(localIDKey, remoteIDKey *btcec.PublicKey,
|
|||||||
return err
|
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
|
// We only send the channel proof announcement and the node announcement
|
||||||
// because addToRouterGraph previously sent the ChannelAnnouncement and
|
// because addToRouterGraph previously sent the ChannelAnnouncement and
|
||||||
// the ChannelUpdate announcement messages. The channel proof and node
|
// the ChannelUpdate announcement messages. The channel proof and node
|
||||||
|
|||||||
Reference in new issue
Block a user