From c4c5b4b1978f1ba67ba043177655e2303764a898 Mon Sep 17 00:00:00 2001 From: iamsofonias Date: Wed, 24 Apr 2024 17:44:33 -0400 Subject: [PATCH] Fix MergeGlobalParamEntryDefaults For Fee Estimator --- lib/pos_fee_estimator.go | 6 ++++-- lib/pos_snapshot_entries.go | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/pos_fee_estimator.go b/lib/pos_fee_estimator.go index 90b4c98ef..1d31bded2 100644 --- a/lib/pos_fee_estimator.go +++ b/lib/pos_fee_estimator.go @@ -295,8 +295,9 @@ func (posFeeEstimator *PoSFeeEstimator) EstimateFeeRateNanosPerKB(minFeeRateNano defer posFeeEstimator.rwLock.RUnlock() mempoolCongestionFactorBasisPoints := posFeeEstimator.globalParams.MempoolCongestionFactorBasisPoints - mempoolPriorityPercentileBasisPoints := posFeeEstimator.globalParams.MempoolPriorityPercentileBasisPoints pastBlocksCongestionFactorBasisPoints := posFeeEstimator.globalParams.MempoolPastBlocksCongestionFactorBasisPoints + + mempoolPriorityPercentileBasisPoints := posFeeEstimator.globalParams.MempoolPriorityPercentileBasisPoints pastBlocksPriorityPercentileBasisPoints := posFeeEstimator.globalParams.MempoolPastBlocksPriorityPercentileBasisPoints maxBlockSize := posFeeEstimator.globalParams.SoftMaxBlockSizeBytesPoS @@ -335,8 +336,9 @@ func (posFeeEstimator *PoSFeeEstimator) EstimateFee(txn *MsgDeSoTxn, minFeeRateN defer posFeeEstimator.rwLock.RUnlock() mempoolCongestionFactorBasisPoints := posFeeEstimator.globalParams.MempoolCongestionFactorBasisPoints - mempoolPriorityPercentileBasisPoints := posFeeEstimator.globalParams.MempoolPriorityPercentileBasisPoints pastBlocksCongestionFactorBasisPoints := posFeeEstimator.globalParams.MempoolPastBlocksCongestionFactorBasisPoints + + mempoolPriorityPercentileBasisPoints := posFeeEstimator.globalParams.MempoolPriorityPercentileBasisPoints pastBlocksPriorityPercentileBasisPoints := posFeeEstimator.globalParams.MempoolPastBlocksPriorityPercentileBasisPoints maxBlockSize := posFeeEstimator.globalParams.SoftMaxBlockSizeBytesPoS diff --git a/lib/pos_snapshot_entries.go b/lib/pos_snapshot_entries.go index e6052f736..f49093a08 100644 --- a/lib/pos_snapshot_entries.go +++ b/lib/pos_snapshot_entries.go @@ -157,6 +157,18 @@ func MergeGlobalParamEntryDefaults(globalParamsEntry *GlobalParamsEntry, params if globalParamsEntryCopy.MempoolFeeEstimatorNumPastBlocks == 0 { globalParamsEntryCopy.MempoolFeeEstimatorNumPastBlocks = params.DefaultMempoolFeeEstimatorNumPastBlocks } + if globalParamsEntryCopy.MempoolCongestionFactorBasisPoints == 0 { + globalParamsEntryCopy.MempoolCongestionFactorBasisPoints = params.DefaultMempoolCongestionFactorBasisPoints + } + if globalParamsEntryCopy.MempoolPastBlocksCongestionFactorBasisPoints == 0 { + globalParamsEntryCopy.MempoolPastBlocksCongestionFactorBasisPoints = params.DefaultMempoolPastBlocksCongestionFactorBasisPoints + } + if globalParamsEntryCopy.MempoolPriorityPercentileBasisPoints == 0 { + globalParamsEntryCopy.MempoolPriorityPercentileBasisPoints = params.DefaultMempoolPriorityPercentileBasisPoints + } + if globalParamsEntryCopy.MempoolPastBlocksPriorityPercentileBasisPoints == 0 { + globalParamsEntryCopy.MempoolPastBlocksPriorityPercentileBasisPoints = params.DefaultMempoolPastBlocksPriorityPercentileBasisPoints + } if globalParamsEntryCopy.MaxBlockSizeBytesPoS == 0 { globalParamsEntryCopy.MaxBlockSizeBytesPoS = params.DefaultMaxBlockSizeBytesPoS }