Browse Source

equihash: use client.show_message to get block height

current stratum is imcomplete and doesnt provide the coinbase data
master
Tanguy Pruvot 7 years ago
parent
commit
5aa50a4215
  1. 1
      ccminer.vcxproj
  2. 32
      equi/equi-stratum.cpp
  3. 1
      miner.h
  4. 3
      util.cpp

1
ccminer.vcxproj

@ -297,6 +297,7 @@
<CodeGeneration>compute_52,sm_52;compute_50,sm_50;compute_30,sm_30</CodeGeneration> <CodeGeneration>compute_52,sm_52;compute_50,sm_50;compute_30,sm_30</CodeGeneration>
<AdditionalOptions> -Xptxas -dlcm=ca -Xptxas -dscm=cs %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions> -Xptxas -dlcm=ca -Xptxas -dscm=cs %(AdditionalOptions)</AdditionalOptions>
<MaxRegCount>0</MaxRegCount> <MaxRegCount>0</MaxRegCount>
<CodeGeneration Condition="'$(Configuration)|$(Platform)'=='Release|x64'">compute_61,sm_61;compute_52,sm_52;compute_50,sm_50;compute_30,sm_30</CodeGeneration>
</CudaCompile> </CudaCompile>
<CudaCompile Include="neoscrypt\cuda_neoscrypt.cu"> <CudaCompile Include="neoscrypt\cuda_neoscrypt.cu">
<MaxRegCount>160</MaxRegCount> <MaxRegCount>160</MaxRegCount>

32
equi/equi-stratum.cpp

@ -185,6 +185,38 @@ out:
return ret; return ret;
} }
// equihash stratum protocol is not standard, use client.show_message to pass block height
bool equi_stratum_show_message(struct stratum_ctx *sctx, json_t *id, json_t *params)
{
char *s;
json_t *val;
bool ret;
val = json_array_get(params, 0);
if (val) {
const char* data = json_string_value(val);
if (data && strlen(data)) {
char symbol[32] = { 0 };
int ss = sscanf(data, "equihash %s block %u", symbol, &sctx->job.height);
if (opt_debug && ss > 1) applog(LOG_DEBUG, "%s", data);
}
}
if (!id || json_is_null(id))
return true;
val = json_object();
json_object_set(val, "id", id);
json_object_set_new(val, "error", json_null());
json_object_set_new(val, "result", json_true());
s = json_dumps(val, 0);
ret = stratum_send_line(sctx, s);
json_decref(val);
free(s);
return ret;
}
void equi_store_work_solution(struct work* work, uint32_t* hash, void* sol_data) void equi_store_work_solution(struct work* work, uint32_t* hash, void* sol_data)
{ {
int nonce = work->valid_nonces-1; int nonce = work->valid_nonces-1;

1
miner.h

@ -815,6 +815,7 @@ bool rpc2_stratum_authorize(struct stratum_ctx *sctx, const char *user, const ch
bool equi_stratum_notify(struct stratum_ctx *sctx, json_t *params); bool equi_stratum_notify(struct stratum_ctx *sctx, json_t *params);
bool equi_stratum_set_target(struct stratum_ctx *sctx, json_t *params); bool equi_stratum_set_target(struct stratum_ctx *sctx, json_t *params);
bool equi_stratum_submit(struct pool_infos *pool, struct work *work); bool equi_stratum_submit(struct pool_infos *pool, struct work *work);
bool equi_stratum_show_message(struct stratum_ctx *sctx, json_t *id, json_t *params);
void equi_work_set_target(struct work* work, double diff); void equi_work_set_target(struct work* work, double diff);
void equi_store_work_solution(struct work* work, uint32_t* hash, void* sol_data); void equi_store_work_solution(struct work* work, uint32_t* hash, void* sol_data);
int equi_verify_sol(void * const hdr, void * const sol); int equi_verify_sol(void * const hdr, void * const sol);

3
util.cpp

@ -1782,6 +1782,9 @@ static bool stratum_show_message(struct stratum_ctx *sctx, json_t *id, json_t *p
json_t *val; json_t *val;
bool ret; bool ret;
if (sctx->is_equihash)
return equi_stratum_show_message(sctx, id, params);
val = json_array_get(params, 0); val = json_array_get(params, 0);
if (val) if (val)
applog(LOG_NOTICE, "MESSAGE FROM SERVER: %s", json_string_value(val)); applog(LOG_NOTICE, "MESSAGE FROM SERVER: %s", json_string_value(val));

Loading…
Cancel
Save