@@ -4,13 +4,10 @@ import (
4
4
"bytes"
5
5
"context"
6
6
"fmt"
7
- "math/rand"
8
- "reflect"
9
- "strings"
10
- "time"
11
-
12
7
toml "github.com/pelletier/go-toml/v2"
13
8
petritypes "github.com/skip-mev/petri/core/v2/types"
9
+ "reflect"
10
+ "time"
14
11
)
15
12
16
13
type Toml map [string ]any
@@ -167,12 +164,8 @@ func (n *Node) SetDefaultConfigs(ctx context.Context) error {
167
164
func (n * Node ) SetPersistentPeers (ctx context.Context , peers string ) error {
168
165
cometBftConfig := make (Toml )
169
166
170
- allPeers := strings .Split (peers , "," )
171
-
172
167
p2pConfig := make (Toml )
173
-
174
- // return the filtered peers
175
- p2pConfig ["persistent_peers" ] = filterPeers (allPeers )
168
+ p2pConfig ["persistent_peers" ] = peers
176
169
177
170
cometBftConfig ["p2p" ] = p2pConfig
178
171
@@ -182,18 +175,3 @@ func (n *Node) SetPersistentPeers(ctx context.Context, peers string) error {
182
175
cometBftConfig ,
183
176
)
184
177
}
185
-
186
- // filter peers returns a random subset of the given peers. The subset is determined as follows:
187
- // 1. If the number of peers is less than or equal to 20, return all peers.
188
- // 2. If the number of peers is greater than 20, return a random subset of 20 peers.
189
- func filterPeers (allPeers []string ) string {
190
- if len (allPeers ) <= 20 {
191
- return strings .Join (allPeers , "," )
192
- }
193
-
194
- rand .Shuffle (len (allPeers ), func (i , j int ) {
195
- allPeers [i ], allPeers [j ] = allPeers [j ], allPeers [i ]
196
- })
197
-
198
- return strings .Join (allPeers [:20 ], "," )
199
- }
0 commit comments