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

Method GetDataHashes

ethstorage/miner/l1_mining_api.go:112–126  ·  view source on GitHub ↗
(ctx context.Context, contract common.Address, kvIdxes []uint64)

Source from the content-addressed store, hash-verified

110}
111
112func (m *l1MiningAPI) GetDataHashes(ctx context.Context, contract common.Address, kvIdxes []uint64) ([]common.Hash, error) {
113 metas, err := m.GetKvMetas(kvIdxes, rpc.LatestBlockNumber.Int64())
114 if err != nil {
115 m.lg.Error("Failed to get versioned hashes", "error", err)
116 return nil, err
117 }
118 var hashes []common.Hash
119 for i := 0; i < len(metas); i++ {
120 var dhash common.Hash
121 copy(dhash[:], metas[i][32-ethstorage.HashSizeInContract:32])
122 m.lg.Info("Get data hash", "kvIndex", kvIdxes[i], "hash", dhash.Hex())
123 hashes = append(hashes, dhash)
124 }
125 return hashes, nil
126}
127
128func (m *l1MiningAPI) SubmitMinedResult(ctx context.Context, contract common.Address, rst result, cfg Config) (common.Hash, error) {
129 m.lg.Debug("Submit mined result", "shard", rst.startShardId, "block", rst.blockNumber, "nonce", rst.nonce)

Callers

nothing calls this directly

Calls 2

GetKvMetasMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected