diff --git a/lib/blockchain.go b/lib/blockchain.go index 02d4ebf3d..504b1f1bc 100644 --- a/lib/blockchain.go +++ b/lib/blockchain.go @@ -5014,10 +5014,10 @@ func (bc *Blockchain) CreateMaxSpend( txn, minFeeRateNanosPerKB, // TODO: Make these flags or GlobalParams - bc.params.MempoolCongestionFactorBasisPoints, - bc.params.MempoolPriorityPercentileBasisPoints, - bc.params.PastBlocksCongestionFactorBasisPoints, - bc.params.PastBlocksPriorityPercentileBasisPoints, + bc.params.DefaultMempoolCongestionFactorBasisPoints, + bc.params.DefaultMempoolPriorityPercentileBasisPoints, + bc.params.DefaultMempoolPastBlocksCongestionFactorBasisPoints, + bc.params.DefaultMempoolPastBlocksPriorityPercentileBasisPoints, maxBlockSizeBytes) if err != nil { return nil, 0, 0, 0, errors.Wrapf(err, "CreateMaxSpend: Problem estimating fee: ") @@ -5157,10 +5157,10 @@ func (bc *Blockchain) AddInputsAndChangeToTransactionWithSubsidy( txArg, minFeeRateNanosPerKB, // TODO: Make these flags or GlobalParams - bc.params.MempoolCongestionFactorBasisPoints, - bc.params.MempoolPriorityPercentileBasisPoints, - bc.params.PastBlocksCongestionFactorBasisPoints, - bc.params.PastBlocksPriorityPercentileBasisPoints, + bc.params.DefaultMempoolCongestionFactorBasisPoints, + bc.params.DefaultMempoolPriorityPercentileBasisPoints, + bc.params.DefaultMempoolPastBlocksCongestionFactorBasisPoints, + bc.params.DefaultMempoolPastBlocksPriorityPercentileBasisPoints, maxBlockSizeBytes) UpdateTxnFee(txArg, newTxFee) if err != nil { @@ -5879,10 +5879,10 @@ func (bc *Blockchain) CreateAtomicTxnsWrapper( txn, minFeeRateNanosPerKB, // TODO: Make these flags or GlobalParams - bc.params.MempoolCongestionFactorBasisPoints, - bc.params.MempoolPriorityPercentileBasisPoints, - bc.params.PastBlocksCongestionFactorBasisPoints, - bc.params.PastBlocksPriorityPercentileBasisPoints, + bc.params.DefaultMempoolCongestionFactorBasisPoints, + bc.params.DefaultMempoolPriorityPercentileBasisPoints, + bc.params.DefaultMempoolPastBlocksCongestionFactorBasisPoints, + bc.params.DefaultMempoolPastBlocksPriorityPercentileBasisPoints, maxBlockSizeBytes) if err != nil { return nil, 0, errors.Wrapf(err, "CreateAtomicTxnsWrapper: failed to recompute fee estimate") @@ -5972,10 +5972,10 @@ func (bc *Blockchain) CreateAtomicTxnsWrapper( atomicTxn, 0, // TODO: Make these flags or GlobalParams - bc.params.MempoolCongestionFactorBasisPoints, - bc.params.MempoolPriorityPercentileBasisPoints, - bc.params.PastBlocksCongestionFactorBasisPoints, - bc.params.PastBlocksPriorityPercentileBasisPoints, + bc.params.DefaultMempoolCongestionFactorBasisPoints, + bc.params.DefaultMempoolPriorityPercentileBasisPoints, + bc.params.DefaultMempoolPastBlocksCongestionFactorBasisPoints, + bc.params.DefaultMempoolPastBlocksPriorityPercentileBasisPoints, maxBlockSizeBytes) if err != nil { return nil, 0, errors.Wrapf(err, "CreateAtomicTxnsWrapper: failed to compute "+ diff --git a/lib/constants.go b/lib/constants.go index b6db7de56..eced4d227 100644 --- a/lib/constants.go +++ b/lib/constants.go @@ -794,6 +794,18 @@ type DeSoParams struct { // this setting. DefaultMempoolFeeEstimatorNumPastBlocks uint64 + // DefaultMempoolCongestionFactorBasisPoints and DefaultMempoolPastBlocksCongestionFactorBasisPoints are the default values + // for GlobalParams.MempoolCongestionFactorBasisPoints and GlobalParams.DefaultMempoolPastBlocksCongestionFactorBasisPoints. + /// See comments in DeSoMainnetParams for a description of their usage. + DefaultMempoolCongestionFactorBasisPoints uint64 + DefaultMempoolPastBlocksCongestionFactorBasisPoints uint64 + + // DefaultMempoolPriorityPercentileBasisPoints and DefaultMempoolPastBlocksPriorityPercentileBasisPoints are the default values + // for GlobalParams.DefaultMempoolPriorityPercentileBasisPoints and GlobalParams.DefaultMempoolPastBlocksPriorityPercentileBasisPoints. + // See comments in DeSoMainnetParams for a description of their usage. + DefaultMempoolPriorityPercentileBasisPoints uint64 + DefaultMempoolPastBlocksPriorityPercentileBasisPoints uint64 + // DefaultMaxBlockSizeBytesPoS is the default value for GlobalParamsEntry.MaxBlockSizeBytesPoS. // This is the initial value for the maximum block size in bytes that we allow for PoS blocks. DefaultMaxBlockSizeBytesPoS uint64 @@ -823,12 +835,6 @@ type DeSoParams struct { ForkHeights ForkHeights - // See comment on the DeSoMainnetParams settings of these values - MempoolCongestionFactorBasisPoints uint64 - MempoolPriorityPercentileBasisPoints uint64 - PastBlocksCongestionFactorBasisPoints uint64 - PastBlocksPriorityPercentileBasisPoints uint64 - EncoderMigrationHeights *EncoderMigrationHeights EncoderMigrationHeightsList []*MigrationHeight } @@ -1353,7 +1359,7 @@ var DeSoMainnetParams = DeSoParams{ // The congestion factor determines when we will start to increase or decrease fees. // We set the congestion factor to 90% for past blocks and mempool. This makes it so that we will - // start to increase fees when the past N blocks (DefaultMempoolFeeEstimatorNumPastBlocks) are + // start to increase fees when the past N blocks (DefaultMempoolPastBlocksCongestionFactorBasisPoints) are // 90% full on average or the mempool has 90% of 1 block's worth of txns in it (actually 90% of // DefaultMempoolFeeEstimatorNumMempoolBlocks). This is good because it ensures that the typical // fee estimate we give will be highly likely to get one's transaction included in the next block @@ -1362,8 +1368,8 @@ var DeSoMainnetParams = DeSoParams{ // Using the 90th percentile allows the fee market to be aggressive, but it's better than using // 100% because that can have some rounding issues. For example, if you use 100% and blocks are // 99% full, the fee market won't adapt. So it's better to have a little slack. - MempoolCongestionFactorBasisPoints: uint64(9000), - PastBlocksCongestionFactorBasisPoints: uint64(9000), + DefaultMempoolCongestionFactorBasisPoints: uint64(9000), + DefaultMempoolPastBlocksCongestionFactorBasisPoints: uint64(9000), // The priority percentile determines what benchmark we use to increase the fee we're paying. For // past blocks, we set a percentile of 90%, which means we'll take the fee paid by the 90th percentile // txn in the past N blocks and increase it by one fee bucket. This works nicely with N=50 blocks @@ -1372,8 +1378,8 @@ var DeSoMainnetParams = DeSoParams{ // the highest 1 block's worth of txns in the mempool. We use a lower percentile here because the mempool // has a much tighter window of a single block, and so by outbidding *anybody* in that block, you're // already highly likely to get in. - MempoolPriorityPercentileBasisPoints: uint64(1000), - PastBlocksPriorityPercentileBasisPoints: uint64(9000), + DefaultMempoolPriorityPercentileBasisPoints: uint64(1000), + DefaultMempoolPastBlocksPriorityPercentileBasisPoints: uint64(9000), ForkHeights: MainnetForkHeights, EncoderMigrationHeights: GetEncoderMigrationHeights(&MainnetForkHeights), @@ -1684,10 +1690,10 @@ var DeSoTestnetParams = DeSoParams{ DisableNetworkManagerRoutines: false, // See comment on DeSoMainnetParams - MempoolCongestionFactorBasisPoints: uint64(9000), - PastBlocksCongestionFactorBasisPoints: uint64(9000), - MempoolPriorityPercentileBasisPoints: uint64(1000), - PastBlocksPriorityPercentileBasisPoints: uint64(9000), + DefaultMempoolCongestionFactorBasisPoints: uint64(9000), + DefaultMempoolPastBlocksCongestionFactorBasisPoints: uint64(9000), + DefaultMempoolPriorityPercentileBasisPoints: uint64(1000), + DefaultMempoolPastBlocksPriorityPercentileBasisPoints: uint64(9000), ForkHeights: TestnetForkHeights, EncoderMigrationHeights: GetEncoderMigrationHeights(&TestnetForkHeights),