MCPcopy Create free account
hub / github.com/ethstorage/es-node / RequestL2Range

Method RequestL2Range

ethstorage/p2p/protocol/syncclient.go:577–593  ·  view source on GitHub ↗
(start, end uint64)

Source from the content-addressed store, hash-verified

575}
576
577func (s *SyncClient) RequestL2Range(start, end uint64) (uint64, error) {
578 for _, pr := range s.peers {
579 id := rand.Uint64()
580 var packet BlobsByRangePacket
581 _, err := pr.RequestBlobsByRange(id, s.storageManager.ContractAddress(), start/s.storageManager.KvEntries(), start, end, &packet)
582 if err != nil {
583 return 0, err
584 }
585 _, _, inserted, err := s.onResult(packet.Blobs)
586 if err != nil {
587 return 0, err
588 }
589
590 return uint64(len(inserted)), nil
591 }
592 return 0, fmt.Errorf("no peer can be used to send requests")
593}
594
595func (s *SyncClient) FetchBlob(kvIndex uint64, commit common.Hash) ([]byte, error) {
596 if len(s.peers) == 0 {

Callers 1

TestSync_RequestL2RangeFunction · 0.45

Calls 4

onResultMethod · 0.95
RequestBlobsByRangeMethod · 0.80
ContractAddressMethod · 0.65
KvEntriesMethod · 0.65

Tested by 1

TestSync_RequestL2RangeFunction · 0.36