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

Function GetBlock

cmd/utils/gas.go:502–512  ·  view source on GitHub ↗
(hashOrHeight interface{})

Source from the content-addressed store, hash-verified

500}
501
502func 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
514func GetNetworkId() (uint32, error) {
515 data, ontErr := sendRpcRequest("getnetworkid", []interface{}{})

Callers 1

blockInfoFunction · 0.92

Calls 2

sendRpcRequestFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected