Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ocp/worker/currency/feeburner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand All @@ -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),
}
}
}
2 changes: 1 addition & 1 deletion ocp/worker/currency/feeburner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading