@@ -17,7 +17,7 @@ use append_merkle::{
1717} ;
1818use itertools:: Itertools ;
1919use kvdb:: DBTransaction ;
20- use parking_lot:: { Mutex , RwLock } ;
20+ use parking_lot:: RwLock ;
2121use shared_types:: { ChunkArray , DataRoot , FlowProof } ;
2222use ssz:: { Decode , Encode } ;
2323use ssz_derive:: { Decode as DeriveDecode , Encode as DeriveEncode } ;
@@ -263,10 +263,13 @@ impl FlowWrite for FlowStore {
263263 ) ?;
264264 if self . seal_manager . seal_worker_available ( ) && batch. is_complete ( ) {
265265 for seal_index in 0 ..SEALS_PER_LOAD {
266- to_seal_set. insert (
267- chunk_index as usize * SEALS_PER_LOAD + seal_index,
268- self . seal_manager . to_seal_version ( ) ,
269- ) ;
266+ // Only add seals that are not already sealed
267+ if !batch. is_seal_sealed ( seal_index as u16 ) {
268+ to_seal_set. insert (
269+ chunk_index as usize * SEALS_PER_LOAD + seal_index,
270+ self . seal_manager . to_seal_version ( ) ,
271+ ) ;
272+ }
270273 }
271274 }
272275
@@ -391,23 +394,17 @@ pub struct PadPair {
391394
392395pub struct FlowDBStore {
393396 kvdb : Arc < dyn ZgsKeyValueDB > ,
394- // Mutex to prevent race condition between put_entry_batch_list and put_entry_raw
395- write_mutex : Mutex < ( ) > ,
396397}
397398
398399impl FlowDBStore {
399400 pub fn new ( kvdb : Arc < dyn ZgsKeyValueDB > ) -> Self {
400- Self {
401- kvdb,
402- write_mutex : Mutex :: new ( ( ) ) ,
403- }
401+ Self { kvdb }
404402 }
405403
406404 fn put_entry_batch_list (
407405 & self ,
408406 batch_list : Vec < ( u64 , EntryBatch ) > ,
409407 ) -> Result < Vec < ( u64 , DataRoot ) > > {
410- let _lock = self . write_mutex . lock ( ) ;
411408 let start_time = Instant :: now ( ) ;
412409 let mut completed_batches = Vec :: new ( ) ;
413410 let mut tx = self . kvdb . transaction ( ) ;
@@ -429,7 +426,6 @@ impl FlowDBStore {
429426 }
430427
431428 fn put_entry_raw ( & self , batch_list : Vec < ( u64 , EntryBatch ) > ) -> Result < ( ) > {
432- let _lock = self . write_mutex . lock ( ) ;
433429 let mut tx = self . kvdb . transaction ( ) ;
434430 for ( batch_index, batch) in batch_list {
435431 tx. put (
0 commit comments