Skip to content

Commit 71a7dec

Browse files
committed
sweeper: set sequence to be able to sweep htlc v2 utxo
1 parent cd0a5f9 commit 71a7dec

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

loopin.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,9 +759,10 @@ func (s *loopInSwap) publishTimeoutTx(ctx context.Context,
759759
return s.htlc.GenTimeoutWitness(sig), nil
760760
}
761761

762+
sequence := uint32(0)
762763
timeoutTx, err := s.sweeper.CreateSweepTx(
763-
ctx, s.height, s.htlc, *htlcOutpoint, s.SenderKey, witnessFunc,
764-
htlcValue, fee, s.timeoutAddr,
764+
ctx, s.height, sequence, s.htlc, *htlcOutpoint, s.SenderKey,
765+
witnessFunc, htlcValue, fee, s.timeoutAddr,
765766
)
766767
if err != nil {
767768
return err

loopout.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@ func (s *loopOutSwap) sweep(ctx context.Context,
937937

938938
// Create sweep tx.
939939
sweepTx, err := s.sweeper.CreateSweepTx(
940-
ctx, s.height, s.htlc, htlcOutpoint, s.ReceiverKey, witnessFunc,
941-
htlcValue, fee, s.DestAddr,
940+
ctx, s.height, s.htlc.SuccessSequence(), s.htlc, htlcOutpoint,
941+
s.ReceiverKey, witnessFunc, htlcValue, fee, s.DestAddr,
942942
)
943943
if err != nil {
944944
return err

sweep/sweeper.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type Sweeper struct {
2121

2222
// CreateSweepTx creates an htlc sweep tx.
2323
func (s *Sweeper) CreateSweepTx(
24-
globalCtx context.Context, height int32,
24+
globalCtx context.Context, height int32, sequence uint32,
2525
htlc *swap.Htlc, htlcOutpoint wire.OutPoint,
2626
keyBytes [33]byte,
2727
witnessFunc func(sig []byte) (wire.TxWitness, error),
@@ -37,6 +37,7 @@ func (s *Sweeper) CreateSweepTx(
3737
sweepTx.AddTxIn(&wire.TxIn{
3838
PreviousOutPoint: htlcOutpoint,
3939
SignatureScript: htlc.SigScript,
40+
Sequence: sequence,
4041
})
4142

4243
// Add output for the destination address.

0 commit comments

Comments
 (0)