contractcourt: make sure ChainArbitrator is started properly

We should not fail to start the node if a republish attempt failed for a
channel's closing tx. Instead, we log an error to continue the startup
and let other channels continue their operations.
This commit is contained in:
yyforyongyu 2024-01-06 05:45:33 +08:00
parent fb1c6ea6a7
commit a6a8415a26
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868

View File

@ -548,9 +548,10 @@ func (c *ChainArbitrator) Start() error {
c.activeChannels[chanPoint] = channelArb c.activeChannels[chanPoint] = channelArb
// Republish any closing transactions for this channel. // Republish any closing transactions for this channel.
err = c.publishClosingTxs(channel) err = c.republishClosingTxs(channel)
if err != nil { if err != nil {
return err log.Errorf("Failed to republish closing txs for "+
"channel %v", chanPoint)
} }
} }
@ -825,10 +826,10 @@ func (c *ChainArbitrator) dispatchBlocks(
} }
} }
// publishClosingTxs will load any stored cooperative or unilater closing // republishClosingTxs will load any stored cooperative or unilateral closing
// transactions and republish them. This helps ensure propagation of the // transactions and republish them. This helps ensure propagation of the
// transactions in the event that prior publications failed. // transactions in the event that prior publications failed.
func (c *ChainArbitrator) publishClosingTxs( func (c *ChainArbitrator) republishClosingTxs(
channel *channeldb.OpenChannel) error { channel *channeldb.OpenChannel) error {
// If the channel has had its unilateral close broadcasted already, // If the channel has had its unilateral close broadcasted already,