Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename config parameter DBPath to StoragePath #77

Merged
merged 2 commits into from
Oct 3, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
test/sepolia.keystore
test/ethtxmanager-persistence.json
test/ethtxmanager-persistence.json.tmp
coverage.out
10 changes: 8 additions & 2 deletions ethtxmanager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ import (
type Config struct {
// FrequencyToMonitorTxs frequency of the resending failed txs
FrequencyToMonitorTxs types.Duration `mapstructure:"FrequencyToMonitorTxs"`

// WaitTxToBeMined time to wait after transaction was sent to the ethereum
WaitTxToBeMined types.Duration `mapstructure:"WaitTxToBeMined"`

// GetReceiptMaxTime is the max time to wait to get the receipt of the mined transaction
GetReceiptMaxTime types.Duration `mapstructure:"WaitReceiptMaxTime"`

// GetReceiptWaitInterval is the time to sleep before trying to get the receipt of the mined transaction
GetReceiptWaitInterval types.Duration `mapstructure:"WaitReceiptCheckInterval"`

Expand Down Expand Up @@ -56,11 +59,14 @@ type Config struct {
// max gas price limit: 110
// tx gas price = 110
MaxGasPriceLimit uint64 `mapstructure:"MaxGasPriceLimit"`
// DBPath is the path of the SQL database
DBPath string `mapstructure:"DBPath"`

// StoragePath is the path of the internal storage
StoragePath string `mapstructure:"StoragePath"`

// ReadPendingL1Txs is a flag to enable the reading of pending L1 txs
// It can only be enabled if DBPath is empty
ReadPendingL1Txs bool `mapstructure:"ReadPendingL1Txs"`

// Etherman configuration
Etherman etherman.Config `mapstructure:"Etherman"`

Expand Down
4 changes: 2 additions & 2 deletions ethtxmanager/ethtxmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func New(cfg Config) (*Client, error) {
return nil, err
}

storage, err := createStorage(cfg.DBPath)
storage, err := createStorage(cfg.StoragePath)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -427,7 +427,7 @@ func (c *Client) buildResult(ctx context.Context, mTx types.MonitoredTx) (types.
// get mined
func (c *Client) Start() {
// If no persistence file is uses check L1 for pending txs
if c.cfg.DBPath == "" && c.cfg.ReadPendingL1Txs {
if c.cfg.StoragePath == "" && c.cfg.ReadPendingL1Txs {
pendingTxs, err := pendingL1Txs(c.cfg.Etherman.URL, c.from, c.cfg.Etherman.HTTPHeaders)
if err != nil {
log.Errorf("failed to get pending txs from L1: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {
MaxGasPriceLimit: 0,
SafeStatusL1NumberOfBlocks: 0,
FinalizedStatusL1NumberOfBlocks: 0,
DBPath: "ethtxmanager-persistence.db",
StoragePath: "ethtxmanager-persistence.db",
ReadPendingL1Txs: false,
Log: log.Config{Level: "info", Environment: "development", Outputs: []string{"stderr"}},
PrivateKeys: []types.KeystoreFileConfig{{Path: "test.keystore", Password: "testonly"}},
Expand Down
Loading