diff --git a/config.go b/config.go index 17cad84..0d0920c 100644 --- a/config.go +++ b/config.go @@ -215,6 +215,7 @@ type P2PConfig struct { HandshakeTimeout Duration `toml:"handshake_timeout"` DialTimeout Duration `toml:"dial_timeout"` DialInterval Duration `toml:"dial_interval"` + AcceptInterval Duration `toml:"accept_interval"` QueueType string `toml:"queue_type"` } diff --git a/config_test.go b/config_test.go index ad5c885..5342187 100644 --- a/config_test.go +++ b/config_test.go @@ -325,6 +325,7 @@ func TestWriteReadRoundTrip(t *testing.T) { original.EVM.HTTPPort = 9545 original.EVM.EnabledLegacySeiApis = []string{"sei_getLogs", "sei_getBlockByNumber"} original.Storage.StateStore.KeepRecent = 50000 + original.Network.P2P.AcceptInterval = Dur(25 * time.Millisecond) if err := WriteConfigToDir(original, dir); err != nil { t.Fatalf("WriteConfigToDir: %v", err) @@ -357,6 +358,12 @@ func TestWriteReadRoundTrip(t *testing.T) { if loaded.Storage.StateStore.KeepRecent != 50000 { t.Errorf("state_store.keep_recent: got %d, want 50000", loaded.Storage.StateStore.KeepRecent) } + // WriteConfigToDir regenerates config.toml wholesale from the legacy structs, + // so a p2p key missing from legacyP2P is silently dropped rather than + // preserved. Pin this one: seid reverts to a 1/s accept rate without it. + if got := loaded.Network.P2P.AcceptInterval; got != Dur(25*time.Millisecond) { + t.Errorf("p2p.accept_interval: got %v, want 25ms", got) + } if loaded.Network.RPC.ListenAddress != testRPCAddr { t.Errorf("rpc.listen_address: got %q", loaded.Network.RPC.ListenAddress) } diff --git a/defaults.go b/defaults.go index 612c92b..095c4a1 100644 --- a/defaults.go +++ b/defaults.go @@ -71,6 +71,7 @@ func baseDefaults() *SeiConfig { HandshakeTimeout: Dur(10 * time.Second), DialTimeout: Dur(3 * time.Second), DialInterval: Dur(10 * time.Second), + AcceptInterval: Dur(10 * time.Millisecond), QueueType: "simple-priority", }, }, diff --git a/legacy.go b/legacy.go index 849402d..ceaf61e 100644 --- a/legacy.go +++ b/legacy.go @@ -77,6 +77,7 @@ type legacyP2P struct { HandshakeTimeout Duration `toml:"handshake-timeout"` DialTimeout Duration `toml:"dial-timeout"` DialInterval Duration `toml:"dial-interval"` + AcceptInterval Duration `toml:"accept-interval"` QueueType string `toml:"queue-type"` } @@ -431,6 +432,7 @@ func (cfg *SeiConfig) toLegacyTendermint() legacyTendermintConfig { HandshakeTimeout: cfg.Network.P2P.HandshakeTimeout, DialTimeout: cfg.Network.P2P.DialTimeout, DialInterval: cfg.Network.P2P.DialInterval, + AcceptInterval: cfg.Network.P2P.AcceptInterval, QueueType: cfg.Network.P2P.QueueType, }, @@ -767,6 +769,7 @@ func fromLegacy(tm legacyTendermintConfig, app legacyAppConfig) *SeiConfig { HandshakeTimeout: tm.P2P.HandshakeTimeout, DialTimeout: tm.P2P.DialTimeout, DialInterval: tm.P2P.DialInterval, + AcceptInterval: tm.P2P.AcceptInterval, QueueType: tm.P2P.QueueType, }, },