sweep: use relay fee rate as floor for specified fee rate
This ensures that for transactions where a fee rate is specified (instead of a confirmation target), lnd doesn't accept transactions which would be ultimately ignored by the underlying chain's RPC.
This commit is contained in:
1 file changed
+17
-2
+17
-2
@@ -71,14 +71,29 @@ func DetermineFeePerKw(feeEstimator chainfee.Estimator,
|
|||||||
// internally.
|
// internally.
|
||||||
case feePref.FeeRate != 0:
|
case feePref.FeeRate != 0:
|
||||||
feePerKW := feePref.FeeRate
|
feePerKW := feePref.FeeRate
|
||||||
if feePerKW < chainfee.FeePerKwFloor {
|
|
||||||
|
// Because the user can specify 1 sat/vByte on the RPC
|
||||||
|
// interface, which corresponds to 250 sat/kw, we need to bump
|
||||||
|
// that to the minimum "safe" fee rate which is 253 sat/kw.
|
||||||
|
if feePerKW == chainfee.AbsoluteFeePerKwFloor {
|
||||||
log.Infof("Manual fee rate input of %d sat/kw is "+
|
log.Infof("Manual fee rate input of %d sat/kw is "+
|
||||||
"too low, using %d sat/kw instead", feePerKW,
|
"too low, using %d sat/kw instead", feePerKW,
|
||||||
chainfee.FeePerKwFloor)
|
chainfee.FeePerKwFloor)
|
||||||
|
|
||||||
feePerKW = chainfee.FeePerKwFloor
|
feePerKW = chainfee.FeePerKwFloor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If that bumped fee rate of at least 253 sat/kw is still lower
|
||||||
|
// than the relay fee rate, we return an error to let the user
|
||||||
|
// know. Note that "Relay fee rate" may mean slightly different
|
||||||
|
// things depending on the backend. For bitcoind, it is
|
||||||
|
// effectively max(relay fee, min mempool fee).
|
||||||
|
minFeePerKW := feeEstimator.RelayFeePerKW()
|
||||||
|
if feePerKW < minFeePerKW {
|
||||||
|
return 0, fmt.Errorf("manual fee rate input of %d "+
|
||||||
|
"sat/kw is too low to be accepted into the "+
|
||||||
|
"mempool or relayed to the network", feePerKW)
|
||||||
|
}
|
||||||
|
|
||||||
return feePerKW, nil
|
return feePerKW, nil
|
||||||
|
|
||||||
// Otherwise, we'll attempt a relaxed confirmation target for the
|
// Otherwise, we'll attempt a relaxed confirmation target for the
|
||||||
|
|||||||
Reference in new issue
Block a user