contractcourt: properly use the broadcast state number during breach remedy
This commit is contained in:
parent
5df6704a9c
commit
73641d222f
@ -367,6 +367,7 @@ func (c *chainWatcher) closeObserver(spendNtfn *chainntnfs.SpendEvent) {
|
|||||||
case broadcastStateNum < remoteStateNum:
|
case broadcastStateNum < remoteStateNum:
|
||||||
if err := c.dispatchContractBreach(
|
if err := c.dispatchContractBreach(
|
||||||
commitSpend, remoteCommit,
|
commitSpend, remoteCommit,
|
||||||
|
broadcastStateNum,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
log.Errorf("unable to handle channel "+
|
log.Errorf("unable to handle channel "+
|
||||||
"breach for chan_point=%v: %v",
|
"breach for chan_point=%v: %v",
|
||||||
@ -549,11 +550,12 @@ func (c *chainWatcher) dispatchRemoteClose(commitSpend *chainntnfs.SpendDetail,
|
|||||||
// materials required to bring the cheater to justice, then notify all
|
// materials required to bring the cheater to justice, then notify all
|
||||||
// registered subscribers of this event.
|
// registered subscribers of this event.
|
||||||
func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail,
|
func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail,
|
||||||
remoteCommit *channeldb.ChannelCommitment) error {
|
remoteCommit *channeldb.ChannelCommitment,
|
||||||
|
broadcastStateNum uint64) error {
|
||||||
|
|
||||||
log.Warnf("Remote peer has breached the channel contract for "+
|
log.Warnf("Remote peer has breached the channel contract for "+
|
||||||
"ChannelPoint(%v). Revoked state #%v was broadcast!!!",
|
"ChannelPoint(%v). Revoked state #%v was broadcast!!!",
|
||||||
c.chanState.FundingOutpoint, remoteCommit.CommitHeight)
|
c.chanState.FundingOutpoint, broadcastStateNum)
|
||||||
|
|
||||||
if err := c.chanState.MarkBorked(); err != nil {
|
if err := c.chanState.MarkBorked(); err != nil {
|
||||||
return fmt.Errorf("unable to mark channel as borked: %v", err)
|
return fmt.Errorf("unable to mark channel as borked: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user