Add new ConfirmationTarget variant for min mempool feerates
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Thu, 13 Jul 2023 23:02:17 +0000 (16:02 -0700)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Fri, 14 Jul 2023 21:49:52 +0000 (14:49 -0700)
Now that we support channels with anchor outputs, we add a new
ConfirmationTarget variant that, for now, will only apply to such
channels. This new variant should target estimating the minimum feerate
required to be accepted into most node mempools across the network.

fuzz/src/chanmon_consistency.rs
lightning/src/chain/chaininterface.rs

index 8f2c30ffa0bc4b3cc0b0656e62b10d523c39e0ca..cd9c484da2a82f75a924b72150c68d602d5b47ce 100644 (file)
@@ -78,7 +78,7 @@ impl FeeEstimator for FuzzEstimator {
                // Background feerate which is <= the minimum Normal feerate.
                match conf_target {
                        ConfirmationTarget::HighPriority => MAX_FEE,
-                       ConfirmationTarget::Background => 253,
+                       ConfirmationTarget::Background|ConfirmationTarget::MempoolMinimum => 253,
                        ConfirmationTarget::Normal => cmp::min(self.ret_val.load(atomic::Ordering::Acquire), MAX_FEE),
                }
        }
index d875dcce3e128c1443a2deaa46f1a8465a7cd06b..4204d714f1b12be5a7a1a04fed5092746562c827 100644 (file)
@@ -35,15 +35,24 @@ pub trait BroadcasterInterface {
        fn broadcast_transactions(&self, txs: &[&Transaction]);
 }
 
-/// An enum that represents the speed at which we want a transaction to confirm used for feerate
+/// An enum that represents the priority at which we want a transaction to confirm used for feerate
 /// estimation.
 #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
 pub enum ConfirmationTarget {
-       /// We are happy with this transaction confirming slowly when feerate drops some.
+       /// We'd like a transaction to confirm in the future, but don't want to commit most of the fees
+       /// required to do so yet. The remaining fees will come via a Child-Pays-For-Parent (CPFP) fee
+       /// bump of the transaction.
+       ///
+       /// The feerate returned should be the absolute minimum feerate required to enter most node
+       /// mempools across the network. Note that if you are not able to obtain this feerate estimate,
+       /// you should likely use the furthest-out estimate allowed by your fee estimator.
+       MempoolMinimum,
+       /// We are happy with a transaction confirming slowly, at least within a day or so worth of
+       /// blocks.
        Background,
-       /// We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
+       /// We'd like a transaction to confirm without major delayed, i.e., within the next 12-24 blocks.
        Normal,
-       /// We'd like this transaction to confirm in the next few blocks.
+       /// We'd like a transaction to confirm in the next few blocks.
        HighPriority,
 }