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

Function decodeString

ethstorage/eth/polling_client.go:382–392  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

380}
381
382func decodeString(data []byte) (string, error) {
383 if len(data) < 64 {
384 return "", fmt.Errorf("data too short")
385 }
386 strLen := new(big.Int).SetBytes(data[32:64]).Int64()
387 if int64(len(data)) < 64+strLen {
388 return "", fmt.Errorf("data length mismatch")
389 }
390 strBytes := data[64 : 64+strLen]
391 return string(strBytes), nil
392}

Callers 1

GetContractVersionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected