lnwallet: expose relay fee on fee estimators
This commit is contained in:
parent
febe6cd47f
commit
423dd8ab9b
@ -75,6 +75,10 @@ func (m *mockFeeEstimator) EstimateFeePerKW(
|
||||
}
|
||||
}
|
||||
|
||||
func (m *mockFeeEstimator) RelayFeePerKW() lnwallet.SatPerKWeight {
|
||||
return 1e3
|
||||
}
|
||||
|
||||
func (m *mockFeeEstimator) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -59,6 +59,11 @@ type FeeEstimator interface {
|
||||
// Stop stops any spawned goroutines and cleans up the resources used
|
||||
// by the fee estimator.
|
||||
Stop() error
|
||||
|
||||
// RelayFeePerKW returns the minimum fee rate required for transactions
|
||||
// to be relayed. This is also the basis for calculation of the dust
|
||||
// limit.
|
||||
RelayFeePerKW() SatPerKWeight
|
||||
}
|
||||
|
||||
// StaticFeeEstimator will return a static value for all fee calculation
|
||||
@ -68,6 +73,10 @@ type StaticFeeEstimator struct {
|
||||
// FeePerKW is the static fee rate in satoshis-per-vbyte that will be
|
||||
// returned by this fee estimator.
|
||||
FeePerKW SatPerKWeight
|
||||
|
||||
// RelayFee is the minimum fee rate required for transactions to be
|
||||
// relayed.
|
||||
RelayFee SatPerKWeight
|
||||
}
|
||||
|
||||
// EstimateFeePerKW will return a static value for fee calculations.
|
||||
@ -77,6 +86,14 @@ func (e StaticFeeEstimator) EstimateFeePerKW(numBlocks uint32) (SatPerKWeight, e
|
||||
return e.FeePerKW, nil
|
||||
}
|
||||
|
||||
// RelayFeePerKW returns the minimum fee rate required for transactions to be
|
||||
// relayed.
|
||||
//
|
||||
// NOTE: This method is part of the FeeEstimator interface.
|
||||
func (e StaticFeeEstimator) RelayFeePerKW() SatPerKWeight {
|
||||
return e.RelayFee
|
||||
}
|
||||
|
||||
// Start signals the FeeEstimator to start any processes or goroutines
|
||||
// it needs to perform its duty.
|
||||
//
|
||||
@ -206,6 +223,14 @@ func (b *BtcdFeeEstimator) EstimateFeePerKW(numBlocks uint32) (SatPerKWeight, er
|
||||
return feeEstimate, nil
|
||||
}
|
||||
|
||||
// RelayFeePerKW returns the minimum fee rate required for transactions to be
|
||||
// relayed.
|
||||
//
|
||||
// NOTE: This method is part of the FeeEstimator interface.
|
||||
func (b *BtcdFeeEstimator) RelayFeePerKW() SatPerKWeight {
|
||||
return b.minFeePerKW
|
||||
}
|
||||
|
||||
// fetchEstimate returns a fee estimate for a transaction to be confirmed in
|
||||
// confTarget blocks. The estimate is returned in sat/kw.
|
||||
func (b *BtcdFeeEstimator) fetchEstimate(confTarget uint32) (SatPerKWeight, error) {
|
||||
@ -359,6 +384,14 @@ func (b *BitcoindFeeEstimator) EstimateFeePerKW(numBlocks uint32) (SatPerKWeight
|
||||
return feeEstimate, nil
|
||||
}
|
||||
|
||||
// RelayFeePerKW returns the minimum fee rate required for transactions to be
|
||||
// relayed.
|
||||
//
|
||||
// NOTE: This method is part of the FeeEstimator interface.
|
||||
func (b *BitcoindFeeEstimator) RelayFeePerKW() SatPerKWeight {
|
||||
return b.minFeePerKW
|
||||
}
|
||||
|
||||
// fetchEstimate returns a fee estimate for a transaction to be confirmed in
|
||||
// confTarget blocks. The estimate is returned in sat/kw.
|
||||
func (b *BitcoindFeeEstimator) fetchEstimate(confTarget uint32) (SatPerKWeight, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user