MCPcopy Create free account
hub / github.com/33cn/chain33 / GetBlocks

Method GetBlocks

client/queueprotocol.go:225–242  ·  view source on GitHub ↗

GetBlocks get block detail from blockchain

(param *types.ReqBlocks)

Source from the content-addressed store, hash-verified

223
224// GetBlocks get block detail from blockchain
225func (q *QueueProtocol) GetBlocks(param *types.ReqBlocks) (*types.BlockDetails, error) {
226 if param == nil {
227 err := types.ErrInvalidParam
228 log.Error("GetBlocks", "Error", err)
229 return nil, err
230 }
231 msg, err := q.send(blockchainKey, types.EventGetBlocks, param)
232 if err != nil {
233 log.Error("GetBlocks", "Error", err.Error())
234 return nil, err
235 }
236 if reply, ok := msg.GetData().(*types.BlockDetails); ok {
237 return reply, nil
238 }
239 err = types.ErrTypeAsset
240 log.Error("GetBlocks", "Error", err.Error())
241 return nil, err
242}
243
244// QueryTx query transaction detail by transaction hash from blockchain
245func (q *QueueProtocol) QueryTx(param *types.ReqHash) (*types.TransactionDetail, error) {

Callers

nothing calls this directly

Calls 3

sendMethod · 0.95
ErrorMethod · 0.65
GetDataMethod · 0.65

Tested by

no test coverage detected