From 1c01de1085e9bd6a664e3e345fec13c457aa108d Mon Sep 17 00:00:00 2001 From: b00f Date: Tue, 18 Jun 2024 14:23:19 +0800 Subject: [PATCH] feat(config): make minimum fee configurable (#1349) Co-authored-by: Javad Rajabzadeh --- config/example_config.toml | 4 ++++ txpool/config.go | 4 ++-- txpool/config_test.go | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/example_config.toml b/config/example_config.toml index b509e1997..ef1ae39ac 100644 --- a/config/example_config.toml +++ b/config/example_config.toml @@ -118,6 +118,10 @@ # Default is `1000`. max_size = 1000 + # `min_fee` indicates the minimum fee in PAC for the transaction to enter into the pool. + # Default is `0.01`. + min_fee = 0.01 + # `logger` contains configuration options for the logger. [logger] # `colorful` indicates whether log can be colorful or not. diff --git a/txpool/config.go b/txpool/config.go index 4aebe91dc..87e36cae0 100644 --- a/txpool/config.go +++ b/txpool/config.go @@ -6,13 +6,13 @@ import ( type Config struct { MaxSize int `toml:"max_size"` - MinFeePAC float64 `toml:"-"` + MinFeePAC float64 `toml:"min_fee"` } func DefaultConfig() *Config { return &Config{ MaxSize: 1000, - MinFeePAC: 0.1, + MinFeePAC: 0.01, } } diff --git a/txpool/config_test.go b/txpool/config_test.go index f968860c1..d4fd97485 100644 --- a/txpool/config_test.go +++ b/txpool/config_test.go @@ -16,7 +16,7 @@ func TestDefaultConfigCheck(t *testing.T) { assert.Equal(t, 100, c.unbondPoolSize()) assert.Equal(t, 100, c.withdrawPoolSize()) assert.Equal(t, 100, c.sortitionPoolSize()) - assert.Equal(t, amount.Amount(0.1e9), c.minFee()) + assert.Equal(t, amount.Amount(0.1e8), c.minFee()) assert.Equal(t, c.transferPoolSize()+