contractcourt: introduce option for commitKey.
This commit is contained in:
5 files changed
+55
-31
No files matched your search
@@ -93,9 +93,9 @@ type BreachCloseInfo struct {
|
||||
// HTLCs to determine if any additional actions need to be made based on the
|
||||
// remote party's commitments.
|
||||
type CommitSet struct {
|
||||
// ConfCommitKey if non-nil, identifies the commitment that was
|
||||
// When the ConfCommitKey is set, it signals that the commitment tx was
|
||||
// confirmed in the chain.
|
||||
ConfCommitKey *HtlcSetKey
|
||||
ConfCommitKey fn.Option[HtlcSetKey]
|
||||
|
||||
// HtlcSets stores the set of all known active HTLC for each active
|
||||
// commitment at the time of channel closure.
|
||||
@@ -509,7 +509,7 @@ func (c *chainWatcher) handleUnknownLocalState(
|
||||
|
||||
// If this is our commitment transaction, then we try to act even
|
||||
// though we won't be able to sweep HTLCs.
|
||||
chainSet.commitSet.ConfCommitKey = &LocalHtlcSet
|
||||
chainSet.commitSet.ConfCommitKey = fn.Some(LocalHtlcSet)
|
||||
if err := c.dispatchLocalForceClose(
|
||||
commitSpend, broadcastStateNum, chainSet.commitSet,
|
||||
); err != nil {
|
||||
@@ -806,7 +806,7 @@ func (c *chainWatcher) handleKnownLocalState(
|
||||
return false, nil
|
||||
}
|
||||
|
||||
chainSet.commitSet.ConfCommitKey = &LocalHtlcSet
|
||||
chainSet.commitSet.ConfCommitKey = fn.Some(LocalHtlcSet)
|
||||
if err := c.dispatchLocalForceClose(
|
||||
commitSpend, broadcastStateNum, chainSet.commitSet,
|
||||
); err != nil {
|
||||
@@ -844,7 +844,7 @@ func (c *chainWatcher) handleKnownRemoteState(
|
||||
log.Infof("Remote party broadcast base set, "+
|
||||
"commit_num=%v", chainSet.remoteStateNum)
|
||||
|
||||
chainSet.commitSet.ConfCommitKey = &RemoteHtlcSet
|
||||
chainSet.commitSet.ConfCommitKey = fn.Some(RemoteHtlcSet)
|
||||
err := c.dispatchRemoteForceClose(
|
||||
commitSpend, chainSet.remoteCommit,
|
||||
chainSet.commitSet,
|
||||
@@ -869,7 +869,7 @@ func (c *chainWatcher) handleKnownRemoteState(
|
||||
log.Infof("Remote party broadcast pending set, "+
|
||||
"commit_num=%v", chainSet.remoteStateNum+1)
|
||||
|
||||
chainSet.commitSet.ConfCommitKey = &RemotePendingHtlcSet
|
||||
chainSet.commitSet.ConfCommitKey = fn.Some(RemotePendingHtlcSet)
|
||||
err := c.dispatchRemoteForceClose(
|
||||
commitSpend, *chainSet.remotePendingCommit,
|
||||
chainSet.commitSet,
|
||||
@@ -936,7 +936,7 @@ func (c *chainWatcher) handlePossibleBreach(commitSpend *chainntnfs.SpendDetail,
|
||||
// only used to ensure a nil-pointer-dereference doesn't occur and is
|
||||
// not used otherwise. The HTLC's may not exist for the
|
||||
// RemotePendingHtlcSet.
|
||||
chainSet.commitSet.ConfCommitKey = &RemoteHtlcSet
|
||||
chainSet.commitSet.ConfCommitKey = fn.Some(RemoteHtlcSet)
|
||||
|
||||
// THEY'RE ATTEMPTING TO VIOLATE THE CONTRACT LAID OUT WITHIN THE
|
||||
// PAYMENT CHANNEL. Therefore we close the signal indicating a revoked
|
||||
@@ -997,7 +997,7 @@ func (c *chainWatcher) handleUnknownRemoteState(
|
||||
// means we won't be able to recover any HTLC funds.
|
||||
//
|
||||
// TODO(halseth): can we try to recover some HTLCs?
|
||||
chainSet.commitSet.ConfCommitKey = &RemoteHtlcSet
|
||||
chainSet.commitSet.ConfCommitKey = fn.Some(RemoteHtlcSet)
|
||||
err := c.dispatchRemoteForceClose(
|
||||
commitSpend, channeldb.ChannelCommitment{},
|
||||
chainSet.commitSet, commitPoint,
|
||||
|
||||
Reference in new issue
Block a user