sweeper: set sequence to be able to sweep htlc v2 utxo

pull/255/head
Andras Banki-Horvath 4 years ago
parent cd0a5f9f06
commit 71a7dec649
No known key found for this signature in database
GPG Key ID: 80E5375C094198D8

@ -759,9 +759,10 @@ func (s *loopInSwap) publishTimeoutTx(ctx context.Context,
return s.htlc.GenTimeoutWitness(sig), nil return s.htlc.GenTimeoutWitness(sig), nil
} }
sequence := uint32(0)
timeoutTx, err := s.sweeper.CreateSweepTx( timeoutTx, err := s.sweeper.CreateSweepTx(
ctx, s.height, s.htlc, *htlcOutpoint, s.SenderKey, witnessFunc, ctx, s.height, sequence, s.htlc, *htlcOutpoint, s.SenderKey,
htlcValue, fee, s.timeoutAddr, witnessFunc, htlcValue, fee, s.timeoutAddr,
) )
if err != nil { if err != nil {
return err return err

@ -937,8 +937,8 @@ func (s *loopOutSwap) sweep(ctx context.Context,
// Create sweep tx. // Create sweep tx.
sweepTx, err := s.sweeper.CreateSweepTx( sweepTx, err := s.sweeper.CreateSweepTx(
ctx, s.height, s.htlc, htlcOutpoint, s.ReceiverKey, witnessFunc, ctx, s.height, s.htlc.SuccessSequence(), s.htlc, htlcOutpoint,
htlcValue, fee, s.DestAddr, s.ReceiverKey, witnessFunc, htlcValue, fee, s.DestAddr,
) )
if err != nil { if err != nil {
return err return err

@ -21,7 +21,7 @@ type Sweeper struct {
// CreateSweepTx creates an htlc sweep tx. // CreateSweepTx creates an htlc sweep tx.
func (s *Sweeper) CreateSweepTx( func (s *Sweeper) CreateSweepTx(
globalCtx context.Context, height int32, globalCtx context.Context, height int32, sequence uint32,
htlc *swap.Htlc, htlcOutpoint wire.OutPoint, htlc *swap.Htlc, htlcOutpoint wire.OutPoint,
keyBytes [33]byte, keyBytes [33]byte,
witnessFunc func(sig []byte) (wire.TxWitness, error), witnessFunc func(sig []byte) (wire.TxWitness, error),
@ -37,6 +37,7 @@ func (s *Sweeper) CreateSweepTx(
sweepTx.AddTxIn(&wire.TxIn{ sweepTx.AddTxIn(&wire.TxIn{
PreviousOutPoint: htlcOutpoint, PreviousOutPoint: htlcOutpoint,
SignatureScript: htlc.SigScript, SignatureScript: htlc.SigScript,
Sequence: sequence,
}) })
// Add output for the destination address. // Add output for the destination address.

Loading…
Cancel
Save