MCPcopy Create free account
hub / github.com/DNAProject/DNA / getBlock

Function getBlock

http/base/rest/interfaces.go:106–121  ·  view source on GitHub ↗
(hash common.Uint256, getTxBytes bool)

Source from the content-addressed store, hash-verified

104}
105
106func getBlock(hash common.Uint256, getTxBytes bool) (interface{}, int64) {
107 block, err := bactor.GetBlockFromStore(hash)
108 if err != nil {
109 return nil, berr.UNKNOWN_BLOCK
110 }
111 if block == nil {
112 return nil, berr.UNKNOWN_BLOCK
113 }
114 if block.Header == nil {
115 return nil, berr.UNKNOWN_BLOCK
116 }
117 if getTxBytes {
118 return common.ToHexString(block.ToArray()), berr.SUCCESS
119 }
120 return bcomn.GetBlockInfo(block), berr.SUCCESS
121}
122
123//get block by hash
124func GetBlockByHash(cmd map[string]interface{}) map[string]interface{} {

Callers 1

GetBlockByHashFunction · 0.85

Calls 2

ToArrayMethod · 0.65
ToHexStringMethod · 0.45

Tested by

no test coverage detected