GetBlocks get block detail from blockchain
(param *types.ReqBlocks)
| 223 | |
| 224 | // GetBlocks get block detail from blockchain |
| 225 | func (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 |
| 245 | func (q *QueueProtocol) QueryTx(param *types.ReqHash) (*types.TransactionDetail, error) { |