(hashOrHeight interface{})
| 500 | } |
| 501 | |
| 502 | func GetBlock(hashOrHeight interface{}) ([]byte, error) { |
| 503 | data, ontErr := sendRpcRequest("getblock", []interface{}{hashOrHeight, 1}) |
| 504 | if ontErr == nil { |
| 505 | return data, nil |
| 506 | } |
| 507 | switch ontErr.ErrorCode { |
| 508 | case ERROR_INVALID_PARAMS: |
| 509 | return nil, fmt.Errorf("invalid block hash or block height:%v", hashOrHeight) |
| 510 | } |
| 511 | return nil, ontErr.Error |
| 512 | } |
| 513 | |
| 514 | func GetNetworkId() (uint32, error) { |
| 515 | data, ontErr := sendRpcRequest("getnetworkid", []interface{}{}) |
no test coverage detected