Pregunta 10

fees: Introduce Mempool Based Fee Estimation to reduce overestimati...

Kepler 18/06/2026 10:14
Pregunta 10: En FeeRateEstimatorManager::GetFeeRateEstimate se combina el estimate del CBlockPolicyEstimator con el del MemPoolFeeRateEstimator. ¿En qué condiciones se devuelve cada estimador? ¿Qué pasa si el mempool estimator retorna un error o la mempool no está sana?
25/06/2026 18:06
Vamos a por la ultima!
Pol Espinasa 25/06/2026 18:08
nadie?
25/06/2026 18:08
respondo yo pues
😎 1
Kepler 25/06/2026 18:08
Un ultimo esfuerzo que solo queda esta!
arejula27 25/06/2026 18:08
Primero se pide el estimate al block policy estimator: si este falla (feerate vacío) se devuelve directamente su resultado (con su propio error) sin ni siquiera consultar al mempool estimator; si el block policy tiene éxito, se pide también el estimate del mempool estimator y, si este tiene éxito, se devuelve el menor (std::min) de los dos
👍 1
Pol Espinasa 25/06/2026 18:08
Y sino?
25/06/2026 18:09
si mempool estimator falla?
arejula27 25/06/2026 18:09
el min relay no?
25/06/2026 18:10
Si el mempool estimator falla o la mempool no esta sana, se devuelve el CBlockestimator
nebula 25/06/2026 18:11
pero cuando hay error no devuelve no?
Pol Espinasa 25/06/2026 18:11
si mempool falla se devuelve mempool_estimate
👍 1
25/06/2026 18:12
lo cual creo que es un error y un bug
Kepler 25/06/2026 18:13
Cuandoi falla el feerate se queda vacio, i entonces ya no cambi el seleccted estimate, no?
Pol Espinasa 25/06/2026 18:14
FeeRateEstimatorResult FeeRateEstimatorManager::GetFeeRateEstimate(int target, bool conservative) const
{
    auto block_policy_estimate = m_block_policy_estimator->EstimateFeeRate(target, conservative);
    if (block_policy_estimate.feerate.IsEmpty()) {
        return block_policy_estimate;
    }
    auto mempool_estimate = m_mempool_estimator->EstimateFeeRate(conservative);
    if (!mempool_estimate.feerate.IsEmpty()) {
        auto selected_estimate = std::min(block_policy_estimate, mempool_estimate);
        LogDebug(BCLog::ESTIMATEFEE, "Fee rate estimated using %s: for target %s, fee rate %s %s/kvB.\n",
                 FeeRateEstimatorTypeToString(selected_estimate.feerate_estimator),
                 selected_estimate.returned_target,
                 CFeeRate(selected_estimate.feerate.fee, selected_estimate.feerate.size).GetFeePerK(),
                 CURRENCY_ATOM);
        return selected_estimate;
    }
    return mempool_estimate;
}

Si mempool_estimate.feerate.IsEmpty() = true se devuelve mempool_estimate lo cual no tiene sentido porque el feerate es 0.

👍 2
Kepler 25/06/2026 18:15
Pero hay un !, o sea que nega la condicion, no? Cuando el feerate NO esta vacio entra en el if
25/06/2026 18:15
O estoy viendo algo mal, nose
25/06/2026 18:16
vale si toda la razon
Pol Espinasa 25/06/2026 18:16
Entra en el if cuando hay datos tanto de mempool como de bloques
Kepler 25/06/2026 18:16
creo que no tengo la version mas reciente, culpa mia
25/06/2026 18:16
Antes no era asi
Kepler 25/06/2026 18:17

Asi la funcion tiene mas sentido:

FeeRateEstimatorResult FeeRateEstimatorManager::GetFeeRateEstimate(int target, bool conservative) const
{
    FeeRateEstimatorResult selected_estimate;
    std::vector<std::string> errors;
    auto block_policy_estimate = m_block_policy_estimator->EstimateFeeRate(target, conservative);
    errors.insert(errors.end(), block_policy_estimate.errors.begin(), block_policy_estimate.errors.end());
    if (block_policy_estimate.feerate.IsEmpty()) {
        return block_policy_estimate;
    }
    selected_estimate = block_policy_estimate;
    auto mempool_estimate = m_mempool_estimator->EstimateFeeRate(conservative);
    errors.insert(errors.end(), mempool_estimate.errors.begin(), mempool_estimate.errors.end());
    if (!mempool_estimate.feerate.IsEmpty()) {
        selected_estimate = std::min(selected_estimate, mempool_estimate);
    }
    LogDebug(BCLog::ESTIMATEFEE, "Fee rate estimated using %s: for target %s, fee rate %s %s/kvB.\n",
             FeeRateEstimatorTypeToString(selected_estimate.feerate_estimator),
             selected_estimate.returned_target,
             CFeeRate(selected_estimate.feerate.fee, selected_estimate.feerate.size).GetFeePerK(),
             CURRENCY_ATOM);
    selected_estimate.errors = errors;
    return selected_estimate;
}
25/06/2026 18:17
Bueno pues si nadie tiene nada mas que decir hasta aqui el pr club de hoy!
❤️ 2
25/06/2026 18:18
Gracias a todos por venir! @Pol Espinasa Gracias por organizarlo y @sadeeq_ gracisa por venir!
❤️ 2
arejula27 25/06/2026 18:18
Muchas gracias @Kepler por preparar las sesion!
❤️ 1