mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
sweepbatcher: make sure HTLC.PkScript is filled
This commit is contained in:
parent
d75f17df47
commit
7735bdfe27
2 changed files with 15 additions and 2 deletions
|
|
@ -1515,6 +1515,13 @@ func (b *Batcher) loadSweep(ctx context.Context, swapHash lntypes.Hash,
|
|||
swapHash[:6], err)
|
||||
}
|
||||
|
||||
// Make sure that PkScript of the coin is filled. Otherwise
|
||||
// RegisterSpendNtfn fails.
|
||||
if len(s.HTLC.PkScript) == 0 {
|
||||
return nil, fmt.Errorf("sweep data for %x doesn't have "+
|
||||
"HTLC.PkScript set", swapHash[:6])
|
||||
}
|
||||
|
||||
// Find minimum fee rate for the sweep. Use customFeeRate if it is
|
||||
// provided, otherwise use wallet's EstimateFeeRate.
|
||||
var minFeeRate chainfee.SatPerKWeight
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btclog/v2"
|
||||
"github.com/lightninglabs/loop/loopdb"
|
||||
"github.com/lightninglabs/loop/swap"
|
||||
"github.com/lightninglabs/loop/test"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
|
|
@ -232,13 +233,18 @@ func (h *mockPresignedHelper) FetchSweep(_ context.Context,
|
|||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
|
||||
_, has := h.onlineOutpoints[utxo]
|
||||
// Find IsPresigned.
|
||||
_, isPresigned := h.onlineOutpoints[utxo]
|
||||
|
||||
return &SweepInfo{
|
||||
// Set Timeout to prevent warning messages about timeout=0.
|
||||
Timeout: sweepTimeout,
|
||||
|
||||
IsPresigned: has,
|
||||
IsPresigned: isPresigned,
|
||||
|
||||
HTLC: swap.Htlc{
|
||||
PkScript: []byte{10, 11, 12},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue