github.com/ethereum/go-ethereum@v1.14.4-0.20240516095835-473ee8fc07a3/core/txpool/blobpool/config.go (about) 1 // Copyright 2022 The go-ethereum Authors 2 // This file is part of the go-ethereum library. 3 // 4 // The go-ethereum library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-ethereum library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. 16 17 package blobpool 18 19 import ( 20 "github.com/ethereum/go-ethereum/log" 21 ) 22 23 // Config are the configuration parameters of the blob transaction pool. 24 type Config struct { 25 Datadir string // Data directory containing the currently executable blobs 26 Datacap uint64 // Soft-cap of database storage (hard cap is larger due to overhead) 27 PriceBump uint64 // Minimum price bump percentage to replace an already existing nonce 28 } 29 30 // DefaultConfig contains the default configurations for the transaction pool. 31 var DefaultConfig = Config{ 32 Datadir: "blobpool", 33 Datacap: 10 * 1024 * 1024 * 1024 / 4, // TODO(karalabe): /4 handicap for rollout, gradually bump back up to 10GB 34 PriceBump: 100, // either have patience or be aggressive, no mushy ground 35 } 36 37 // sanitize checks the provided user configurations and changes anything that's 38 // unreasonable or unworkable. 39 func (config *Config) sanitize() Config { 40 conf := *config 41 if conf.Datacap < 1 { 42 log.Warn("Sanitizing invalid blobpool storage cap", "provided", conf.Datacap, "updated", DefaultConfig.Datacap) 43 conf.Datacap = DefaultConfig.Datacap 44 } 45 if conf.PriceBump < 1 { 46 log.Warn("Sanitizing invalid blobpool price bump", "provided", conf.PriceBump, "updated", DefaultConfig.PriceBump) 47 conf.PriceBump = DefaultConfig.PriceBump 48 } 49 return conf 50 }