breacharbiter: don't transition to second level if own spend

This commit is contained in:
Johan T. Halseth committed 2021-05-12 12:32:29 +02:00
1 parent 0a0b5f89c9
commit c3b2791158
2 files changed
+120 -4

No files matched your search

+19
View File
@@ -460,11 +460,30 @@ func updateBreachInfo(breachInfo *retributionInfo, spends []spend) {
for _, s := range spends {
breachedOutput := &inputs[s.index]
txIn := s.detail.SpendingTx.TxIn[s.detail.SpenderInputIndex]
switch breachedOutput.witnessType {
case input.HtlcAcceptedRevoke:
fallthrough
case input.HtlcOfferedRevoke:
// If the HTLC output was spent using the revocation
// key, it is our own spend, and we can forget the
// output. Otherwise it has been taken to the second
// level.
signDesc := &breachedOutput.signDesc
ok, err := input.IsHtlcSpendRevoke(txIn, signDesc)
if err != nil {
brarLog.Errorf("Unable to determine if "+
"revoke spend: %v", err)
break
}
if ok {
brarLog.Debugf("HTLC spend was our own " +
"revocation spend")
break
}
brarLog.Infof("Spend on second-level "+
"%s(%v) for ChannelPoint(%v) "+
"transitions to second-level output",