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

Method decodeKV

ethstorage/p2p/protocol/syncclient.go:1192–1207  ·  view source on GitHub ↗
(payload *BlobPayload)

Source from the content-addressed store, hash-verified

1190}
1191
1192func (s *SyncClient) decodeKV(payload *BlobPayload) ([]byte, bool) {
1193 recordDur := s.metrics.ClientRecordTimeUsed("decodeKv")
1194 defer recordDur()
1195
1196 decodedBlob, found, err := s.storageManager.DecodeKV(payload.BlobIndex, payload.EncodedBlob, payload.BlobCommit,
1197 payload.MinerAddress, payload.EncodeType)
1198 if err != nil || !found {
1199 if err != nil {
1200 s.lg.Error("Failed to decode", "kvIdx", payload.BlobIndex, "error", err)
1201 } else {
1202 s.lg.Info("Failed to decode", "kvIdx", payload.BlobIndex, "error", "not found")
1203 }
1204 return []byte{}, false
1205 }
1206 return decodedBlob, true
1207}
1208
1209func (s *SyncClient) checkBlobCommit(decodedBlob []byte, payload *BlobPayload) bool {
1210 recordDur := s.metrics.ClientRecordTimeUsed("getRoot")

Callers 2

FetchBlobMethod · 0.95
onResultMethod · 0.95

Calls 3

ClientRecordTimeUsedMethod · 0.65
DecodeKVMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected