()
| 33 | ) |
| 34 | |
| 35 | func StartRPCServer() error { |
| 36 | log.Debug() |
| 37 | http.HandleFunc("/", rpc.Handle) |
| 38 | |
| 39 | rpc.HandleFunc("getbestblockhash", rpc.GetBestBlockHash) |
| 40 | rpc.HandleFunc("getblock", rpc.GetBlock) |
| 41 | rpc.HandleFunc("getblockcount", rpc.GetBlockCount) |
| 42 | rpc.HandleFunc("getblockhash", rpc.GetBlockHash) |
| 43 | rpc.HandleFunc("getconnectioncount", rpc.GetConnectionCount) |
| 44 | rpc.HandleFunc("getsyncstatus", rpc.GetSyncStatus) |
| 45 | //HandleFunc("getrawmempool", GetRawMemPool) |
| 46 | |
| 47 | rpc.HandleFunc("getrawtransaction", rpc.GetRawTransaction) |
| 48 | rpc.HandleFunc("sendrawtransaction", rpc.SendRawTransaction) |
| 49 | rpc.HandleFunc("getstorage", rpc.GetStorage) |
| 50 | rpc.HandleFunc("getversion", rpc.GetNodeVersion) |
| 51 | rpc.HandleFunc("getnetworkid", rpc.GetNetworkId) |
| 52 | |
| 53 | rpc.HandleFunc("getcontractstate", rpc.GetContractState) |
| 54 | rpc.HandleFunc("getmempooltxcount", rpc.GetMemPoolTxCount) |
| 55 | rpc.HandleFunc("getmempooltxstate", rpc.GetMemPoolTxState) |
| 56 | rpc.HandleFunc("getsmartcodeevent", rpc.GetSmartCodeEvent) |
| 57 | rpc.HandleFunc("getblockheightbytxhash", rpc.GetBlockHeightByTxHash) |
| 58 | |
| 59 | rpc.HandleFunc("getbalance", rpc.GetBalance) |
| 60 | rpc.HandleFunc("getallowance", rpc.GetAllowance) |
| 61 | rpc.HandleFunc("getmerkleproof", rpc.GetMerkleProof) |
| 62 | rpc.HandleFunc("getblocktxsbyheight", rpc.GetBlockTxsByHeight) |
| 63 | rpc.HandleFunc("getgasprice", rpc.GetGasPrice) |
| 64 | |
| 65 | err := http.ListenAndServe(":"+strconv.Itoa(int(cfg.DefConfig.Rpc.HttpJsonPort)), nil) |
| 66 | if err != nil { |
| 67 | return fmt.Errorf("ListenAndServe error:%s", err) |
| 68 | } |
| 69 | return nil |
| 70 | } |
no test coverage detected