Skip to content

Commit ccb8a46

Browse files
Address review: don't block sweep reconciliation when no wallet can sign
1 parent 9f5274a commit ccb8a46

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

internal/core/application/sweeper.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,12 +720,23 @@ func (s *sweeper) createBatchSweepTask(commitmentTxid, vtxoTreeRootTxid string)
720720
log.Debugf("sweeper: batch %s swept by: %s", commitmentTxid, txid)
721721
} else {
722722
// if all outputs are spent, it means we missed to mark the batch as swept,
723-
// build a sweep transaction without broadcasting it. we'll use it rebuild sweepEvent.
723+
// build a sweep transaction without broadcasting it. we'll use it to rebuild
724+
// sweepEvent. The outputs are already spent on-chain, so this tx is never
725+
// broadcast and a signing failure (e.g. the wallet that swept them is no
726+
// longer primary or fallback) must not block reconciliation: fall back to the
727+
// unsigned tx, which still carries the txid the event needs.
724728
sweepTxId, sweepTx, err = buildAndSignSweepTx(
725729
s.builder, s.signingWallets(), outputsToSweep,
726730
)
727731
if err != nil {
728-
return err
732+
log.WithError(err).Warnf(
733+
"sweeper: could not sign sweep tx for already-spent batch %s, "+
734+
"reconciling with unsigned tx", commitmentTxid,
735+
)
736+
sweepTx, sweepTxId, err = s.builder.BuildSweepTx(outputsToSweep)
737+
if err != nil {
738+
return err
739+
}
729740
}
730741
}
731742

0 commit comments

Comments
 (0)