This repository was archived by the owner on Jan 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,24 @@ pub struct ClusterConfig {
93
93
pub tpu_connection_pool_size : usize ,
94
94
}
95
95
96
+ impl ClusterConfig {
97
+ pub fn new_with_equal_stakes (
98
+ num_nodes : usize ,
99
+ cluster_lamports : u64 ,
100
+ lamports_per_node : u64 ,
101
+ ) -> Self {
102
+ Self {
103
+ node_stakes : vec ! [ lamports_per_node; num_nodes] ,
104
+ cluster_lamports,
105
+ validator_configs : make_identical_validator_configs (
106
+ & ValidatorConfig :: default_for_test ( ) ,
107
+ num_nodes,
108
+ ) ,
109
+ ..Self :: default ( )
110
+ }
111
+ }
112
+ }
113
+
96
114
impl Default for ClusterConfig {
97
115
fn default ( ) -> Self {
98
116
ClusterConfig {
@@ -133,17 +151,14 @@ impl LocalCluster {
133
151
lamports_per_node : u64 ,
134
152
socket_addr_space : SocketAddrSpace ,
135
153
) -> Self {
136
- let stakes: Vec < _ > = ( 0 ..num_nodes) . map ( |_| lamports_per_node) . collect ( ) ;
137
- let mut config = ClusterConfig {
138
- node_stakes : stakes,
139
- cluster_lamports,
140
- validator_configs : make_identical_validator_configs (
141
- & ValidatorConfig :: default_for_test ( ) ,
154
+ Self :: new (
155
+ & mut ClusterConfig :: new_with_equal_stakes (
142
156
num_nodes,
157
+ cluster_lamports,
158
+ lamports_per_node,
143
159
) ,
144
- ..ClusterConfig :: default ( )
145
- } ;
146
- Self :: new ( & mut config, socket_addr_space)
160
+ socket_addr_space,
161
+ )
147
162
}
148
163
149
164
fn sync_ledger_path_across_nested_config_fields (
You can’t perform that action at this time.
0 commit comments