loopout: log failed sweeps to allow out of band publish

This commit is contained in:
Andras Banki-Horvath 2022-07-27 20:33:07 +02:00
parent 34644bdf0d
commit a9dbaee102
No known key found for this signature in database
GPG key ID: 80E5375C094198D8

View file

@ -1,6 +1,7 @@
package loop
import (
"bytes"
"context"
"crypto/rand"
"crypto/sha256"
@ -1557,7 +1558,14 @@ func (s *loopOutSwap) sweepMuSig2(ctx context.Context,
labels.LoopOutSweepSuccess(swap.ShortHash(&s.hash)),
)
if err != nil {
s.log.Warnf("Publish of MuSig2 sweep failed: %v", err)
var sweepTxBuf bytes.Buffer
if err := sweepTx.Serialize(&sweepTxBuf); err != nil {
s.log.Warnf("Unable to serialize sweep txn: %v", err)
}
s.log.Warnf("Publish of MuSig2 sweep failed: %v. Raw tx: %x",
err, sweepTxBuf.Bytes())
return false
}
@ -1637,7 +1645,13 @@ func (s *loopOutSwap) sweep(ctx context.Context, htlcOutpoint wire.OutPoint,
labels.LoopOutSweepSuccess(swap.ShortHash(&s.hash)),
)
if err != nil {
s.log.Warnf("Publish sweep: %v", err)
var sweepTxBuf bytes.Buffer
if err := sweepTx.Serialize(&sweepTxBuf); err != nil {
s.log.Warnf("Unable to serialize sweep txn: %v", err)
}
s.log.Warnf("Publish sweep failed: %v. Raw tx: %x",
err, sweepTxBuf.Bytes())
}
return nil