@@ -21,6 +21,14 @@ fn default_storage_worker_count() -> usize {
2121 }
2222}
2323
24+ /// Returns the default number of account worker threads.
25+ ///
26+ /// Account workers coordinate storage proof collection and account trie traversal.
27+ /// They are set to the same count as storage workers for simplicity.
28+ fn default_account_worker_count ( ) -> usize {
29+ default_storage_worker_count ( )
30+ }
31+
2432/// The size of proof targets chunk to spawn in one multiproof calculation.
2533pub const DEFAULT_MULTIPROOF_TASK_CHUNK_SIZE : usize = 10 ;
2634
@@ -123,6 +131,8 @@ pub struct TreeConfig {
123131 allow_unwind_canonical_header : bool ,
124132 /// Number of storage proof worker threads.
125133 storage_worker_count : usize ,
134+ /// Number of account proof worker threads.
135+ account_worker_count : usize ,
126136}
127137
128138impl Default for TreeConfig {
@@ -150,6 +160,7 @@ impl Default for TreeConfig {
150160 prewarm_max_concurrency : DEFAULT_PREWARM_MAX_CONCURRENCY ,
151161 allow_unwind_canonical_header : false ,
152162 storage_worker_count : default_storage_worker_count ( ) ,
163+ account_worker_count : default_account_worker_count ( ) ,
153164 }
154165 }
155166}
@@ -180,6 +191,7 @@ impl TreeConfig {
180191 prewarm_max_concurrency : usize ,
181192 allow_unwind_canonical_header : bool ,
182193 storage_worker_count : usize ,
194+ account_worker_count : usize ,
183195 ) -> Self {
184196 assert ! ( max_proof_task_concurrency > 0 , "max_proof_task_concurrency must be at least 1" ) ;
185197 Self {
@@ -205,6 +217,7 @@ impl TreeConfig {
205217 prewarm_max_concurrency,
206218 allow_unwind_canonical_header,
207219 storage_worker_count,
220+ account_worker_count,
208221 }
209222 }
210223
@@ -482,4 +495,15 @@ impl TreeConfig {
482495 self . storage_worker_count = storage_worker_count;
483496 self
484497 }
498+
499+ /// Return the number of account proof worker threads.
500+ pub const fn account_worker_count ( & self ) -> usize {
501+ self . account_worker_count
502+ }
503+
504+ /// Setter for the number of account proof worker threads.
505+ pub const fn with_account_worker_count ( mut self , account_worker_count : usize ) -> Self {
506+ self . account_worker_count = account_worker_count;
507+ self
508+ }
485509}
0 commit comments