mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 20:15:18 +02:00
channeldb: store close initiator status
This commit adds two new channel statuses which indicate the party that initatited closing the channel. These statuses are set in conjunction with the existing commit broadcast status so that we do not need to migrate existing logic to handle multiple types of closes. This status is set for locally initiated force closes in this commit because they follow a similar pattern to cooparative closes, marking the commitment broadcast then proceeding with tx broadcast. Remote force closes are added in the following commit, as they are handled differently.
This commit is contained in:
@@ -98,7 +98,7 @@ type ChannelArbitratorConfig struct {
|
||||
|
||||
// MarkCommitmentBroadcasted should mark the channel as the commitment
|
||||
// being broadcast, and we are waiting for the commitment to confirm.
|
||||
MarkCommitmentBroadcasted func(*wire.MsgTx) error
|
||||
MarkCommitmentBroadcasted func(*wire.MsgTx, bool) error
|
||||
|
||||
// MarkChannelClosed marks the channel closed in the database, with the
|
||||
// passed close summary. After this method successfully returns we can
|
||||
@@ -797,8 +797,10 @@ func (c *ChannelArbitrator) stateStep(
|
||||
|
||||
// Before publishing the transaction, we store it to the
|
||||
// database, such that we can re-publish later in case it
|
||||
// didn't propagate.
|
||||
if err := c.cfg.MarkCommitmentBroadcasted(closeTx); err != nil {
|
||||
// didn't propagate. We initiated the force close, so we
|
||||
// mark broadcast with local initiator set to true.
|
||||
err = c.cfg.MarkCommitmentBroadcasted(closeTx, true)
|
||||
if err != nil {
|
||||
log.Errorf("ChannelArbitrator(%v): unable to "+
|
||||
"mark commitment broadcasted: %v",
|
||||
c.cfg.ChanPoint, err)
|
||||
|
Reference in New Issue
Block a user