diff --git a/.gitignore b/.gitignore index 01d2eba..5e16387 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ test/sepolia.keystore test/ethtxmanager-persistence.json test/ethtxmanager-persistence.json.tmp +coverage.out diff --git a/ethtxmanager/config.go b/ethtxmanager/config.go index 5d6e8e0..7d1338d 100644 --- a/ethtxmanager/config.go +++ b/ethtxmanager/config.go @@ -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"` @@ -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"` diff --git a/ethtxmanager/ethtxmanager.go b/ethtxmanager/ethtxmanager.go index 4431a34..163e77c 100644 --- a/ethtxmanager/ethtxmanager.go +++ b/ethtxmanager/ethtxmanager.go @@ -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 } @@ -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) diff --git a/test/main.go b/test/main.go index 63607c9..6a82516 100644 --- a/test/main.go +++ b/test/main.go @@ -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"}},