diff --git a/pluginconfig/execute.go b/pluginconfig/execute.go index e4b9bcf9..37a0373b 100644 --- a/pluginconfig/execute.go +++ b/pluginconfig/execute.go @@ -3,6 +3,7 @@ package pluginconfig import ( "encoding/json" "errors" + "time" commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" ) @@ -36,9 +37,23 @@ type ExecuteOffchainConfig struct { // TokenDataObservers registers different strategies for processing token data. TokenDataObservers []TokenDataObserverConfig `json:"tokenDataObservers"` + + // transmissionDelayMultiplier is used to calculate the transmission delay for each oracle. + TransmissionDelayMultiplier time.Duration `json:"transmissionDelayMultiplier"` +} + +func (e *ExecuteOffchainConfig) ApplyDefaultsAndValidate() error { + e.applyDefaults() + return e.Validate() +} + +func (e *ExecuteOffchainConfig) applyDefaults() { + if e.TransmissionDelayMultiplier == 0 { + e.TransmissionDelayMultiplier = defaultTransmissionDelayMultiplier + } } -func (e ExecuteOffchainConfig) Validate() error { +func (e *ExecuteOffchainConfig) Validate() error { // TODO: this doesn't really make much sense for non-EVM chains. // Maybe we need to have a field in the config that is not JSON-encoded // that indicates chain family? @@ -77,7 +92,7 @@ func (e ExecuteOffchainConfig) Validate() error { return nil } -func (e ExecuteOffchainConfig) IsUSDCEnabled() bool { +func (e *ExecuteOffchainConfig) IsUSDCEnabled() bool { for _, ob := range e.TokenDataObservers { if ob.WellFormed() != nil { continue