lnwallet: use remote height as reference when gauging channel breaches
This commit is contained in:
parent
5b7abee92e
commit
63c8c299ed
@ -2019,7 +2019,7 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven
|
|||||||
obfuscator := lc.stateHintObfuscator
|
obfuscator := lc.stateHintObfuscator
|
||||||
broadcastStateNum := GetStateNumHint(commitTxBroadcast, obfuscator)
|
broadcastStateNum := GetStateNumHint(commitTxBroadcast, obfuscator)
|
||||||
|
|
||||||
currentStateNum := lc.currentHeight
|
remoteStateNum := lc.channelState.RemoteCommitment.CommitHeight
|
||||||
|
|
||||||
// TODO(roasbeef): track heights distinctly?
|
// TODO(roasbeef): track heights distinctly?
|
||||||
switch {
|
switch {
|
||||||
@ -2033,7 +2033,7 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven
|
|||||||
// arise when we initiate a state transition, but the remote party has
|
// arise when we initiate a state transition, but the remote party has
|
||||||
// a fail crash _after_ accepting the new state, but _before_ sending
|
// a fail crash _after_ accepting the new state, but _before_ sending
|
||||||
// their signature to us.
|
// their signature to us.
|
||||||
case broadcastStateNum >= currentStateNum:
|
case broadcastStateNum >= remoteStateNum:
|
||||||
walletLog.Infof("Unilateral close of ChannelPoint(%v) "+
|
walletLog.Infof("Unilateral close of ChannelPoint(%v) "+
|
||||||
"detected", lc.channelState.FundingOutpoint)
|
"detected", lc.channelState.FundingOutpoint)
|
||||||
|
|
||||||
@ -2144,11 +2144,11 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven
|
|||||||
// CONTRACT LAID OUT WITHIN THE PAYMENT CHANNEL. Therefore we close
|
// CONTRACT LAID OUT WITHIN THE PAYMENT CHANNEL. Therefore we close
|
||||||
// the signal indicating a revoked broadcast to allow subscribers to
|
// the signal indicating a revoked broadcast to allow subscribers to
|
||||||
// swiftly dispatch justice!!!
|
// swiftly dispatch justice!!!
|
||||||
case broadcastStateNum < currentStateNum:
|
case broadcastStateNum < remoteStateNum:
|
||||||
walletLog.Warnf("Remote peer has breached the channel "+
|
walletLog.Warnf("Remote peer has breached the channel "+
|
||||||
"contract for ChannelPoint(%v). Revoked state #%v was "+
|
"contract for ChannelPoint(%v). Revoked state #%v was "+
|
||||||
"broadcast!!!", lc.channelState.FundingOutpoint,
|
"broadcast!!!", lc.channelState.FundingOutpoint,
|
||||||
broadcastStateNum)
|
remoteStateNum)
|
||||||
|
|
||||||
// Create a new reach retribution struct which contains all the
|
// Create a new reach retribution struct which contains all the
|
||||||
// data needed to swiftly bring the cheating peer to justice.
|
// data needed to swiftly bring the cheating peer to justice.
|
||||||
|
Loading…
Reference in New Issue
Block a user