lnwallet+sweep: add String method to FeePreference
This commit is contained in:
parent
eba989048c
commit
138d9b68f0
@ -54,6 +54,11 @@ func (s SatPerKVByte) FeePerKWeight() SatPerKWeight {
|
|||||||
return SatPerKWeight(s / blockchain.WitnessScaleFactor)
|
return SatPerKWeight(s / blockchain.WitnessScaleFactor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns a human-readable string of the fee rate.
|
||||||
|
func (s SatPerKVByte) String() string {
|
||||||
|
return fmt.Sprintf("%v sat/kb", int64(s))
|
||||||
|
}
|
||||||
|
|
||||||
// SatPerKWeight represents a fee rate in sat/kw.
|
// SatPerKWeight represents a fee rate in sat/kw.
|
||||||
type SatPerKWeight btcutil.Amount
|
type SatPerKWeight btcutil.Amount
|
||||||
|
|
||||||
@ -69,6 +74,11 @@ func (s SatPerKWeight) FeePerKVByte() SatPerKVByte {
|
|||||||
return SatPerKVByte(s * blockchain.WitnessScaleFactor)
|
return SatPerKVByte(s * blockchain.WitnessScaleFactor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns a human-readable string of the fee rate.
|
||||||
|
func (s SatPerKWeight) String() string {
|
||||||
|
return fmt.Sprintf("%v sat/kw", int64(s))
|
||||||
|
}
|
||||||
|
|
||||||
// FeeEstimator provides the ability to estimate on-chain transaction fees for
|
// FeeEstimator provides the ability to estimate on-chain transaction fees for
|
||||||
// various combinations of transaction sizes and desired confirmation time
|
// various combinations of transaction sizes and desired confirmation time
|
||||||
// (measured by number of blocks).
|
// (measured by number of blocks).
|
||||||
|
@ -30,6 +30,14 @@ type FeePreference struct {
|
|||||||
FeeRate lnwallet.SatPerKWeight
|
FeeRate lnwallet.SatPerKWeight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns a human-readable string of the fee preference.
|
||||||
|
func (p FeePreference) String() string {
|
||||||
|
if p.ConfTarget != 0 {
|
||||||
|
return fmt.Sprintf("%v blocks", p.ConfTarget)
|
||||||
|
}
|
||||||
|
return p.FeeRate.String()
|
||||||
|
}
|
||||||
|
|
||||||
// DetermineFeePerKw will determine the fee in sat/kw that should be paid given
|
// DetermineFeePerKw will determine the fee in sat/kw that should be paid given
|
||||||
// an estimator, a confirmation target, and a manual value for sat/byte. A
|
// an estimator, a confirmation target, and a manual value for sat/byte. A
|
||||||
// value is chosen based on the two free parameters as one, or both of them can
|
// value is chosen based on the two free parameters as one, or both of them can
|
||||||
|
Loading…
Reference in New Issue
Block a user