private static uint GetCurBlockHeight(BaseTxReq data) { if (data.Node == null || string.IsNullOrEmpty(data.Node.Url)) { throw new Exception("没有提供远程节点"); } try { var info = JsonRpc.RpcClient.GetBlockCount(data.Node.Url, data.Node.AuthInfo); return((uint)info.result); } catch { throw new Exception("无法从远程节点获取当前高度信息"); } }
private static BaseRsp <string> SubmitTx(BaseTxReq data, string raw) { if (data.Node == null || string.IsNullOrEmpty(data.Node.Url)) { return(new BaseRsp <string>() { data = string.Empty, success = false, error = 1004, msg = "没有提供远程节点" }); } try { var info = JsonRpc.RpcClient.SubmitTx(data.Node.Url, data.Node.AuthInfo, raw); return(new BaseRsp <string>() { data = info.result?.hash, success = info.error == null, error = info.error?.code ?? 0, msg = info.error?.message ?? null, }); } catch (Exception e) { return(new BaseRsp <string>() { data = string.Empty, success = false, error = 1003, msg = e.Message }); } }