get block by hash
(cmd map[string]interface{})
| 122 | |
| 123 | //get block by hash |
| 124 | func GetBlockByHash(cmd map[string]interface{}) map[string]interface{} { |
| 125 | resp := ResponsePack(berr.SUCCESS) |
| 126 | str := cmd["Hash"].(string) |
| 127 | if len(str) == 0 { |
| 128 | return ResponsePack(berr.INVALID_PARAMS) |
| 129 | } |
| 130 | var getTxBytes = false |
| 131 | if raw, ok := cmd["Raw"].(string); ok && raw == "1" { |
| 132 | getTxBytes = true |
| 133 | } |
| 134 | var hash common.Uint256 |
| 135 | hash, err := common.Uint256FromHexString(str) |
| 136 | if err != nil { |
| 137 | return ResponsePack(berr.INVALID_PARAMS) |
| 138 | } |
| 139 | resp["Result"], resp["Error"] = getBlock(hash, getTxBytes) |
| 140 | return resp |
| 141 | } |
| 142 | |
| 143 | //get block height by transaction hash |
| 144 | func GetBlockHeightByTxHash(cmd map[string]interface{}) map[string]interface{} { |
nothing calls this directly
no test coverage detected