(kvIdx uint64)
| 359 | } |
| 360 | |
| 361 | func (s *StorageManager) syncCheck(kvIdx uint64) error { |
| 362 | meta, success, err := s.shardManager.TryReadMeta(kvIdx) |
| 363 | if !success || err != nil { |
| 364 | return errors.New("meta reading failed") |
| 365 | } |
| 366 | |
| 367 | // There are two cases that we do NOT want to return data: not synced and empty filled |
| 368 | h0 := common.Hash{} // means not filled, e.g. haven't been synced yet |
| 369 | |
| 370 | h1 := common.Hash{} |
| 371 | h1[HashSizeInContract] = h1[HashSizeInContract] | blobFillingMask // means empty filled |
| 372 | |
| 373 | hash := common.Hash{} |
| 374 | copy(hash[:], meta) |
| 375 | if hash == h0 || hash == h1 { |
| 376 | return errors.New("syncing or just empty blob") |
| 377 | } |
| 378 | |
| 379 | return nil |
| 380 | } |
| 381 | |
| 382 | // DownloadAllMetas This function download the blob hashes of all the local storage shards from the smart contract |
| 383 | func (s *StorageManager) DownloadAllMetas(ctx context.Context, batchSize uint64) error { |
no test coverage detected