From 0f5f987e65db4cccb75e9b6cb0a189938d2f5b9c Mon Sep 17 00:00:00 2001 From: jeffyanta Date: Fri, 11 Sep 2026 14:18:27 -0400 Subject: [PATCH] Add configurable min burn size to fee burn worker --- ocp/worker/currency/feeburner/config.go | 9 +++++++++ ocp/worker/currency/feeburner/worker.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ocp/worker/currency/feeburner/config.go b/ocp/worker/currency/feeburner/config.go index 80b73e1..185c173 100644 --- a/ocp/worker/currency/feeburner/config.go +++ b/ocp/worker/currency/feeburner/config.go @@ -3,6 +3,7 @@ package feeburner import ( "github.com/code-payments/ocp-server/config" "github.com/code-payments/ocp-server/config/env" + "github.com/code-payments/ocp-server/ocp/common" ) const ( @@ -16,12 +17,19 @@ const ( MaxBurnsPerBatchConfigEnvName = envConfigPrefix + "MAX_BURNS_PER_BATCH" defaultMaxBurnsPerBatch = 10 + + MinBurnSizeConfigEnvName = envConfigPrefix + "MIN_BURN_SIZE" +) + +var ( + defaultMinBurnSize = common.ToCoreMintQuarks(1) ) type conf struct { subsidizer config.String batchSize config.Uint64 maxBurnsPerBatch config.Uint64 + minBurnSize config.Uint64 } // ConfigProvider defines how config values are pulled @@ -34,6 +42,7 @@ func WithEnvConfigs() ConfigProvider { subsidizer: env.NewStringConfig(SubsidizerConfigEnvName, defaultSubsidizer), batchSize: env.NewUint64Config(BatchSizeConfigEnvName, defaultBatchSize), maxBurnsPerBatch: env.NewUint64Config(MaxBurnsPerBatchConfigEnvName, defaultMaxBurnsPerBatch), + minBurnSize: env.NewUint64Config(MinBurnSizeConfigEnvName, defaultMinBurnSize), } } } diff --git a/ocp/worker/currency/feeburner/worker.go b/ocp/worker/currency/feeburner/worker.go index fc0e514..e8d7086 100644 --- a/ocp/worker/currency/feeburner/worker.go +++ b/ocp/worker/currency/feeburner/worker.go @@ -133,7 +133,7 @@ func (p *runtime) hasFeesToBurn(ctx context.Context, record *currency.MetadataRe return false, errors.Wrap(err, "invalid liquidity pool account data") } - return pool.FeesAccumulated > 0, nil + return pool.FeesAccumulated >= p.conf.minBurnSize.Get(ctx), nil } // packBurnBatches greedily packs burn targets into the fewest transactions