mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Merge pull request #899 from starius/min-conf-target-2
loopout: fix fee estimate failure if conf_target=1
This commit is contained in:
commit
5f5c6cb6ed
2 changed files with 10 additions and 10 deletions
|
|
@ -136,14 +136,14 @@ func (p *loopOutSweepFeerateProvider) GetConfTargetAndFeeRate(
|
|||
// opens for the client to sweep.
|
||||
blocksUntilExpiry := contract.CltvExpiry - height
|
||||
|
||||
// Find confTarget. If the sweep has expired, use confTarget=1, because
|
||||
// confTarget must be positive.
|
||||
// Find confTarget. If the sweep has expired, use confTarget=2, because
|
||||
// fee estimator fails if confTarget < 2.
|
||||
confTarget := blocksUntilExpiry
|
||||
if confTarget <= 0 {
|
||||
if confTarget < 2 {
|
||||
log.Infof("Swap %x has expired (blocksUntilExpiry=%d), using "+
|
||||
"confTarget=1 for it.", swapHash[:6], blocksUntilExpiry)
|
||||
"confTarget=2 for it.", swapHash[:6], blocksUntilExpiry)
|
||||
|
||||
confTarget = 1
|
||||
confTarget = 2
|
||||
}
|
||||
|
||||
feeFactor := float64(1.0)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ func (s testSweeper) GetSweepFeeDetails(ctx context.Context,
|
|||
return 0, 0, 0, fmt.Errorf("zero sweepConfTarget")
|
||||
|
||||
case sweepConfTarget == 1:
|
||||
feeRate = 30000
|
||||
return 0, 0, 0, fmt.Errorf("sweepConfTarget is 1")
|
||||
|
||||
case sweepConfTarget == 2:
|
||||
feeRate = 25000
|
||||
|
|
@ -213,8 +213,8 @@ func TestLoopOutSweepFeerateProvider(t *testing.T) {
|
|||
height: 800_999,
|
||||
amount: 1_000_000,
|
||||
protocolVersion: loopdb.ProtocolVersionMuSig2,
|
||||
wantConfTarget: 1,
|
||||
wantFeeRate: 33000,
|
||||
wantConfTarget: 2,
|
||||
wantFeeRate: 27500,
|
||||
},
|
||||
{
|
||||
name: "expired",
|
||||
|
|
@ -222,8 +222,8 @@ func TestLoopOutSweepFeerateProvider(t *testing.T) {
|
|||
height: 801_000,
|
||||
amount: 1_000_000,
|
||||
protocolVersion: loopdb.ProtocolVersionMuSig2,
|
||||
wantConfTarget: 1,
|
||||
wantFeeRate: 33000,
|
||||
wantConfTarget: 2,
|
||||
wantFeeRate: 27500,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue