Merge pull request #1211 from ConorOkus/2021-11-add-max-conversion
[rust-lightning] / lightning / src / chain / chaininterface.rs
index 83fee4d674d1611e82dccee1e1c674e8fb94f9aa..cca51e3185130c4c99f76d4517805fd5129fb029 100644 (file)
@@ -23,6 +23,7 @@ pub trait BroadcasterInterface {
 
 /// An enum that represents the speed at which we want a transaction to confirm used for feerate
 /// estimation.
+#[derive(Clone, Copy, PartialEq, Eq)]
 pub enum ConfirmationTarget {
        /// We are happy with this transaction confirming slowly when feerate drops some.
        Background,
@@ -40,12 +41,12 @@ pub enum ConfirmationTarget {
 pub trait FeeEstimator {
        /// Gets estimated satoshis of fee required per 1000 Weight-Units.
        ///
-       /// Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
-       /// don't put us below 1 satoshi-per-byte).
+       /// Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later  
+       /// round-downs don't put us below 1 satoshi-per-byte).
        ///
-       /// This translates to:
-       ///  * satoshis-per-byte * 250
-       ///  * ceil(satoshis-per-kbyte / 4)
+       /// This method can be implemented with the following unit conversions: 
+       ///  * max(satoshis-per-byte * 250, 253)
+       ///  * max(satoshis-per-kbyte / 4, 253)
        fn get_est_sat_per_1000_weight(&self, confirmation_target: ConfirmationTarget) -> u32;
 }